changeset 14240:a9992bc3c3f7 gui

GUI: Added qtermwidget snapshot as a subproject to build as a library that links with Octave GUI.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Sat, 21 Jan 2012 11:26:36 +0100
parents 7ecaa8a66d5a
children 637675470c58
files gui/COPYING gui/Doxyfile gui/README gui/all.pro gui/bin/bin gui/compile.sh gui/default-settings/.octave-gui gui/kb-layouts/default.keytab gui/kb-layouts/linux.keytab gui/kb-layouts/vt420pc.keytab gui/languages/de-de.qm gui/languages/de-de.ts gui/languages/es-es.qm gui/languages/es-es.ts gui/languages/generic.qm gui/languages/generic.ts gui/languages/pt-br.qm gui/languages/pt-br.ts gui/languages/ru-ru.qm gui/languages/ru-ru.ts gui/languages/uk-ua.qm gui/languages/uk-ua.ts gui/media/chat.png gui/media/help_index.png gui/media/icons_license gui/media/jabber_protocol.png gui/media/logo.png gui/media/terminal.png gui/moc-files/moc-files gui/msvc-debug.pri gui/object-files/object-files gui/octave-gui.pro gui/octave-gui/COPYING gui/octave-gui/Doxyfile gui/octave-gui/README gui/octave-gui/bin/bin gui/octave-gui/compile.sh gui/octave-gui/default-settings/.octave-gui gui/octave-gui/kb-layouts/default.keytab gui/octave-gui/kb-layouts/linux.keytab gui/octave-gui/kb-layouts/vt420pc.keytab gui/octave-gui/languages/de-de.qm gui/octave-gui/languages/de-de.ts gui/octave-gui/languages/es-es.qm gui/octave-gui/languages/es-es.ts gui/octave-gui/languages/generic.qm gui/octave-gui/languages/generic.ts gui/octave-gui/languages/pt-br.qm gui/octave-gui/languages/pt-br.ts gui/octave-gui/languages/ru-ru.qm gui/octave-gui/languages/ru-ru.ts gui/octave-gui/languages/uk-ua.qm gui/octave-gui/languages/uk-ua.ts gui/octave-gui/media/chat.png gui/octave-gui/media/help_index.png gui/octave-gui/media/icons_license gui/octave-gui/media/jabber_protocol.png gui/octave-gui/media/logo.png gui/octave-gui/media/terminal.png gui/octave-gui/moc-files/moc-files gui/octave-gui/msvc-debug.pri gui/octave-gui/object-files/object-files gui/octave-gui/octave-gui.pro gui/octave-gui/src/AbstractTerminalView.cpp gui/octave-gui/src/AbstractTerminalView.h gui/octave-gui/src/BrowserWidget.cpp gui/octave-gui/src/BrowserWidget.h gui/octave-gui/src/CommandLineParser.cpp gui/octave-gui/src/CommandLineParser.h gui/octave-gui/src/FileEditorMdiSubWindow.cpp gui/octave-gui/src/FileEditorMdiSubWindow.h gui/octave-gui/src/FilesDockWidget.cpp gui/octave-gui/src/FilesDockWidget.h gui/octave-gui/src/HistoryDockWidget.cpp gui/octave-gui/src/HistoryDockWidget.h gui/octave-gui/src/ImageViewerMdiSubWindow.cpp gui/octave-gui/src/ImageViewerMdiSubWindow.h gui/octave-gui/src/MainWindow.cpp gui/octave-gui/src/MainWindow.h gui/octave-gui/src/OctaveGUI.cpp gui/octave-gui/src/ResourceManager.cpp gui/octave-gui/src/ResourceManager.h gui/octave-gui/src/SettingsDialog.cpp gui/octave-gui/src/SettingsDialog.h gui/octave-gui/src/SettingsDialog.ui gui/octave-gui/src/TerminalHighlighter.cpp gui/octave-gui/src/TerminalHighlighter.h gui/octave-gui/src/TerminalView.cpp gui/octave-gui/src/TerminalView.h gui/octave-gui/src/WelcomeWizard.cpp gui/octave-gui/src/WelcomeWizard.h gui/octave-gui/src/WelcomeWizard.ui gui/octave-gui/src/WinTerminalView.cpp gui/octave-gui/src/WinTerminalView.h gui/octave-gui/src/WorkspaceView.cpp gui/octave-gui/src/WorkspaceView.h gui/octave-gui/src/backend/OctaveCallbackThread.cpp gui/octave-gui/src/backend/OctaveCallbackThread.h gui/octave-gui/src/backend/OctaveLink.cpp gui/octave-gui/src/backend/OctaveLink.h gui/octave-gui/src/backend/OctaveMainThread.cpp gui/octave-gui/src/backend/OctaveMainThread.h gui/octave-gui/src/backend/ReadlineAdapter.cpp gui/octave-gui/src/backend/ReadlineAdapter.h gui/octave-gui/src/irc/IRCClientImpl.cpp gui/octave-gui/src/irc/IRCClientImpl.h gui/octave-gui/src/irc/IRCClientInterface.h gui/octave-gui/src/irc/IRCCodes.h gui/octave-gui/src/irc/IRCWidget.cpp gui/octave-gui/src/irc/IRCWidget.h gui/octave-gui/src/irc/Makefile.am gui/octave-gui/src/lexer/lexeroctavegui.cpp gui/octave-gui/src/lexer/lexeroctavegui.h gui/octave-gui/src/terminal/KPty.cpp gui/octave-gui/src/terminal/KPty.h gui/octave-gui/src/terminal/KPtyDevice.cpp gui/octave-gui/src/terminal/KPtyDevice.h gui/octave-gui/src/terminal/LinuxTerminalEmulation.cpp gui/octave-gui/src/terminal/LinuxTerminalEmulation.h gui/octave-gui/src/terminal/TerminalEmulation.cpp gui/octave-gui/src/terminal/TerminalEmulation.h gui/octave-gui/src/terminal/win32/QConsole gui/octave-gui/src/terminal/win32/QConsole.cpp gui/octave-gui/src/terminal/win32/QConsole.h gui/octave-gui/src/terminal/win32/QConsoleColors.cpp gui/octave-gui/src/terminal/win32/QConsoleColors.h gui/octave-gui/start.sh gui/octave-gui/translators gui/qtermwidget/AUTHORS gui/qtermwidget/COPYING gui/qtermwidget/CVS/Entries gui/qtermwidget/CVS/Repository gui/qtermwidget/CVS/Root gui/qtermwidget/Changelog gui/qtermwidget/INSTALL gui/qtermwidget/README gui/qtermwidget/TODO gui/qtermwidget/lib/BlockArray.cpp gui/qtermwidget/lib/BlockArray.h gui/qtermwidget/lib/CVS/Entries gui/qtermwidget/lib/CVS/Repository gui/qtermwidget/lib/CVS/Root gui/qtermwidget/lib/Character.h gui/qtermwidget/lib/CharacterColor.h gui/qtermwidget/lib/ColorTables.h gui/qtermwidget/lib/DefaultTranslatorText.h gui/qtermwidget/lib/Emulation.cpp gui/qtermwidget/lib/Emulation.h gui/qtermwidget/lib/ExtendedDefaultTranslator.h gui/qtermwidget/lib/Filter.cpp gui/qtermwidget/lib/Filter.h gui/qtermwidget/lib/History.cpp gui/qtermwidget/lib/History.h gui/qtermwidget/lib/KeyboardTranslator.cpp gui/qtermwidget/lib/KeyboardTranslator.h gui/qtermwidget/lib/LineFont.h gui/qtermwidget/lib/LineFont.src gui/qtermwidget/lib/Pty.cpp gui/qtermwidget/lib/Pty.h gui/qtermwidget/lib/README gui/qtermwidget/lib/Screen.cpp gui/qtermwidget/lib/Screen.h gui/qtermwidget/lib/ScreenWindow.cpp gui/qtermwidget/lib/ScreenWindow.h gui/qtermwidget/lib/Session.cpp gui/qtermwidget/lib/Session.h gui/qtermwidget/lib/ShellCommand.cpp gui/qtermwidget/lib/ShellCommand.h gui/qtermwidget/lib/TerminalCharacterDecoder.cpp gui/qtermwidget/lib/TerminalCharacterDecoder.h gui/qtermwidget/lib/TerminalDisplay.cpp gui/qtermwidget/lib/TerminalDisplay.h gui/qtermwidget/lib/Vt102Emulation.cpp gui/qtermwidget/lib/Vt102Emulation.h gui/qtermwidget/lib/default.keytab gui/qtermwidget/lib/k3process.cpp gui/qtermwidget/lib/k3process.h gui/qtermwidget/lib/k3processcontroller.cpp gui/qtermwidget/lib/k3processcontroller.h gui/qtermwidget/lib/kb-layouts/CVS/Entries gui/qtermwidget/lib/kb-layouts/CVS/Repository gui/qtermwidget/lib/kb-layouts/CVS/Root gui/qtermwidget/lib/kb-layouts/default.keytab gui/qtermwidget/lib/kb-layouts/linux.keytab gui/qtermwidget/lib/kb-layouts/vt420pc.keytab gui/qtermwidget/lib/konsole_wcwidth.cpp gui/qtermwidget/lib/konsole_wcwidth.h gui/qtermwidget/lib/kpty.cpp gui/qtermwidget/lib/kpty.h gui/qtermwidget/lib/kpty_p.h gui/qtermwidget/lib/lib.pro gui/qtermwidget/lib/qtermwidget.cpp gui/qtermwidget/lib/qtermwidget.h gui/qtermwidget/qtermwidget.pro gui/qtermwidget/src/CVS/Entries gui/qtermwidget/src/CVS/Repository gui/qtermwidget/src/CVS/Root gui/qtermwidget/src/README gui/qtermwidget/src/main.cpp gui/qtermwidget/src/src.pro gui/src/AbstractTerminalView.cpp gui/src/AbstractTerminalView.h gui/src/BrowserWidget.cpp gui/src/BrowserWidget.h gui/src/CommandLineParser.cpp gui/src/CommandLineParser.h gui/src/FileEditorMdiSubWindow.cpp gui/src/FileEditorMdiSubWindow.h gui/src/FilesDockWidget.cpp gui/src/FilesDockWidget.h gui/src/HistoryDockWidget.cpp gui/src/HistoryDockWidget.h gui/src/ImageViewerMdiSubWindow.cpp gui/src/ImageViewerMdiSubWindow.h gui/src/MainWindow.cpp gui/src/MainWindow.h gui/src/OctaveGUI.cpp gui/src/ResourceManager.cpp gui/src/ResourceManager.h gui/src/SettingsDialog.cpp gui/src/SettingsDialog.h gui/src/SettingsDialog.ui gui/src/TerminalHighlighter.cpp gui/src/TerminalHighlighter.h gui/src/TerminalView.cpp gui/src/TerminalView.h gui/src/WelcomeWizard.cpp gui/src/WelcomeWizard.h gui/src/WelcomeWizard.ui gui/src/WinTerminalView.cpp gui/src/WinTerminalView.h gui/src/WorkspaceView.cpp gui/src/WorkspaceView.h gui/src/backend/OctaveCallbackThread.cpp gui/src/backend/OctaveCallbackThread.h gui/src/backend/OctaveLink.cpp gui/src/backend/OctaveLink.h gui/src/backend/OctaveMainThread.cpp gui/src/backend/OctaveMainThread.h gui/src/backend/ReadlineAdapter.cpp gui/src/backend/ReadlineAdapter.h gui/src/irc/IRCClientImpl.cpp gui/src/irc/IRCClientImpl.h gui/src/irc/IRCClientInterface.h gui/src/irc/IRCCodes.h gui/src/irc/IRCWidget.cpp gui/src/irc/IRCWidget.h gui/src/irc/Makefile.am gui/src/lexer/lexeroctavegui.cpp gui/src/lexer/lexeroctavegui.h gui/src/terminal/KPty.cpp gui/src/terminal/KPty.h gui/src/terminal/KPtyDevice.cpp gui/src/terminal/KPtyDevice.h gui/src/terminal/LinuxTerminalEmulation.cpp gui/src/terminal/LinuxTerminalEmulation.h gui/src/terminal/TerminalEmulation.cpp gui/src/terminal/TerminalEmulation.h gui/src/terminal/win32/QConsole gui/src/terminal/win32/QConsole.cpp gui/src/terminal/win32/QConsole.h gui/src/terminal/win32/QConsoleColors.cpp gui/src/terminal/win32/QConsoleColors.h gui/start.sh gui/translators
diffstat 259 files changed, 39909 insertions(+), 17816 deletions(-) [+]
line wrap: on
line diff
--- a/gui/COPYING	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-GNU AFFERO GENERAL PUBLIC LICENSE
-
-Version 3, 19 November 2007
-
-Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/> 
-Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
-
-Preamble
-
-The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
-
-The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
-
-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 them 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.
-
-Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
-
-A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
-
-The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
-
-An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
-
-The precise terms and conditions for copying, distribution and modification follow.
-
-TERMS AND CONDITIONS
-
-0. Definitions.
-"This License" refers to version 3 of the GNU Affero General Public License.
-
-"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
-
-"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
-
-To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
-
-A "covered work" means either the unmodified Program or a work based on the Program.
-
-To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
-
-To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
-
-An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
-
-1. Source Code.
-The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
-
-A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
-
-The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
-
-The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
-
-The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
-
-The Corresponding Source for a work in source code form is that same work.
-
-2. Basic Permissions.
-All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
-
-You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
-
-Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
-
-3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
-
-When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
-
-4. Conveying Verbatim Copies.
-You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
-
-You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
-
-5. Conveying Modified Source Versions.
-You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
-
-a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
-b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
-c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
-d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
-A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
-
-6. Conveying Non-Source Forms.
-You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
-
-a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
-b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
-c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
-d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
-e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
-A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
-
-A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
-
-"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
-
-If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
-
-The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
-
-Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
-
-7. Additional Terms.
-"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
-
-When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
-
-Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
-
-a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
-b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
-c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
-d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
-e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
-f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
-All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
-
-If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
-
-Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
-
-8. Termination.
-You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
-
-However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
-
-Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
-
-Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
-
-9. Acceptance Not Required for Having Copies.
-You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
-
-10. Automatic Licensing of Downstream Recipients.
-Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
-
-An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
-
-You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
-
-11. Patents.
-A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
-
-A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
-
-Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
-
-In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
-
-If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
-
-If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
-
-A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
-
-Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
-
-12. No Surrender of Others' Freedom.
-If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
-
-13. Remote Network Interaction; Use with the GNU General Public License.
-Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
-
-Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
-
-14. Revised Versions of this License.
-The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
-
-If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
-
-Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
-
-15. Disclaimer of Warranty.
-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.
-
-16. Limitation of Liability.
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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.
-
-17. Interpretation of Sections 15 and 16.
-If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
-
-END OF TERMS AND CONDITIONS
--- a/gui/Doxyfile	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1679 +0,0 @@
-# Quint - A graphical user interface for Octave
-# Copyright (C) 2011 Jacob Dawid
-# jacob.dawid@googlemail.com
-#
-# 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 3 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, see <http://www.gnu.org/licenses/>.
-
-
-# Doxyfile 1.7.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file 
-# that follow. The default is UTF-8 which is also the encoding used for all 
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
-# iconv built into libc) for the transcoding. See 
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING      = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
-# by quotes) that should identify the project.
-
-PROJECT_NAME           = Quint
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
-# This could be handy for archiving the generated documentation or 
-# if some version control system is used.
-
-PROJECT_NUMBER         = 0.4
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
-# base path where the generated documentation will be put. 
-# If a relative path is entered, it will be relative to the location 
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = /home/jacob/Desktop/Quint-Documentation
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
-# 4096 sub-directories (in 2 levels) under the output directory of each output 
-# format and will distribute the generated files over these directories. 
-# Enabling this option can be useful when feeding doxygen a huge amount of 
-# source files, where putting all generated files in the same directory would 
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
-# documentation generated by doxygen is written. Doxygen will use this 
-# information to generate all constant output in the proper language. 
-# The default language is English, other supported languages are: 
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, 
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE        = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
-# include brief member descriptions after the members that are listed in 
-# the file and class documentation (similar to JavaDoc). 
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
-# the brief description of a member or function before the detailed description. 
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator 
-# that is used to form the text in various listings. Each string 
-# in this list, if found as the leading text of the brief description, will be 
-# stripped from the text and the result after processing the whole list, is 
-# used as the annotated text. Otherwise, the brief description is used as-is. 
-# If left blank, the following values are used ("$name" is automatically 
-# replaced with the name of the entity): "The $name class" "The $name widget" 
-# "The $name file" "is" "provides" "specifies" "contains" 
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF       = "The $name class" \
-                         "The $name widget" \
-                         "The $name file" \
-                         is \
-                         provides \
-                         specifies \
-                         contains \
-                         represents \
-                         a \
-                         an \
-                         the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
-# Doxygen will generate a detailed section even if there is only a brief 
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
-# inherited members of a class in the documentation of that class as if those 
-# members were ordinary class members. Constructors, destructors and assignment 
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
-# path before files name in the file list and in the header files. If set 
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
-# can be used to strip a user-defined part of the path. Stripping is 
-# only done if one of the specified strings matches the left-hand part of 
-# the path. The tag can be used to show relative paths in the file list. 
-# If left blank the directory from which doxygen is run is used as the 
-# path to strip.
-
-STRIP_FROM_PATH        = 
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
-# the path mentioned in the documentation of a class, which tells 
-# the reader which header file to include in order to use a class. 
-# If left blank only the name of the header file containing the class 
-# definition is used. Otherwise one should specify the include paths that 
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH    = 
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
-# (but less readable) file names. This can be useful is your file systems 
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
-# will interpret the first line (until the first dot) of a JavaDoc-style 
-# comment as the brief description. If set to NO, the JavaDoc 
-# comments will behave just like regular Qt-style comments 
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF      = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
-# interpret the first line (until the first dot) of a Qt-style 
-# comment as the brief description. If set to NO, the comments 
-# will behave just like regular Qt-style comments (thus requiring 
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF           = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
-# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
-# comments) as a brief description. This used to be the default behaviour. 
-# The new default is to treat a multi-line C++ comment block as a detailed 
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
-# member inherits the documentation from any documented member that it 
-# re-implements.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
-# a new page for each member. If set to NO, the documentation of a member will 
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 8
-
-# This tag can be used to specify a number of aliases that acts 
-# as commands in the documentation. An alias has the form "name=value". 
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
-# put the command \sideeffect (or @sideeffect) in the documentation, which 
-# will result in a user-defined paragraph with heading "Side Effects:". 
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                = 
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
-# sources only. Doxygen will then generate output that is more tailored for C. 
-# For instance, some of the names that are used will be different. The list 
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
-# sources only. Doxygen will then generate output that is more tailored for 
-# Java. For instance, namespaces will be presented as packages, qualified 
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
-# sources only. Doxygen will then generate output that is more tailored for 
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN   = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
-# sources. Doxygen will then generate output that is tailored for 
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL   = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it 
-# parses. With this tag you can assign which parser to use for a given extension. 
-# Doxygen has a built-in mapping, but you can override or extend it using this 
-# tag. The format is ext=language, where ext is a file extension, and language 
-# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, 
-# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make 
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C 
-# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions 
-# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING      = 
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
-# to include (a tag file for) the STL sources as input, then you should 
-# set this tag to YES in order to let doxygen match functions declarations and 
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
-# func(std::string) {}). This also make the inheritance and collaboration 
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT    = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to 
-# enable parsing support.
-
-CPP_CLI_SUPPORT        = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
-# Doxygen will parse them like normal C++ but will assume all classes use public 
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT            = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter 
-# and setter methods for a property. Setting this option to YES (the default) 
-# will make doxygen to replace the get and set methods by a property in the 
-# documentation. This will only work if the methods are indeed getting or 
-# setting a simple type. If this is not the case, or you want to show the 
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT   = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
-# tag is set to YES, then doxygen will reuse the documentation of the first 
-# member in the group (if any) for the other members of the group. By default 
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
-# the same type (for instance a group of public functions) to be put as a 
-# subgroup of that type (e.g. under the Public Functions section). Set it to 
-# NO to prevent subgrouping. Alternatively, this can be done per class using 
-# the \nosubgrouping command.
-
-SUBGROUPING            = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
-# is documented as struct, union, or enum with the name of the typedef. So 
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
-# with name TypeT. When disabled the typedef will appear as a member of a file, 
-# namespace, or class. And the struct will be named TypeS. This can typically 
-# be useful for C code in case the coding convention dictates that all compound 
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT   = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
-# determine which symbols to keep in memory and which to flush to disk. 
-# When the cache is full, less often used symbols will be written to disk. 
-# For small to medium size projects (<1000 input files) the default value is 
-# probably good enough. For larger projects a too small cache size can cause 
-# doxygen to be busy swapping symbols to and from disk most of the time 
-# causing a significant performance penality. 
-# If the system has enough physical memory increasing the cache will improve the 
-# performance by keeping more symbols in memory. Note that the value works on 
-# a logarithmic scale so increasing the size by one will rougly double the 
-# memory usage. The cache size is given by this formula: 
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE      = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
-# documentation are documented, even if no documentation was available. 
-# Private class members and static file members will be hidden unless 
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
-# will be included in the documentation.
-
-EXTRACT_PRIVATE        = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
-# will be included in the documentation.
-
-EXTRACT_STATIC         = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
-# defined locally in source files will be included in the documentation. 
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. When set to YES local 
-# methods, which are defined in the implementation section but not in 
-# the interface are included in the documentation. 
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be 
-# extracted and appear in the documentation as a namespace called 
-# 'anonymous_namespace{file}', where file will be replaced with the base 
-# name of the file that contains the anonymous namespace. By default 
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES   = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
-# undocumented classes that are normally visible in the class hierarchy. 
-# If set to NO (the default) these classes will be included in the various 
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
-# friend (class|struct|union) declarations. 
-# If set to NO (the default) these declarations will be included in the 
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
-# documentation blocks found inside the body of a function. 
-# If set to NO (the default) these blocks will be appended to the 
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation 
-# that is typed after a \internal command is included. If the tag is set 
-# to NO (the default) then the documentation will be excluded. 
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
-# file names in lower-case letters. If set to YES upper-case letters are also 
-# allowed. This is useful if you have classes or files whose names only differ 
-# in case and if your file system supports case sensitive file names. Windows 
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES       = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
-# will show members with their full class and namespace scopes in the 
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
-# will put a list of the files that are included by a file in the documentation 
-# of that file.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen 
-# will list include files with double quotes in the documentation 
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES   = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
-# will sort the (detailed) documentation of file and class members 
-# alphabetically by member name. If set to NO the members will appear in 
-# declaration order.
-
-SORT_MEMBER_DOCS       = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
-# brief documentation of file, namespace and class members alphabetically 
-# by member name. If set to NO (the default) the members will appear in 
-# declaration order.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen 
-# will sort the (brief and detailed) documentation of class members so that 
-# constructors and destructors are listed first. If set to NO (the default) 
-# the constructors will appear in the respective orders defined by 
-# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. 
-# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO 
-# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
-# hierarchy of group names into alphabetical order. If set to NO (the default) 
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES       = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
-# sorted by fully-qualified names, including namespaces. If set to 
-# NO (the default), the class list will be sorted only by class name, 
-# not including the namespace part. 
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 
-# Note: This option applies only to the class list, not to the 
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or 
-# disable (NO) the todo list. This list is created by putting \todo 
-# commands in the documentation.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or 
-# disable (NO) the test list. This list is created by putting \test 
-# commands in the documentation.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or 
-# disable (NO) the bug list. This list is created by putting \bug 
-# commands in the documentation.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
-# disable (NO) the deprecated list. This list is created by putting 
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional 
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS       = 
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
-# the initial value of a variable or define consists of for it to appear in 
-# the documentation. If the initializer consists of more lines than specified 
-# here it will be hidden. Use a value of 0 to hide initializers completely. 
-# The appearance of the initializer of individual variables and defines in the 
-# documentation can be controlled using \showinitializer or \hideinitializer 
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
-# at the bottom of the documentation of classes and structs. If set to YES the 
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES       = NO
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
-# This will remove the Files entry from the Quick Index and from the 
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES             = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
-# Namespaces page.  This will remove the Namespaces entry from the Quick Index 
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES        = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
-# doxygen should invoke to get the current version for each file (typically from 
-# the version control system). Doxygen will invoke the program by executing (via 
-# popen()) the command <command> <input-file>, where <command> is the value of 
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
-# provided by doxygen. Whatever the program writes to standard output 
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER    = 
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed 
-# by doxygen. The layout file controls the global structure of the generated 
-# output files in an output format independent way. The create the layout file 
-# that represents doxygen's defaults, run doxygen with the -l option. 
-# You can optionally specify a file name after the option, if omitted 
-# DoxygenLayout.xml will be used as the name of the layout file.
-
-LAYOUT_FILE            = 
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated 
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are 
-# generated by doxygen. Possible values are YES and NO. If left blank 
-# NO is used.
-
-WARNINGS               = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
-# potential errors in the documentation, such as not documenting some 
-# parameters in a documented function, or documenting parameters that 
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR      = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for 
-# functions that are documented, but have no documentation for their parameters 
-# or return value. If set to NO (the default) doxygen will only warn about 
-# wrong or incomplete parameter documentation, but not about the absence of 
-# documentation.
-
-WARN_NO_PARAMDOC       = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that 
-# doxygen can produce. The string should contain the $file, $line, and $text 
-# tags, which will be replaced by the file and line number from which the 
-# warning originated and the warning text. Optionally the format may contain 
-# $version, which will be replaced by the version of the file (if it could 
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning 
-# and error messages should be written. If left blank the output is written 
-# to stderr.
-
-WARN_LOGFILE           = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain 
-# documented source files. You may enter file names like "myfile.cpp" or 
-# directories like "/usr/src/myproject". Separate the files or directories 
-# with spaces.
-
-INPUT                  = /home/jacob/Desktop/gnu-octave/gui/src
-
-# This tag can be used to specify the character encoding of the source files 
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
-# also the default input encoding. Doxygen uses libiconv (or the iconv built 
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
-# the list of possible encodings.
-
-INPUT_ENCODING         = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the 
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank the following patterns are tested: 
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS          = *.c \
-                         *.cc \
-                         *.cxx \
-                         *.cpp \
-                         *.c++ \
-                         *.d \
-                         *.java \
-                         *.ii \
-                         *.ixx \
-                         *.ipp \
-                         *.i++ \
-                         *.inl \
-                         *.h \
-                         *.hh \
-                         *.hxx \
-                         *.hpp \
-                         *.h++ \
-                         *.idl \
-                         *.odl \
-                         *.cs \
-                         *.php \
-                         *.php3 \
-                         *.inc \
-                         *.m \
-                         *.mm \
-                         *.dox \
-                         *.py \
-                         *.f90 \
-                         *.f \
-                         *.vhd \
-                         *.vhdl
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
-# should be searched for input files as well. Possible values are YES and NO. 
-# If left blank NO is used.
-
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should 
-# excluded from the INPUT source files. This way you can easily exclude a 
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE                = 
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
-# directories that are symbolic links (a Unix filesystem feature) are excluded 
-# from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the 
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
-# certain files from those directories. Note that the wildcards are matched 
-# against the file with absolute path, so to exclude all test directories 
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS       = 
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
-# (namespaces, classes, functions, etc.) that should be excluded from the 
-# output. The symbol name can be a fully qualified name, a word, or if the 
-# wildcard * is used, a substring. Examples: ANamespace, AClass, 
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS        = 
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or 
-# directories that contain example code fragments that are included (see 
-# the \include command).
-
-EXAMPLE_PATH           = 
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank all files are included.
-
-EXAMPLE_PATTERNS       = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
-# searched for input files to be used with the \include or \dontinclude 
-# commands irrespective of the value of the RECURSIVE tag. 
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or 
-# directories that contain image that are included in the documentation (see 
-# the \image command).
-
-IMAGE_PATH             = 
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should 
-# invoke to filter for each input file. Doxygen will invoke the filter program 
-# by executing (via popen()) the command <filter> <input-file>, where <filter> 
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
-# input file. Doxygen will then use the output that the filter program writes 
-# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
-# ignored.
-
-INPUT_FILTER           = 
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
-# basis.  Doxygen will compare the file name with each pattern and apply the 
-# filter if there is a match.  The filters are a list of the form: 
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
-# is applied to all files.
-
-FILTER_PATTERNS        = 
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
-# INPUT_FILTER) will be used to filter the input files when producing source 
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
-# be generated. Documented entities will be cross-referenced with these sources. 
-# Note: To get rid of all source code in the generated output, make sure also 
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER         = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body 
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
-# doxygen to hide any special comment blocks from generated source code 
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES 
-# then for each documented function all documented 
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES 
-# then for each documented function all documented entities 
-# called/used by that function will be listed.
-
-REFERENCES_RELATION    = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 
-# link to the source code.  Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code 
-# will point to the HTML generated by the htags(1) tool instead of doxygen 
-# built-in source browser. The htags tool is part of GNU's global source 
-# tagging system (see http://www.gnu.org/software/global/global.html). You 
-# will need version 4.8.6 or higher.
-
-USE_HTAGS              = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
-# will generate a verbatim copy of the header file for each class for 
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
-# of all compounds will be generated. Enable this if the project 
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all 
-# classes will be put under the same header in the alphabetical index. 
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX          = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard header.
-
-HTML_HEADER            = 
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard footer.
-
-HTML_FOOTER            = 
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
-# style sheet that is used by each HTML page. It can be used to 
-# fine-tune the look of the HTML output. If the tag is left blank doxygen 
-# will generate a default style sheet. Note that doxygen will try to copy 
-# the style sheet file to the HTML output directory, so don't put your own 
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET        = 
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 
-# Doxygen will adjust the colors in the stylesheet and background images 
-# according to this color. Hue is specified as an angle on a colorwheel, 
-# see http://en.wikipedia.org/wiki/Hue for more information. 
-# For instance the value 0 represents red, 60 is yellow, 120 is green, 
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. 
-# The allowed range is 0 to 359.
-
-HTML_COLORSTYLE_HUE    = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of 
-# the colors in the HTML output. For a value of 0 the output will use 
-# grayscales only. A value of 255 will produce the most vivid colors.
-
-HTML_COLORSTYLE_SAT    = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to 
-# the luminance component of the colors in the HTML output. Values below 
-# 100 gradually make the output lighter, whereas values above 100 make 
-# the output darker. The value divided by 100 is the actual gamma applied, 
-# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, 
-# and 100 does not change the gamma.
-
-HTML_COLORSTYLE_GAMMA  = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML 
-# page will contain the date and time when the page was generated. Setting 
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP         = YES
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
-# documentation will contain sections that can be hidden and shown after the 
-# page has loaded. For this to work a browser that supports 
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS  = NO
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files 
-# will be generated that can be used as input for Apple's Xcode 3 
-# integrated development environment, introduced with OSX 10.5 (Leopard). 
-# To create a documentation set, doxygen will generate a Makefile in the 
-# HTML output directory. Running make will produce the docset in that 
-# directory and running "make install" will install the docset in 
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
-# it at startup. 
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html 
-# for more information.
-
-GENERATE_DOCSET        = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
-# feed. A documentation feed provides an umbrella under which multiple 
-# documentation sets from a single provider (such as a company or product suite) 
-# can be grouped.
-
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
-# should uniquely identify the documentation set bundle. This should be a 
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify 
-# the documentation publisher. This should be a reverse domain-name style 
-# string, e.g. com.mycompany.MyDocSet.documentation.
-
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-
-# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
-
-DOCSET_PUBLISHER_NAME  = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
-# will be generated that can be used as input for tools like the 
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
-# be used to specify the file name of the resulting .chm file. You 
-# can add a path in front of the file if the result should not be 
-# written to the html output directory.
-
-CHM_FILE               = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
-# be used to specify the location (absolute path including file name) of 
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION           = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
-# controls if a separate .chi index file is generated (YES) or that 
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file 
-# content.
-
-CHM_INDEX_ENCODING     = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
-# controls whether a binary table of contents is generated (YES) or a 
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members 
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and 
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated 
-# that can be used as input for Qt's qhelpgenerator to generate a 
-# Qt Compressed Help (.qch) of the generated HTML documentation.
-
-GENERATE_QHP           = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
-# be used to specify the file name of the resulting .qch file. 
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE               = 
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating 
-# Qt Help Project output. For more information please see 
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE          = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
-# Qt Help Project output. For more information please see 
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER     = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to 
-# add. For more information please see 
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME   = 
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the 
-# custom filter to add. For more information please see 
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> 
-# Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS  = 
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this 
-# project's 
-# filter section matches. 
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> 
-# Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS  = 
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
-# be used to specify the location of Qt's qhelpgenerator. 
-# If non-empty doxygen will try to run qhelpgenerator on the generated 
-# .qhp file.
-
-QHG_LOCATION           = 
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files  
-# will be generated, which together with the HTML files, form an Eclipse help 
-# plugin. To install this plugin and make it available under the help contents 
-# menu in Eclipse, the contents of the directory containing the HTML and XML 
-# files needs to be copied into the plugins directory of eclipse. The name of 
-# the directory within the plugins directory should be the same as 
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before 
-# the help appears.
-
-GENERATE_ECLIPSEHELP   = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin 
-# the directory name containing the HTML and XML files should also have 
-# this name.
-
-ECLIPSE_DOC_ID         = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
-# top of each HTML page. The value NO (the default) enables the index and 
-# the value YES disables it.
-
-DISABLE_INDEX          = NO
-
-# This tag can be used to set the number of enum values (range [1..20]) 
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
-# structure should be generated to display hierarchical information. 
-# If the tag value is set to YES, a side panel will be generated 
-# containing a tree-like index structure (just like the one that 
-# is generated for HTML Help). For this to work a browser that supports 
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). 
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW      = NO
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES       = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
-# used to set the initial width (in pixels) of the frame in which the tree 
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open 
-# links to external symbols imported via tag files in a separate window.
-
-EXT_LINKS_IN_WINDOW    = NO
-
-# Use this tag to change the font size of Latex formulas included 
-# as images in the HTML documentation. The default is 10. Note that 
-# when you change the font size after a successful doxygen run you need 
-# to manually remove any form_*.png images from the HTML output directory 
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE       = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images 
-# generated for formulas are transparent PNGs. Transparent PNGs are 
-# not supported properly for IE 6.0, but are supported on all modern browsers. 
-# Note that when changing this option you need to delete any form_*.png files 
-# in the HTML output before the changes have effect.
-
-FORMULA_TRANSPARENT    = YES
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box 
-# for the HTML output. The underlying search engine uses javascript 
-# and DHTML and should work on any modern browser. Note that when using 
-# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets 
-# (GENERATE_DOCSET) there is already a search function so this one should 
-# typically be disabled. For large projects the javascript based search engine 
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE           = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be 
-# implemented using a PHP enabled web server instead of at the web client 
-# using Javascript. Doxygen will generate the search PHP script and index 
-# file to put on the web server. The advantage of the server 
-# based approach is that it scales better to large projects and allows 
-# full text search. The disadvances is that it is more difficult to setup 
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
-# generate Latex output.
-
-GENERATE_LATEX         = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
-# invoked. If left blank `latex' will be used as the default command name. 
-# Note that when enabling USE_PDFLATEX this option is only used for 
-# generating bitmaps for formulas in the HTML output, but not in the 
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
-# generate index for LaTeX. If left blank `makeindex' will be used as the 
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
-# LaTeX documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used 
-# by the printer. Possible values are: a4, a4wide, letter, legal and 
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE             = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         = 
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
-# the generated latex document. The header should contain everything until 
-# the first chapter. If it is left blank doxygen will generate a 
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           = 
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
-# contain links (just like the HTML output) instead of page references 
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
-# plain latex in the generated Makefile. Set this option to YES to get a 
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
-# command to the generated LaTeX files. This will instruct LaTeX to keep 
-# running if errors occur, instead of asking the user for help. 
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
-# include the index chapters (such as File Index, Compound Index, etc.) 
-# in the output.
-
-LATEX_HIDE_INDICES     = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include 
-# source code with syntax highlighting in the LaTeX output. 
-# Note that which sources are shown also depends on other settings 
-# such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE      = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
-# The RTF output is optimized for Word 97 and may not look very pretty with 
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
-# RTF documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
-# will contain hyperlink fields. The RTF file will 
-# contain links (just like the HTML output) instead of page references. 
-# This makes the output suitable for online browsing using WORD or other 
-# programs which support those fields. 
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's 
-# config file, i.e. a series of assignments. You only have to provide 
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    = 
-
-# Set optional variables used in the generation of an rtf document. 
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to 
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
-# then it will generate one additional man file for each entity 
-# documented in the real man page(s). These additional files 
-# only source the real man page, but without them the man command 
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will 
-# generate an XML file that captures the structure of 
-# the code including all documentation.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_SCHEMA             = 
-
-# The XML_DTD tag can be used to specify an XML DTD, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_DTD                = 
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
-# dump the program listings (including syntax highlighting 
-# and cross-referencing information) to the XML output. Note that 
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
-# generate an AutoGen Definitions (see autogen.sf.net) file 
-# that captures the structure of the code including all 
-# documentation. Note that this feature is still experimental 
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
-# generate a Perl module file that captures the structure of 
-# the code including all documentation. Note that this 
-# feature is still experimental and incomplete at the 
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
-# nicely formatted so it can be parsed by a human reader.  This is useful 
-# if you want to understand what is going on.  On the other hand, if this 
-# tag is set to NO the size of the Perl module output will be much smaller 
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file 
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
-# This is useful so different doxyrules.make files included by the same 
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX = 
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
-# evaluate all C-preprocessor directives found in the sources and include 
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
-# names in the source code. If set to NO (the default) only conditional 
-# compilation will be performed. Macro expansion can be done in a controlled 
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
-# then the macro expansion is limited to the macros specified with the 
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that 
-# contain include files that are not input files but should be processed by 
-# the preprocessor.
-
-INCLUDE_PATH           = 
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
-# patterns (like *.h and *.hpp) to filter out the header-files in the 
-# directories. If left blank, the patterns specified with FILE_PATTERNS will 
-# be used.
-
-INCLUDE_FILE_PATTERNS  = 
-
-# The PREDEFINED tag can be used to specify one or more macro names that 
-# are defined before the preprocessor is started (similar to the -D option of 
-# gcc). The argument of the tag is a list of macros of the form: name 
-# or name=definition (no spaces). If the definition and the = are 
-# omitted =1 is assumed. To prevent a macro definition from being 
-# undefined via #undef or recursively expanded use the := operator 
-# instead of the = operator.
-
-PREDEFINED             = 
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
-# this tag can be used to specify a list of macro names that should be expanded. 
-# The macro definition that is found in the sources will be used. 
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED      = 
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
-# doxygen's preprocessor will remove all function-like macros that are alone 
-# on a line, have an all uppercase name, and do not end with a semicolon. Such 
-# function macros are typically used for boiler-plate code, and will confuse 
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles. 
-# Optionally an initial location of the external documentation 
-# can be added for each tagfile. The format of a tag file without 
-# this location is as follows: 
-#   TAGFILES = file1 file2 ... 
-# Adding location for the tag files is done as follows: 
-#   TAGFILES = file1=loc1 "file2 = loc2" ... 
-# where "loc1" and "loc2" can be relative or absolute paths or 
-# URLs. If a location is present for each tag, the installdox tool 
-# does not have to be run to correct the links. 
-# Note that each tag file must have a unique name 
-# (where the name does NOT include the path) 
-# If a tag file is not located in the directory in which doxygen 
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES               = 
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       = 
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
-# in the class index. If set to NO only the inherited external classes 
-# will be listed.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
-# in the modules index. If set to NO, only the current project's groups will 
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script 
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH              = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
-# or super classes. Setting the tag to NO turns the diagrams off. Note that 
-# this option is superseded by the HAVE_DOT option below. This is only a 
-# fallback. It is recommended to install and use dot, since it yields more 
-# powerful graphs.
-
-CLASS_DIAGRAMS         = NO
-
-# You can define message sequence charts within doxygen comments using the \msc 
-# command. Doxygen will then run the mscgen tool (see 
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
-# the mscgen tool resides. If left empty the tool is assumed to be found in the 
-# default search path.
-
-MSCGEN_PATH            = 
-
-# If set to YES, the inheritance and collaboration graphs will hide 
-# inheritance and usage relations if the target is undocumented 
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS   = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
-# available from the path. This tool is part of Graphviz, a graph visualization 
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT               = YES
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is 
-# allowed to run in parallel. When set to 0 (the default) doxygen will 
-# base this on the number of processors available in the system. You can set it 
-# explicitly to a value larger than 0 to get control over the balance 
-# between CPU load and processing speed.
-
-DOT_NUM_THREADS        = 0
-
-# By default doxygen will write a font called FreeSans.ttf to the output 
-# directory and reference it in all dot files that doxygen generates. This 
-# font does not include all possible unicode characters however, so when you need 
-# these (or just want a differently looking font) you can specify the font name 
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font, 
-# which can be done by putting it in a standard location or by setting the 
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 
-# containing the font.
-
-DOT_FONTNAME           = FreeSans.ttf
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
-# The default size is 10pt.
-
-DOT_FONTSIZE           = 10
-
-# By default doxygen will tell dot to use the output directory to look for the 
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a 
-# different font using DOT_FONTNAME you can set the path where dot 
-# can find it using this tag.
-
-DOT_FONTPATH           = 
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect inheritance relations. Setting this tag to YES will force the 
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect implementation dependencies (inheritance, containment, and 
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
-# collaboration diagrams in a style similar to the OMG's Unified Modeling 
-# Language.
-
-UML_LOOK               = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the 
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS     = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
-# tags are set to YES then doxygen will generate a graph for each documented 
-# file showing the direct and indirect include dependencies of the file with 
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
-# documented header file showing the documented files that directly or 
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
-# doxygen will generate a call dependency graph for every global function 
-# or class method. Note that enabling this option will significantly increase 
-# the time of a run. So in most cases it will be better to enable call graphs 
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH             = YES
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
-# doxygen will generate a caller dependency graph for every global function 
-# or class method. Note that enabling this option will significantly increase 
-# the time of a run. So in most cases it will be better to enable caller 
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH           = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
-# then doxygen will show the dependencies a directory has on other directories 
-# in a graphical way. The dependency relations are determined by the #include 
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
-# generated by dot. Possible values are png, jpg, or gif 
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT       = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be 
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH               = 
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that 
-# contain dot files that are included in the documentation (see the 
-# \dotfile command).
-
-DOTFILE_DIRS           = 
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
-# nodes that will be shown in the graph. If the number of nodes in a graph 
-# becomes larger than this value, doxygen will truncate the graph, which is 
-# visualized by representing a node as a red box. Note that doxygen if the 
-# number of direct children of the root node in a graph is already larger than 
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES    = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
-# graphs generated by dot. A depth value of 3 means that only nodes reachable 
-# from the root by following a path via at most 3 edges will be shown. Nodes 
-# that lay further from the root node will be omitted. Note that setting this 
-# option to 1 or 2 may greatly reduce the computation time needed for large 
-# code bases. Also note that the size of a graph can be further restricted by 
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
-# background. This is disabled by default, because dot on Windows does not 
-# seem to support this out of the box. Warning: Depending on the platform used, 
-# enabling this option may lead to badly anti-aliased labels on the edges of 
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT        = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
-# files in one run (i.e. multiple -o and -T options on the command line). This 
-# makes dot run faster, but since only newer versions of dot (>1.8.10) 
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
-# generate a legend page explaining the meaning of the various boxes and 
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
-# remove the intermediate dot files that are used to generate 
-# the various graphs.
-
-DOT_CLEANUP            = YES
--- a/gui/README	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-Octave GUI is a graphical user interface for Octave with readline support.
-
-If you have any problems, suggestions or ideas, feel free to drop me a mail at
-jacob.dawid@googlemail.com or visit the official channel #octave on FreeNode.
-
-- Jacob Dawid
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/all.pro	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,20 @@
+# OctaveGUI - A graphical user interface for Octave
+# Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+TEMPLATE = subdirs
+
+SUBDIRS += octave-gui\
+	qtermwidget
--- a/gui/compile.sh	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-# Octave GUI - A graphical user interface for Octave
-# Copyright (C) 2011 Jacob Dawid
-# jacob.dawid@googlemail.com
-#
-# 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 3 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, see <http://www.gnu.org/licenses/>.
-
-qmake-qt4 && make -j 16
--- a/gui/default-settings/.octave-gui	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-[General]
-connectOnStartup=true
-showMessageOfTheDay=false
-showTopic=true
-autoIdentification=false
-nickServPassword=
-useCustomFileEditor=false
-customFileEditor=emacs
-showFilenames=true
-showFileSize=true
-showFileType=false
-showLastModified=false
-showHiddenFiles=false
-useAlternatingRowColors=true
-IRCNick=User1
-language=en-en
-
-[MainWindow]
-geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\0\x18\0\0\x4\xff\0\0\x3\a\0\0\0\0\0\0\0,\0\0\x5v\0\0\x3\x1c\0\0\0\0\x2\0)"
-windowState="@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x2\0\0\0\0\0\0\x1;\0\0\x2\xa3\xfc\x2\0\0\0\x2\xfb\0\0\0&\0V\0\x61\0r\0i\0\x61\0\x62\0l\0\x65\0s\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\0\x19\0\0\x1\xe\0\0\0k\0\xff\xff\xff\xfb\0\0\0\"\0H\0i\0s\0t\0o\0r\0y\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\x1-\0\0\x1\x8f\0\0\0\x8c\0\xff\xff\xff\0\0\0\x1\0\0\x1,\0\0\x2\xa3\xfc\x2\0\0\0\x1\xfb\0\0\0\x1e\0\x46\0i\0l\0\x65\0s\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\0\x19\0\0\x2\xa3\0\0\0\x9d\0\xff\xff\xff\0\0\x2\x8d\0\0\x2\xa3\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0)"
-
-[MdiArea]
-geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\x1\x41\0\0\0\x19\0\0\x3\xcd\0\0\x2\xbb\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0)
--- a/gui/kb-layouts/default.keytab	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-# [README.default.Keytab] Buildin Keyboard Table
-#
-# To customize your keyboard, copy this file to something
-# ending with .keytab and change it to meet you needs.
-# Please read the README.KeyTab and the README.keyboard
-# in this case.
-#
-# --------------------------------------------------------------
-
-keyboard "Default (XFree 4)"
-
-# --------------------------------------------------------------
-#
-# Note that this particular table is a "risc" version made to
-# ease customization without bothering with obsolete details.
-# See VT100.keytab for the more hairy stuff.
-#
-# --------------------------------------------------------------
-
-# common keys
-
-key Escape             : "\E"
-
-key Tab   -Shift       : "\t"
-key Tab   +Shift+Ansi  : "\E[Z"
-key Tab   +Shift-Ansi  : "\t"
-key Backtab     +Ansi  : "\E[Z"
-key Backtab     -Ansi  : "\t"
-
-key Return-Shift-NewLine : "\r"
-key Return-Shift+NewLine : "\r\n"
-
-key Return+Shift         : "\EOM"
-
-# Backspace and Delete codes are preserving CTRL-H.
-
-key Backspace      : "\x7f"
-
-# Arrow keys in VT52 mode
-# shift up/down are reserved for scrolling.
-# shift left/right are reserved for switching between tabs (this is hardcoded).
-
-key Up   -Shift-Ansi : "\EA"
-key Down -Shift-Ansi : "\EB"
-key Right-Shift-Ansi : "\EC"
-key Left -Shift-Ansi : "\ED"
-
-# Arrow keys in ANSI mode with Application - and Normal Cursor Mode)
-
-key Up    -Shift-AnyMod+Ansi+AppCuKeys           : "\EOA"
-key Down  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOB"
-key Right -Shift-AnyMod+Ansi+AppCuKeys           : "\EOC"
-key Left  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOD"
-
-key Up    -Shift-AnyMod+Ansi-AppCuKeys           : "\E[A"
-key Down  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[B"
-key Right -Shift-AnyMod+Ansi-AppCuKeys           : "\E[C"
-key Left  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[D"
-
-key Up    -Shift+AnyMod+Ansi                     : "\E[1;*A"
-key Down  -Shift+AnyMod+Ansi                     : "\E[1;*B"
-key Right -Shift+AnyMod+Ansi                     : "\E[1;*C"
-key Left  -Shift+AnyMod+Ansi                     : "\E[1;*D"
-
-# other grey PC keys
-
-key Enter+NewLine : "\r\n"
-key Enter-NewLine : "\r"
-
-key Home        -AnyMod     -AppCuKeys           : "\E[H"  
-key End         -AnyMod     -AppCuKeys           : "\E[F"  
-key Home        -AnyMod     +AppCuKeys           : "\EOH"  
-key End         -AnyMod     +AppCuKeys           : "\EOF"  
-key Home        +AnyMod                          : "\E[1;*H"
-key End         +AnyMod                          : "\E[1;*F"
-
-key Insert      -AnyMod                          : "\E[2~"
-key Delete      -AnyMod                          : "\E[3~"
-key Insert      +AnyMod                          : "\E[2;*~"
-key Delete      +AnyMod                          : "\E[3;*~"
-
-key Prior -Shift-AnyMod                          : "\E[5~"
-key Next  -Shift-AnyMod                          : "\E[6~"
-key Prior -Shift+AnyMod                          : "\E[5;*~"
-key Next  -Shift+AnyMod                          : "\E[6;*~"
-
-# Function keys
-key F1          -AnyMod                          : "\EOP"
-key F2          -AnyMod                          : "\EOQ"
-key F3          -AnyMod                          : "\EOR"
-key F4          -AnyMod                          : "\EOS"
-key F5          -AnyMod                          : "\E[15~"
-key F6          -AnyMod                          : "\E[17~"
-key F7          -AnyMod                          : "\E[18~"
-key F8          -AnyMod                          : "\E[19~"
-key F9          -AnyMod                          : "\E[20~"
-key F10         -AnyMod                          : "\E[21~"
-key F11         -AnyMod                          : "\E[23~"
-key F12         -AnyMod                          : "\E[24~"
-
-key F1          +AnyMod                          : "\EO*P"
-key F2          +AnyMod                          : "\EO*Q"
-key F3          +AnyMod                          : "\EO*R"
-key F4          +AnyMod                          : "\EO*S"
-key F5          +AnyMod                          : "\E[15;*~"
-key F6          +AnyMod                          : "\E[17;*~"
-key F7          +AnyMod                          : "\E[18;*~"
-key F8          +AnyMod                          : "\E[19;*~"
-key F9          +AnyMod                          : "\E[20;*~"
-key F10         +AnyMod                          : "\E[21;*~"
-key F11         +AnyMod                          : "\E[23;*~"
-key F12         +AnyMod                          : "\E[24;*~"
-
-# Work around dead keys
-
-key Space +Control : "\x00"
-
-# Some keys are used by konsole to cause operations.
-# The scroll* operations refer to the history buffer.
-
-key Up    +Shift-AppScreen  : scrollLineUp
-key Prior +Shift-AppScreen  : scrollPageUp
-key Down  +Shift-AppScreen  : scrollLineDown
-key Next  +Shift-AppScreen  : scrollPageDown
-
-#key Up    +Shift  : scrollLineUp
-#key Prior +Shift  : scrollPageUp
-#key Down  +Shift  : scrollLineDown
-#key Next  +Shift  : scrollPageDown
-
-key ScrollLock     : scrollLock
-
-# keypad characters are not offered differently by Qt.
--- a/gui/kb-layouts/linux.keytab	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-# [linux.keytab] Konsole Keyboard Table (Linux console keys)
-#
-# --------------------------------------------------------------
-
-# NOT TESTED, MAY NEED SOME CLEANUPS
-keyboard "Linux console"
-
-# --------------------------------------------------------------
-#
-# This configuration table allows to customize the
-# meaning of the keys.
-#
-# The syntax is that each entry has the form : 
-#
-#   "key" Keyname { ("+"|"-") Modename } ":" (String|Operation)
-#
-# Keynames are those defined in <qnamespace.h> with the
-# "Qt::Key_" removed. (We'd better insert the list here)
-#
-# Mode names are : 
-#
-# - Shift
-# - Alt
-# - Control
-#
-#   The VT100 emulation has two modes that can affect the
-#   sequences emitted by certain keys. These modes are
-#   under control of the client program.
-#   
-# - Newline     : effects Return and Enter key.
-# - Application : effects Up and Down key.
-#
-# - Ansi        : effects Up and Down key (This is for VT52, really).
-#
-# Operations are
-#
-# - scrollUpLine
-# - scrollUpPage
-# - scrollDownLine
-# - scrollDownPage
-#
-# - emitSelection
-#
-# If the key is not found here, the text of the
-# key event as provided by QT is emitted, possibly
-# preceeded by ESC if the Alt key is pressed.
-#
-# --------------------------------------------------------------
-
-key Escape : "\E"
-key Tab    : "\t"
-
-# VT100 can add an extra \n after return.
-# The NewLine mode is set by an escape sequence.
-
-key Return-NewLine : "\r"  
-key Return+NewLine : "\r\n"
-
-# Some desperately try to save the ^H.
-
-key Backspace : "\x7f"
-key Delete    : "\E[3~"
-
-# These codes are for the VT52 mode of VT100
-# The Ansi mode (i.e. VT100 mode) is set by
-# an escape sequence
-
-key Up   -Shift-Ansi : "\EA"
-key Down -Shift-Ansi : "\EB"
-key Right-Shift-Ansi : "\EC"
-key Left -Shift-Ansi : "\ED"
-
-# VT100 emits a mode bit together
-# with the arrow keys.The AppCuKeys
-# mode is set by an escape sequence.
-
-key Up   -Shift+Ansi+AppCuKeys : "\EOA"
-key Down -Shift+Ansi+AppCuKeys : "\EOB"
-key Right-Shift+Ansi+AppCuKeys : "\EOC"
-key Left -Shift+Ansi+AppCuKeys : "\EOD"
-
-key Up   -Shift+Ansi-AppCuKeys : "\E[A"
-key Down -Shift+Ansi-AppCuKeys : "\E[B"
-key Right-Shift+Ansi-AppCuKeys : "\E[C"
-key Left -Shift+Ansi-AppCuKeys : "\E[D"
-
-# linux functions keys F1-F5 differ from xterm
-
-key F1 : "\E[[A" 
-key F2 : "\E[[B" 
-key F3 : "\E[[C" 
-key F4 : "\E[[D" 
-key F5 : "\E[[E" 
-
-key F6     : "\E[17~" 
-key F7     : "\E[18~" 
-key F8     : "\E[19~" 
-key F9     : "\E[20~" 
-key F10    : "\E[21~" 
-key F11    : "\E[23~" 
-key F12    : "\E[24~" 
-
-key Home   : "\E[1~"  
-key End    : "\E[4~"  
-
-key Prior -Shift : "\E[5~"  
-key Next  -Shift : "\E[6~"  
-key Insert-Shift : "\E[2~"  
-
-# Keypad-Enter. See comment on Return above.
-
-key Enter+NewLine : "\r\n"
-key Enter-NewLine : "\r"  
-
-key Space +Control : "\x00"
-
-# some of keys are used by konsole.
-
-key Up    +Shift   : scrollLineUp
-key Prior +Shift   : scrollPageUp
-key Down  +Shift   : scrollLineDown
-key Next  +Shift   : scrollPageDown
-
-key ScrollLock     : scrollLock
-
-#----------------------------------------------------------
-
-# keypad characters as offered by Qt
-# cannot be recognized as such.
-
-#----------------------------------------------------------
-
-# Following other strings as emitted by konsole.
--- a/gui/kb-layouts/vt420pc.keytab	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-# [vt420pc.keytab] Konsole Keyboard Table (VT420pc keys)
-# adapted by ferdinand gassauer f.gassauer@aon.at
-# Nov 2000
-#
-################################################################
-#
-# The escape sequences emmited by the 
-# keys Shift+F1 to Shift+F12 might not fit your needs
-#
-################# IMPORTANT NOTICE #############################
-# the key bindings (Kcontrol -> look and feel -> keybindgs) 
-# overrule the settings in this file. The key bindings might be 
-# changed by the user WITHOUT notification of the maintainer of
-# the keytab file. Konsole will not work as expected by 
-# the maintainer of the keytab file.
-################################################################
-#
-# --------------------------------------------------------------
-
-keyboard "DEC VT420 Terminal"
-
-# --------------------------------------------------------------
-#
-# This configuration table allows to customize the
-# meaning of the keys.
-#
-# The syntax is that each entry has the form : 
-#
-#   "key" Keyname { ("+"|"-") Modename } ":" (String|Operation)
-#
-# Keynames are those defined in <qnamespace.h> with the
-# "Qt::Key_" removed. (We'd better insert the list here)
-#
-# Mode names are : 
-#
-# - Shift
-# - Alt
-# - Control
-#
-#   The VT100 emulation has two modes that can affect the
-#   sequences emitted by certain keys. These modes are
-#   under control of the client program.
-#   
-# - Newline     : effects Return and Enter key.
-# - Application : effects Up and Down key.
-#
-# - Ansi        : effects Up and Down key (This is for VT52, really).
-#
-# Operations are
-#
-# - scrollUpLine
-# - scrollUpPage
-# - scrollDownLine
-# - scrollDownPage
-#
-# - emitSelection
-#
-# If the key is not found here, the text of the
-# key event as provided by QT is emitted, possibly
-# preceeded by ESC if the Alt key is pressed.
-#
-# --------------------------------------------------------------
-
-key Escape : "\E"
-key Tab    : "\t"
-key Backtab: "\E[Z"
-
-# VT100 can add an extra \n after return.
-# The NewLine mode is set by an escape sequence.
-
-key Return-NewLine : "\r"  
-key Return+NewLine : "\r\n"
-
-# Some desperately try to save the ^H.
-# may be not everyone wants this
-
-key Backspace : "\x08"  # Control H
-key Delete    : "\x7f"
-
-# These codes are for the VT420pc
-# The Ansi mode (i.e. VT100 mode) is set by
-# an escape sequence
-
-key Up   -Shift-Ansi : "\EA"
-key Down -Shift-Ansi : "\EB"
-key Right-Shift-Ansi : "\EC"
-key Left -Shift-Ansi : "\ED"
-
-# VT100 emits a mode bit together
-# with the arrow keys.The AppCuKeys
-# mode is set by an escape sequence.
-
-key Up   -Shift+Ansi+AppCuKeys : "\EOA"
-key Down -Shift+Ansi+AppCuKeys : "\EOB"
-key Right-Shift+Ansi+AppCuKeys : "\EOC"
-key Left -Shift+Ansi+AppCuKeys : "\EOD"
-
-key Up   -Shift+Ansi-AppCuKeys : "\E[A"
-key Down -Shift+Ansi-AppCuKeys : "\E[B"
-key Right-Shift+Ansi-AppCuKeys : "\E[C"
-key Left -Shift+Ansi-AppCuKeys : "\E[D"
-
-# function keys 
-
-key F1 -Shift    : "\E[11~"  
-key F2 -Shift    : "\E[12~"
-key F3 -Shift    : "\E[13~"
-key F4 -Shift    : "\E[14~"
-key F5 -Shift    : "\E[15~"
-key F6 -Shift    : "\E[17~"
-key F7 -Shift    : "\E[18~"
-key F8 -Shift    : "\E[19~"
-key F9 -Shift    : "\E[20~"
-key F10-Shift    : "\E[21~"
-key F11-Shift    : "\E[23~"
-key F12-Shift    : "\E[24~"  
-#
-# Shift F1-F12
-#
-key F1 +Shift    : "\E[11;2~"
-key F2 +Shift    : "\E[12;2~"
-key F3 +Shift    : "\E[13;2~"
-key F4 +Shift    : "\E[14;2~"
-key F5 +Shift    : "\E[15;2~"
-key F6 +Shift    : "\E[17;2~" 
-key F7 +Shift    : "\E[18;2~" 
-key F8 +Shift    : "\E[19;2~" 
-key F9 +Shift    : "\E[20;2~" 
-key F10+Shift    : "\E[21;2~" 
-key F11+Shift    : "\E[23;2~" 
-key F12+Shift    : "\E[24;2~" 
-
-key Home   : "\E[H"  
-key End    : "\E[F"  
-
-key Prior -Shift : "\E[5~"  
-key Next  -Shift : "\E[6~"  
-key Insert-Shift : "\E[2~"  
-
-# Keypad-Enter. See comment on Return above.
-
-key Enter+NewLine : "\r\n"
-key Enter-NewLine : "\r"  
-
-key Space +Control : "\x00"
-
-# some of keys are used by konsole.
-
-key Up    +Shift   : scrollLineUp
-key Prior +Shift   : scrollPageUp
-key Down  +Shift   : scrollLineDown
-key Next  +Shift   : scrollPageDown
-
-key ScrollLock     : scrollLock
-
-#----------------------------------------------------------
-
-# keypad characters as offered by Qt
-# cannot be recognized as such.
-
-#----------------------------------------------------------
-
-# Following other strings as emitted by konsole.
Binary file gui/languages/de-de.qm has changed
--- a/gui/languages/de-de.ts	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,642 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="de_DE">
-<context>
-    <name>FileEditorMdiSubWindow</name>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
-        <source>File Editor</source>
-        <translation>Dateieditor</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
-        <source>Cannot read file %1:
-%2.</source>
-        <translation>Konnte Datei %1 nicht lesen:
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
-        <source>File loaded.</source>
-        <translation>Datei geladen.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
-        <source>Do you want to save the current file
-%1 ?</source>
-        <translation>Möchten Sie die Datei %1 sichern ?</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
-        <source>Cannot write file %1:
-%2.</source>
-        <translation>Konnte Datei %1 nicht schreiben:
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
-        <source>File %1 saved</source>
-        <translation>Datei %1 gesichert</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
-        <source>&amp;Close File</source>
-        <translation>&amp;Datei schließen</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
-        <source>&amp;New File</source>
-        <translation>&amp;Neue Datei</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
-        <source>&amp;Open File</source>
-        <translation>&amp;Öffne Datei</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
-        <source>&amp;Save File</source>
-        <translation>&amp;Sichere Datei</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
-        <source>Save File &amp;As</source>
-        <translation>Sichere Datei &amp;als</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
-        <source>&amp;Undo</source>
-        <translation>&amp;RĂŒckgĂ€ngig</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
-        <source>&amp;Redo</source>
-        <translation>&amp;Wiederholen</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
-        <source>&amp;Copy</source>
-        <translation>&amp;Kopieren</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
-        <source>Cu&amp;t</source>
-        <translation>&amp;Ausschneiden</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
-        <source>&amp;Paste</source>
-        <translation>&amp;EinfĂŒgen</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
-        <source>&amp;Next Bookmark</source>
-        <translation>&amp;NĂ€chstes Bookmark</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
-        <source>Pre&amp;vious Bookmark</source>
-        <translation>&amp;Voriges Bookmark</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
-        <source>Toggle &amp;Bookmark</source>
-        <translation>&amp;Bookmark setzen</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
-        <source>&amp;Run File</source>
-        <translation>&amp;AusfĂŒhren</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
-        <source>&amp;File</source>
-        <translation>&amp;Datei</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
-        <source>&amp;Edit</source>
-        <translation>&amp;Editieren</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
-        <source>&amp;Run</source>
-        <translation>&amp;AusfĂŒhren</translation>
-    </message>
-</context>
-<context>
-    <name>FilesDockWidget</name>
-    <message>
-        <source>Current Folder</source>
-        <translation type="obsolete">Aktuelles Verzeichnis</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="32"/>
-        <source>Current Directory</source>
-        <translation>Aktuelles Verzeichnis</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="46"/>
-        <source>Move up one directory.</source>
-        <translation>Ein Verzeichnis höher wechseln.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="49"/>
-        <source>Enter the path or filename.</source>
-        <translation>Geben Sie einen Pfad oder Dateinamen ein.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="78"/>
-        <source>Doubleclick a file to open it.</source>
-        <translation>FĂŒhren Sie einen Doppelklick aus, um eine Datei zu öffnen.</translation>
-    </message>
-</context>
-<context>
-    <name>HistoryDockWidget</name>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
-        <source>Doubleclick a command to transfer it to the terminal.</source>
-        <translation>FĂŒhren Sie einen Doppelklick aus, um den Befehl in das Terminal zu ĂŒbertragen.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
-        <source>Enter text to filter the command history.</source>
-        <translation>Geben Sie Text ein, um die Befehlshistorie zu filtern.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
-        <source>Command History</source>
-        <translation>Befehlshistorie</translation>
-    </message>
-    <message>
-        <source>History updated.</source>
-        <translation type="obsolete">Befehlshistorie aktualisiert.</translation>
-    </message>
-</context>
-<context>
-    <name>LexerOctaveGui</name>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
-        <source>Default</source>
-        <translation>Standard</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
-        <source>Comment</source>
-        <translation>Kommentar</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
-        <source>Command</source>
-        <translation>Befehl</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
-        <source>Number</source>
-        <translation>Zahl</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
-        <source>Keyword</source>
-        <translation>SchlĂŒsselwort</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
-        <source>Single-quoted string</source>
-        <translation>Zeichenkette in einfachen Hochkommata</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
-        <source>Operator</source>
-        <translation>Operator</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
-        <source>Identifier</source>
-        <translation>Bezeichner</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
-        <source>Double-quoted string</source>
-        <translation>Zeichenkette in doppelten Hochkommata</translation>
-    </message>
-</context>
-<context>
-    <name>MainWindow</name>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="47"/>
-        <source>Opening file.</source>
-        <translation>Öffne Datei.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="124"/>
-        <source>Save Workspace</source>
-        <translation>Speichere Arbeitsumgebung</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="134"/>
-        <source>Load Workspace</source>
-        <translation>Lade Arbeitsumgebung</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="226"/>
-        <location filename="../src/MainWindow.cpp" line="362"/>
-        <source>About Octave</source>
-        <translation>Über Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="238"/>
-        <source>Saving data and shutting down.</source>
-        <translation>Speichere Daten und schließe.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="276"/>
-        <source>View the variables in the active workspace.</source>
-        <translation>Sehen Sie die Variablen ein, die sich in der aktiven Arbeitsumgebung befinden.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="278"/>
-        <source>Browse and search the command history.</source>
-        <translation>Durchsuchen Sie die Befehlshistorie.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="280"/>
-        <source>Browse your files.</source>
-        <translation>Durchsuchen Sie Ihre Dateien.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="294"/>
-        <source>Terminal</source>
-        <translation>Terminal</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="298"/>
-        <source>Enter your commands into the Octave terminal.</source>
-        <translation>Geben Sie Ihre Befehle in das Octave Terminal ein.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="311"/>
-        <source>Browse the Octave documentation for help.</source>
-        <translation>Durchsuchen Sie die Octave Dokumentation, um Hilfe zu erhalten.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="320"/>
-        <source>Chat</source>
-        <translation>Chat</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="323"/>
-        <source>Instantly chat with other Octave users for help.</source>
-        <translation>Tauschen Sie sich direkt mit anderen Octave Benutzern aus, um Hilfe zu erhalten.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="330"/>
-        <source>Octave</source>
-        <translation>Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="331"/>
-        <source>Settings</source>
-        <translation>Einstellungen</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="333"/>
-        <source>Exit</source>
-        <translation>Beenden</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="335"/>
-        <source>Interface</source>
-        <translation>OberflÀche</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="337"/>
-        <source>Align Windows</source>
-        <translation>Fenster ausrichten</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="339"/>
-        <location filename="../src/MainWindow.cpp" line="351"/>
-        <source>Workspace</source>
-        <translation>Arbeitsumgebung</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="342"/>
-        <source>History</source>
-        <translation>Befehlshistorie</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="345"/>
-        <source>File Browser</source>
-        <translation>Dateibrowser</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="349"/>
-        <source>Open New Editor Window</source>
-        <translation>Neues Editorfenster öffnen</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="352"/>
-        <source>Load</source>
-        <translation>Laden</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="353"/>
-        <source>Save</source>
-        <translation>Sichern</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="355"/>
-        <source>Clear</source>
-        <translation>Löschen</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="357"/>
-        <source>Community</source>
-        <translation>Gemeinschaft</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="358"/>
-        <source>Report Bug</source>
-        <translation>Fehler melden</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="359"/>
-        <source>Agora</source>
-        <translation>Agora</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="360"/>
-        <source>Octave Forge</source>
-        <translation>Octave Forge</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="363"/>
-        <source>About Qt</source>
-        <translation>Über Qt</translation>
-    </message>
-    <message>
-        <source>Octave Toolbar</source>
-        <translation type="obsolete">Octave Werkzeugleiste</translation>
-    </message>
-    <message>
-        <source>Command Window</source>
-        <translation type="obsolete">Konsolenfenster</translation>
-    </message>
-    <message>
-        <source>File Editor</source>
-        <translation type="obsolete">Dateieditor</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="307"/>
-        <source>Documentation</source>
-        <translation>Dokumentation</translation>
-    </message>
-    <message>
-        <source>Service</source>
-        <translation type="obsolete">Service</translation>
-    </message>
-    <message>
-        <source>Established link to Octave.</source>
-        <translation type="obsolete">Verbindung zu Octave hergestellt.</translation>
-    </message>
-</context>
-<context>
-    <name>NumberBar</name>
-    <message>
-        <source>Stop Here</source>
-        <translation type="obsolete">Stoppe hier</translation>
-    </message>
-    <message>
-        <source>Current Line</source>
-        <translation type="obsolete">Aktuelle Zeile</translation>
-    </message>
-    <message>
-        <source>Error Line</source>
-        <translation type="obsolete">Fehlerzeile</translation>
-    </message>
-</context>
-<context>
-    <name>NumberedCodeEdit</name>
-    <message>
-        <source>This file name is not valid.</source>
-        <translation type="obsolete">Dieser Dateiname ist nicht gĂŒltig.</translation>
-    </message>
-    <message>
-        <source>Octave doesn&apos;t understand this file name:
-</source>
-        <translation type="obsolete">Octave versteht diesen Dateityp nicht:</translation>
-    </message>
-    <message>
-        <source>
-Please, change it.
- Do you want to save your changes?</source>
-        <translation type="obsolete">Bitte Ă€ndern Sie dies. Möchten Sie Ihre Änderungen sichern?</translation>
-    </message>
-</context>
-<context>
-    <name>SettingsDialog</name>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="29"/>
-        <source>Settings</source>
-        <translation>Einstellungen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="39"/>
-        <source>Chat</source>
-        <translation>Char</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="47"/>
-        <source>Connect to #octave on startup</source>
-        <translation>Beim Start mit #octave verbinden</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="57"/>
-        <source>Show message of the day</source>
-        <translation>Nachricht des Tages anzeigen (MOTD)</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="64"/>
-        <source>Show topic</source>
-        <translation>Thema des Chatkanals anzeigen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="71"/>
-        <source>Automatically identify on NickServ</source>
-        <translation>Automatisch bei NickServ identifizieren</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="78"/>
-        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
-        <translation>Warnung: Ihre Passwort wird unter ~/.octave-gui in einem menschenlesbaren Format gesichert. Hinterlegen Sie nicht Ihr Password, wenn Sie Bedenken ĂŒber die Sicherheit haben.</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="103"/>
-        <location filename="../src/SettingsDialog.ui" line="311"/>
-        <source>Password:</source>
-        <translation>Passwort:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="125"/>
-        <source>Editor</source>
-        <translation>Editor</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="133"/>
-        <source>Use custom file editor:</source>
-        <translation>Benutzerdefinierten Editor verwenden:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="143"/>
-        <source>emacs</source>
-        <translation>emacs</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="166"/>
-        <source>File Browser</source>
-        <translation>Dateibrowser</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="172"/>
-        <source>Show filenames</source>
-        <translation>Dateinamen anzeigen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="179"/>
-        <source>Show file size</source>
-        <translation>DateigrĂ¶ĂŸe anzeigen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="186"/>
-        <source>Show file type</source>
-        <translation>Dateityp anzeigen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="193"/>
-        <source>Show date of last modification</source>
-        <translation>Datum der letzten Änderung anzeigen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="200"/>
-        <source>Show hidden files</source>
-        <translation>Versteckte Dateien anzeigen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="207"/>
-        <source>Alternating row colors</source>
-        <translation>Alternierende Farben verwenden</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="215"/>
-        <source>Network</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="221"/>
-        <source>Use proxy server</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="233"/>
-        <source>Proxy Type:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="244"/>
-        <source>HttpProxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="249"/>
-        <source>Socks5Proxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="260"/>
-        <source>Hostname:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="277"/>
-        <source>Port:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="294"/>
-        <source>Username:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="339"/>
-        <source>Reset to defaults</source>
-        <translation>Standardeinstellungen wiederherstellen</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="362"/>
-        <source>Export</source>
-        <translation>Exportieren</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="372"/>
-        <source>Import</source>
-        <translation>Importieren</translation>
-    </message>
-</context>
-<context>
-    <name>VariablesDockWidget</name>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Name</source>
-        <translation>Bezeichner</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Type</source>
-        <translation>Typ</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Value</source>
-        <translation>Wert</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
-        <source>Workspace</source>
-        <translation>Arbeitsumgebung</translation>
-    </message>
-    <message>
-        <source>Save</source>
-        <translation type="obsolete">Sichern</translation>
-    </message>
-    <message>
-        <source>Load</source>
-        <translation type="obsolete">Laden</translation>
-    </message>
-    <message>
-        <source>Clear</source>
-        <translation type="obsolete">Löschen</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
-        <source>Local</source>
-        <translation>Lokal</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
-        <source>Global</source>
-        <translation>Global</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
-        <source>Persistent</source>
-        <translation>Persistent</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
-        <source>Hidden</source>
-        <translation>Versteckt</translation>
-    </message>
-</context>
-</TS>
Binary file gui/languages/es-es.qm has changed
--- a/gui/languages/es-es.ts	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,576 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="es_MX">
-<context>
-    <name>FileEditorMdiSubWindow</name>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
-        <source>File Editor</source>
-        <translation>Editor de archivos</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
-        <source>Cannot read file %1:
-%2.</source>
-        <translation>No se puede leer archivo %1:
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
-        <source>File loaded.</source>
-        <translation>Archivo cargado.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
-        <source>Do you want to save the current file
-%1 ?</source>
-        <translation>ÂżDesea guardar archivo actual
-%1 ?</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
-        <source>Cannot write file %1:
-%2.</source>
-        <translation>No se puede escribir archivo %1:
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
-        <source>File %1 saved</source>
-        <translation>Archivo %1 guardado</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
-        <source>&amp;Close File</source>
-        <translation>&amp;Cerrar archivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
-        <source>&amp;New File</source>
-        <translation>Archivo &amp;nuevo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
-        <source>&amp;Open File</source>
-        <translation>&amp;Abrir archivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
-        <source>&amp;Save File</source>
-        <translation>&amp;Guardar archivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
-        <source>Save File &amp;As</source>
-        <translatorcomment>Search for proper shortcut for this command</translatorcomment>
-        <translation>Guardar archivo &amp;como</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
-        <source>&amp;Undo</source>
-        <translation>&amp;Deshacer</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
-        <source>&amp;Redo</source>
-        <translation>&amp;Rehacer</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
-        <source>&amp;Copy</source>
-        <translation>&amp;Copiar</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
-        <source>Cu&amp;t</source>
-        <translation>Cor&amp;tar</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
-        <source>&amp;Paste</source>
-        <translation>&amp;Pegar</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
-        <source>&amp;Next Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
-        <source>Pre&amp;vious Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
-        <source>Toggle &amp;Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
-        <source>&amp;Run File</source>
-        <translation>&amp;Ejecutar archivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
-        <source>&amp;File</source>
-        <translation>&amp;Archivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
-        <source>&amp;Edit</source>
-        <translation>&amp;Editar</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
-        <source>&amp;Run</source>
-        <translation>&amp;Ejecutar</translation>
-    </message>
-</context>
-<context>
-    <name>FilesDockWidget</name>
-    <message>
-        <source>Current Folder</source>
-        <translation type="obsolete">Carpeta actual</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="32"/>
-        <source>Current Directory</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="46"/>
-        <source>Move up one directory.</source>
-        <translation>Subir un directorio.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="49"/>
-        <source>Enter the path or filename.</source>
-        <translation>Introduzca direcciĂłn o nombre de archivo.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="78"/>
-        <source>Doubleclick a file to open it.</source>
-        <translation>Haga doble clic para abir archivo.</translation>
-    </message>
-</context>
-<context>
-    <name>HistoryDockWidget</name>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
-        <source>Doubleclick a command to transfer it to the terminal.</source>
-        <translation>Haga doble clic para transferir el comando a la terminal.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
-        <source>Enter text to filter the command history.</source>
-        <translation>Introduzca texto para filtrar el historial de comandos.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
-        <source>Command History</source>
-        <translation>Historial de comandos</translation>
-    </message>
-</context>
-<context>
-    <name>LexerOctaveGui</name>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
-        <source>Default</source>
-        <translation>Valores predeterminados</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
-        <source>Comment</source>
-        <translation>Comentario</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
-        <source>Command</source>
-        <translation>Comando</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
-        <source>Number</source>
-        <translation>NĂșmero</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
-        <source>Keyword</source>
-        <translation>Contraseña</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
-        <source>Single-quoted string</source>
-        <translation>Cadena entre comillas simples</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
-        <source>Operator</source>
-        <translation>Operador</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
-        <source>Identifier</source>
-        <translation>Identificador</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
-        <source>Double-quoted string</source>
-        <translation>Cadena entre comillas dobles</translation>
-    </message>
-</context>
-<context>
-    <name>MainWindow</name>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="47"/>
-        <source>Opening file.</source>
-        <translation>Abriendo archivo.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="124"/>
-        <source>Save Workspace</source>
-        <translation>Guardar espacio de trabajo</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="134"/>
-        <source>Load Workspace</source>
-        <translation>Cargar espacio de trabajo</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="226"/>
-        <location filename="../src/MainWindow.cpp" line="362"/>
-        <source>About Octave</source>
-        <translation>Acerca de Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="238"/>
-        <source>Saving data and shutting down.</source>
-        <translation>Guardando datos y cerrando el sistema.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="276"/>
-        <source>View the variables in the active workspace.</source>
-        <translation>Ver variables en el espacio de trabajo activo.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="278"/>
-        <source>Browse and search the command history.</source>
-        <translation>Navegar y buscar en el historial de comandos.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="280"/>
-        <source>Browse your files.</source>
-        <translation>Explorar sus archivos.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="294"/>
-        <source>Terminal</source>
-        <translation>Terminal</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="298"/>
-        <source>Enter your commands into the Octave terminal.</source>
-        <translation>Introducir su comando a la terminal de Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="307"/>
-        <source>Documentation</source>
-        <translation>DocumentaciĂłn</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="311"/>
-        <source>Browse the Octave documentation for help.</source>
-        <translation>Consultar la documentaciĂłn de Octave para obtener ayuda.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="320"/>
-        <source>Chat</source>
-        <translation>Chat/conversaciĂłn instantanea</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="323"/>
-        <source>Instantly chat with other Octave users for help.</source>
-        <translation>CoversaciĂłn instantanea con otros usuarios de octave para obtener ayuda.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="330"/>
-        <source>Octave</source>
-        <translation>Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="331"/>
-        <source>Settings</source>
-        <translation>ConfiguraciĂłn</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="333"/>
-        <source>Exit</source>
-        <translation>Salir</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="335"/>
-        <source>Interface</source>
-        <translation>Interfase</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="337"/>
-        <source>Align Windows</source>
-        <translation>Alinear ventanas</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="339"/>
-        <location filename="../src/MainWindow.cpp" line="351"/>
-        <source>Workspace</source>
-        <translation>Espacio de trabajo</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="342"/>
-        <source>History</source>
-        <translation>Historial</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="345"/>
-        <source>File Browser</source>
-        <translation>Explorador de archivos</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="349"/>
-        <source>Open New Editor Window</source>
-        <translation>Abrir nueva ventana de editor</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="352"/>
-        <source>Load</source>
-        <translation>Cargar</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="353"/>
-        <source>Save</source>
-        <translation>Guardar</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="355"/>
-        <source>Clear</source>
-        <translation>Limpiar</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="357"/>
-        <source>Community</source>
-        <translation>Comunidad</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="358"/>
-        <source>Report Bug</source>
-        <translation>Reportar error de software/Bug</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="359"/>
-        <source>Agora</source>
-        <translation>Ágora</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="360"/>
-        <source>Octave Forge</source>
-        <translation>Octave Forge</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="363"/>
-        <source>About Qt</source>
-        <translation>Acerca de Qt</translation>
-    </message>
-</context>
-<context>
-    <name>SettingsDialog</name>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="29"/>
-        <source>Settings</source>
-        <translation>ConfiguraciĂłn</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="39"/>
-        <source>Chat</source>
-        <translation>Chat/conversaciĂłn instantanea</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="47"/>
-        <source>Connect to #octave on startup</source>
-        <translation>Conectar a #octave en el arranque</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="57"/>
-        <source>Show message of the day</source>
-        <translation>Mostrar mensaje del dĂ­a</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="64"/>
-        <source>Show topic</source>
-        <translation>Mostrar tema</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="71"/>
-        <source>Automatically identify on NickServ</source>
-        <translation>Identificar automĂĄticamente el NickServ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="78"/>
-        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
-        <translatorcomment>Advertencia: La contraseña se guarda en ~ / octavegui en formato legible. No introduzca su contraseña en caso de que le preocupen los aspectos de seguridad.</translatorcomment>
-        <translation></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="103"/>
-        <location filename="../src/SettingsDialog.ui" line="311"/>
-        <source>Password:</source>
-        <translation>Contraseña:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="125"/>
-        <source>Editor</source>
-        <translation>Editor</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="133"/>
-        <source>Use custom file editor:</source>
-        <translation>Usar editor de archivos personalizados:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="143"/>
-        <source>emacs</source>
-        <translation>emacs</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="166"/>
-        <source>File Browser</source>
-        <translation>Explorador de archivos</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="172"/>
-        <source>Show filenames</source>
-        <translation>Mostrar nombres de archivos</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="179"/>
-        <source>Show file size</source>
-        <translation>Mostrar tamaño de archivo</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="186"/>
-        <source>Show file type</source>
-        <translation>Mostrar tipo de archivo</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="193"/>
-        <source>Show date of last modification</source>
-        <translation>Mostrar fecha de la Ășltima modificaciĂłn</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="200"/>
-        <source>Show hidden files</source>
-        <translation>Mostrar archivos ocultos</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="207"/>
-        <source>Alternating row colors</source>
-        <translation>Colores alternos de filas</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="215"/>
-        <source>Network</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="221"/>
-        <source>Use proxy server</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="233"/>
-        <source>Proxy Type:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="244"/>
-        <source>HttpProxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="249"/>
-        <source>Socks5Proxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="260"/>
-        <source>Hostname:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="277"/>
-        <source>Port:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="294"/>
-        <source>Username:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="339"/>
-        <source>Reset to defaults</source>
-        <translation>Restaurar los valores predeterminados</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="362"/>
-        <source>Export</source>
-        <translation>Exportar</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="372"/>
-        <source>Import</source>
-        <translation>Importar</translation>
-    </message>
-</context>
-<context>
-    <name>VariablesDockWidget</name>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
-        <source>Workspace</source>
-        <translation>Espacio de trabajo</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Name</source>
-        <translation>Nombre</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Type</source>
-        <translation>Tipo</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Value</source>
-        <translation>Valor</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
-        <source>Local</source>
-        <translation>Local</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
-        <source>Global</source>
-        <translation>Global</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
-        <source>Persistent</source>
-        <translation>Persistente</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
-        <source>Hidden</source>
-        <translation>Oculto</translation>
-    </message>
-</context>
-</TS>
--- a/gui/languages/generic.qm	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-<ždÊÍ!ż`ĄœĘ
\ No newline at end of file
--- a/gui/languages/generic.ts	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,567 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0">
-<context>
-    <name>FileEditorMdiSubWindow</name>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
-        <source>File Editor</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
-        <source>Cannot read file %1:
-%2.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
-        <source>File loaded.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
-        <source>Do you want to save the current file
-%1 ?</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
-        <source>Cannot write file %1:
-%2.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
-        <source>File %1 saved</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
-        <source>&amp;Close File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
-        <source>&amp;New File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
-        <source>&amp;Open File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
-        <source>&amp;Save File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
-        <source>Save File &amp;As</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
-        <source>&amp;Undo</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
-        <source>&amp;Redo</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
-        <source>&amp;Copy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
-        <source>Cu&amp;t</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
-        <source>&amp;Paste</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
-        <source>&amp;Next Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
-        <source>Pre&amp;vious Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
-        <source>Toggle &amp;Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
-        <source>&amp;Run File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
-        <source>&amp;File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
-        <source>&amp;Edit</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
-        <source>&amp;Run</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>FilesDockWidget</name>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="32"/>
-        <source>Current Directory</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="46"/>
-        <source>Move up one directory.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="49"/>
-        <source>Enter the path or filename.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="78"/>
-        <source>Doubleclick a file to open it.</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>HistoryDockWidget</name>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
-        <source>Doubleclick a command to transfer it to the terminal.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
-        <source>Enter text to filter the command history.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
-        <source>Command History</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>LexerOctaveGui</name>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
-        <source>Default</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
-        <source>Comment</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
-        <source>Command</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
-        <source>Number</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
-        <source>Keyword</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
-        <source>Single-quoted string</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
-        <source>Operator</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
-        <source>Identifier</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
-        <source>Double-quoted string</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>MainWindow</name>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="47"/>
-        <source>Opening file.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="124"/>
-        <source>Save Workspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="134"/>
-        <source>Load Workspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="226"/>
-        <location filename="../src/MainWindow.cpp" line="362"/>
-        <source>About Octave</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="238"/>
-        <source>Saving data and shutting down.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="276"/>
-        <source>View the variables in the active workspace.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="278"/>
-        <source>Browse and search the command history.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="280"/>
-        <source>Browse your files.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="294"/>
-        <source>Terminal</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="298"/>
-        <source>Enter your commands into the Octave terminal.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="307"/>
-        <source>Documentation</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="311"/>
-        <source>Browse the Octave documentation for help.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="320"/>
-        <source>Chat</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="323"/>
-        <source>Instantly chat with other Octave users for help.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="330"/>
-        <source>Octave</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="331"/>
-        <source>Settings</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="333"/>
-        <source>Exit</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="335"/>
-        <source>Interface</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="337"/>
-        <source>Align Windows</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="339"/>
-        <location filename="../src/MainWindow.cpp" line="351"/>
-        <source>Workspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="342"/>
-        <source>History</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="345"/>
-        <source>File Browser</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="349"/>
-        <source>Open New Editor Window</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="352"/>
-        <source>Load</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="353"/>
-        <source>Save</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="355"/>
-        <source>Clear</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="357"/>
-        <source>Community</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="358"/>
-        <source>Report Bug</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="359"/>
-        <source>Agora</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="360"/>
-        <source>Octave Forge</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="363"/>
-        <source>About Qt</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>SettingsDialog</name>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="29"/>
-        <source>Settings</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="39"/>
-        <source>Chat</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="47"/>
-        <source>Connect to #octave on startup</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="57"/>
-        <source>Show message of the day</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="64"/>
-        <source>Show topic</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="71"/>
-        <source>Automatically identify on NickServ</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="78"/>
-        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="103"/>
-        <location filename="../src/SettingsDialog.ui" line="311"/>
-        <source>Password:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="125"/>
-        <source>Editor</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="133"/>
-        <source>Use custom file editor:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="143"/>
-        <source>emacs</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="166"/>
-        <source>File Browser</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="172"/>
-        <source>Show filenames</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="179"/>
-        <source>Show file size</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="186"/>
-        <source>Show file type</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="193"/>
-        <source>Show date of last modification</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="200"/>
-        <source>Show hidden files</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="207"/>
-        <source>Alternating row colors</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="215"/>
-        <source>Network</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="221"/>
-        <source>Use proxy server</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="233"/>
-        <source>Proxy Type:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="244"/>
-        <source>HttpProxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="249"/>
-        <source>Socks5Proxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="260"/>
-        <source>Hostname:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="277"/>
-        <source>Port:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="294"/>
-        <source>Username:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="339"/>
-        <source>Reset to defaults</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="362"/>
-        <source>Export</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="372"/>
-        <source>Import</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>VariablesDockWidget</name>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
-        <source>Workspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Name</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Type</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Value</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
-        <source>Local</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
-        <source>Global</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
-        <source>Persistent</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
-        <source>Hidden</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-</TS>
Binary file gui/languages/pt-br.qm has changed
--- a/gui/languages/pt-br.ts	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,571 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="pt_BR" sourcelanguage="en">
-<context>
-    <name>FileEditorMdiSubWindow</name>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
-        <source>File Editor</source>
-        <translation>Editor de Arquivos</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
-        <source>Cannot read file %1:
-%2.</source>
-        <translation>NĂŁo foi possĂ­vel ler o arquivo %1: %2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
-        <source>File loaded.</source>
-        <translation>Arquivo carregado.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
-        <source>Do you want to save the current file
-%1 ?</source>
-        <translation>VocĂȘ deseja salvar o arquivo atual %1 ?</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
-        <source>Cannot write file %1:
-%2.</source>
-        <translation>NĂŁo foi possĂ­vel escrever no arquivo %1: %2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
-        <source>File %1 saved</source>
-        <translation>Arquivo %1 salvo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
-        <source>&amp;Close File</source>
-        <translation>&amp;Fechar Arquivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
-        <source>&amp;New File</source>
-        <translation>&amp;Novo Arquivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
-        <source>&amp;Open File</source>
-        <translation>&amp;Abrir Arquivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
-        <source>&amp;Save File</source>
-        <translation>&amp;Salvar Arquivo</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
-        <source>Save File &amp;As</source>
-        <translation>Salvar Arquivo &amp;Como</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
-        <source>&amp;Undo</source>
-        <translation>&amp;Desfazer</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
-        <source>&amp;Redo</source>
-        <translation>&amp;Refazer</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
-        <source>&amp;Copy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
-        <source>Cu&amp;t</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
-        <source>&amp;Paste</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
-        <source>&amp;Next Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
-        <source>Pre&amp;vious Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
-        <source>Toggle &amp;Bookmark</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
-        <source>&amp;Run File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
-        <source>&amp;File</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
-        <source>&amp;Edit</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
-        <source>&amp;Run</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>FilesDockWidget</name>
-    <message>
-        <source>Current Folder</source>
-        <translation type="obsolete">DiretĂłrio Atual</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="32"/>
-        <source>Current Directory</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="46"/>
-        <source>Move up one directory.</source>
-        <translation>Subir um diretĂłrio.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="49"/>
-        <source>Enter the path or filename.</source>
-        <translation>Digite o caminho ou o nome do arquivo.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="78"/>
-        <source>Doubleclick a file to open it.</source>
-        <translation>Clique duas vezes num arquivo para abrĂ­-lo.</translation>
-    </message>
-</context>
-<context>
-    <name>HistoryDockWidget</name>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
-        <source>Doubleclick a command to transfer it to the terminal.</source>
-        <translation>Clique duas vezes num comando para transferĂ­-lo ao terminal.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
-        <source>Enter text to filter the command history.</source>
-        <translation>Digite um texto para filtrar o hitĂłrico de comandos.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
-        <source>Command History</source>
-        <translation>HistĂłrico de Comandos</translation>
-    </message>
-</context>
-<context>
-    <name>LexerOctaveGui</name>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
-        <source>Default</source>
-        <translation>PadrĂŁo</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
-        <source>Comment</source>
-        <translation>ComentĂĄrio</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
-        <source>Command</source>
-        <translation>Comando</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
-        <source>Number</source>
-        <translation>NĂșmero</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
-        <source>Keyword</source>
-        <translation>Palavra-Chave</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
-        <source>Single-quoted string</source>
-        <translation>String com aspas simples</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
-        <source>Operator</source>
-        <translation>Operador</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
-        <source>Identifier</source>
-        <translation>Identificador</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
-        <source>Double-quoted string</source>
-        <translation>String com aspas duplas</translation>
-    </message>
-</context>
-<context>
-    <name>MainWindow</name>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="47"/>
-        <source>Opening file.</source>
-        <translation>Abrindo arquivo.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="124"/>
-        <source>Save Workspace</source>
-        <translation>Salvar ambiente de trabalho</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="134"/>
-        <source>Load Workspace</source>
-        <translation>Carregar ambiente de trabalho</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="226"/>
-        <location filename="../src/MainWindow.cpp" line="362"/>
-        <source>About Octave</source>
-        <translation>Sobre o Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="238"/>
-        <source>Saving data and shutting down.</source>
-        <translation>Salvando dados e encerrando a sessĂŁo.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="276"/>
-        <source>View the variables in the active workspace.</source>
-        <translation>Visualizar variĂĄveis no ambiente de trabalho.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="278"/>
-        <source>Browse and search the command history.</source>
-        <translation>Pesquise no histĂłrico de comandos.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="280"/>
-        <source>Browse your files.</source>
-        <translation>Procure seus arquivos.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="294"/>
-        <source>Terminal</source>
-        <translation>Terminal</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="298"/>
-        <source>Enter your commands into the Octave terminal.</source>
-        <translation>Digite seus comandos no terminal do Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="307"/>
-        <source>Documentation</source>
-        <translation>Documentação</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="311"/>
-        <source>Browse the Octave documentation for help.</source>
-        <translation>Procure na documentação do Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="320"/>
-        <source>Chat</source>
-        <translation>Chat</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="323"/>
-        <source>Instantly chat with other Octave users for help.</source>
-        <translation>Converse instantaneamente com outros usuĂĄrios do Octave para pedir ajuda.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="330"/>
-        <source>Octave</source>
-        <translation>Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="331"/>
-        <source>Settings</source>
-        <translation>ConfiguraçÔes</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="333"/>
-        <source>Exit</source>
-        <translation>Sair</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="335"/>
-        <source>Interface</source>
-        <translation>Interface</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="337"/>
-        <source>Align Windows</source>
-        <translation>Alinhar Janelas</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="339"/>
-        <location filename="../src/MainWindow.cpp" line="351"/>
-        <source>Workspace</source>
-        <translation>Ambiente de trabalho</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="342"/>
-        <source>History</source>
-        <translation>HistĂłrico</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="345"/>
-        <source>File Browser</source>
-        <translation>Navegador de Arquivos</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="349"/>
-        <source>Open New Editor Window</source>
-        <translation>Abrir nova janela de edição</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="352"/>
-        <source>Load</source>
-        <translation>Carregar</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="353"/>
-        <source>Save</source>
-        <translation>Salvar</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="355"/>
-        <source>Clear</source>
-        <translation>Limpar</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="357"/>
-        <source>Community</source>
-        <translation>Comunidade</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="358"/>
-        <source>Report Bug</source>
-        <translation>Reportar Bug</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="359"/>
-        <source>Agora</source>
-        <translation>Agora</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="360"/>
-        <source>Octave Forge</source>
-        <translation>Octave Forge</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="363"/>
-        <source>About Qt</source>
-        <translation>Sobre o Qt</translation>
-    </message>
-</context>
-<context>
-    <name>SettingsDialog</name>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="29"/>
-        <source>Settings</source>
-        <translation>ConfiguraçÔes</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="39"/>
-        <source>Chat</source>
-        <translation>Chat</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="47"/>
-        <source>Connect to #octave on startup</source>
-        <translation>Conectar ao #octave ao iniciar</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="57"/>
-        <source>Show message of the day</source>
-        <translation>Mostrar mensagem do dia</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="64"/>
-        <source>Show topic</source>
-        <translation>Mostrar tĂłpico</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="71"/>
-        <source>Automatically identify on NickServ</source>
-        <translation>Identificar-se automaticamente com o NickServ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="78"/>
-        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
-        <translation>Aviso: Sua senha serĂĄ salva em ~/.octavegui em um formato legĂ­vel. NĂŁo digite sua senha se vocĂȘ tem problemas com segurança.</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="103"/>
-        <location filename="../src/SettingsDialog.ui" line="311"/>
-        <source>Password:</source>
-        <translation>Senha:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="125"/>
-        <source>Editor</source>
-        <translation>Editor</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="133"/>
-        <source>Use custom file editor:</source>
-        <translation>Usar editor de arquivos personalizado:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="143"/>
-        <source>emacs</source>
-        <translation>emacs</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="166"/>
-        <source>File Browser</source>
-        <translation>Navegador de Arquivos</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="172"/>
-        <source>Show filenames</source>
-        <translation>Mostrar nomes de arquivo</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="179"/>
-        <source>Show file size</source>
-        <translation>Mostrar tamanho do arquivo</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="186"/>
-        <source>Show file type</source>
-        <translation>Mostrar tipo do arquivo</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="193"/>
-        <source>Show date of last modification</source>
-        <translation>Mostrar data de Ășltima modificação</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="200"/>
-        <source>Show hidden files</source>
-        <translation>Mostrar arquivos ocultos</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="207"/>
-        <source>Alternating row colors</source>
-        <translation>Alternar cores das linhas</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="215"/>
-        <source>Network</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="221"/>
-        <source>Use proxy server</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="233"/>
-        <source>Proxy Type:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="244"/>
-        <source>HttpProxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="249"/>
-        <source>Socks5Proxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="260"/>
-        <source>Hostname:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="277"/>
-        <source>Port:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="294"/>
-        <source>Username:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="339"/>
-        <source>Reset to defaults</source>
-        <translation>Resetar ao padrĂŁo</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="362"/>
-        <source>Export</source>
-        <translation>Exportar</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="372"/>
-        <source>Import</source>
-        <translation>Importar</translation>
-    </message>
-</context>
-<context>
-    <name>VariablesDockWidget</name>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
-        <source>Workspace</source>
-        <translation>Ambiente de trabalho</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Name</source>
-        <translation>Nome</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Type</source>
-        <translation>Tipo</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Value</source>
-        <translation>Valor</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
-        <source>Local</source>
-        <translation>Local</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
-        <source>Global</source>
-        <translation>Global</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
-        <source>Persistent</source>
-        <translation>Persistente</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
-        <source>Hidden</source>
-        <translation>Oculto</translation>
-    </message>
-</context>
-</TS>
Binary file gui/languages/ru-ru.qm has changed
--- a/gui/languages/ru-ru.ts	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,574 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="ru_RU">
-<context>
-    <name>FileEditorMdiSubWindow</name>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
-        <source>File Editor</source>
-        <translation>РДЎаĐșŃ‚ĐŸŃ€ фаĐčĐ»ĐŸĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
-        <source>Cannot read file %1:
-%2.</source>
-        <translation>ĐĐ” ŃƒĐŽĐ°Đ»ĐŸŃŃŒ ĐżŃ€ĐŸŃ‡ĐžŃ‚Đ°Ń‚ŃŒ фаĐčĐ» %1:
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
-        <source>File loaded.</source>
-        <translation>ЀаĐčĐ» Đ·Đ°ĐłŃ€ŃƒĐ¶Đ”Đœ.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
-        <source>Do you want to save the current file
-%1 ?</source>
-        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ Ń‚Đ”ĐșущоĐč фаĐčĐ»
-%1?</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
-        <source>Cannot write file %1:
-%2.</source>
-        <translation>ĐĐ” ŃƒĐŽĐ°Đ»ĐŸŃŃŒ ŃĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ фаĐčĐ» %1:
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
-        <source>File %1 saved</source>
-        <translation>ЀаĐčĐ» %1 ŃĐŸŃ…Ń€Đ°ĐœŃ‘Đœ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
-        <source>&amp;Close File</source>
-        <translation>&amp;ЗаĐșрыть</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
-        <source>&amp;New File</source>
-        <translation>ĐĄĐŸĐ·ĐŽ&amp;ать</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
-        <source>&amp;Open File</source>
-        <translation>&amp;ОтĐșрыть</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
-        <source>&amp;Save File</source>
-        <translation>&amp;ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
-        <source>Save File &amp;As</source>
-        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ &amp;ĐșĐ°Đș</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
-        <source>&amp;Undo</source>
-        <translation>О&amp;Ń‚ĐŒĐ”ĐœĐžŃ‚ŃŒ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
-        <source>&amp;Redo</source>
-        <translation>&amp;ĐŸĐŸĐČŃ‚ĐŸŃ€ĐžŃ‚ŃŒ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
-        <source>&amp;Copy</source>
-        <translation>&amp;ĐšĐŸĐżĐžŃ€ĐŸĐČать</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
-        <source>Cu&amp;t</source>
-        <translation>Вы&amp;Ń€Đ”Đ·Đ°Ń‚ŃŒ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
-        <source>&amp;Paste</source>
-        <translation>&amp;ВстаĐČоть</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
-        <source>&amp;Next Bookmark</source>
-        <translation>ĐĄ&amp;Đ»Đ”ĐŽŃƒŃŽŃ‰Đ°Ń Đ·Đ°ĐșлаЎĐșĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
-        <source>Pre&amp;vious Bookmark</source>
-        <translation>Пр&amp;Đ”ĐŽŃ‹ĐŽŃƒŃ‰Đ°Ń Đ·Đ°ĐșлаЎĐșĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
-        <source>Toggle &amp;Bookmark</source>
-        <translation>&amp;ĐŁŃŃ‚Đ°ĐœĐŸĐČоть/ŃĐœŃŃ‚ŃŒ Đ·Đ°ĐșлаЎĐșу</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
-        <source>&amp;Run File</source>
-        <translation>&amp;Запустоть фаĐčĐ»</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
-        <source>&amp;File</source>
-        <translation>&amp;ЀаĐčĐ»</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
-        <source>&amp;Edit</source>
-        <translation>&amp;ПраĐČĐșĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
-        <source>&amp;Run</source>
-        <translation>&amp;ЗапусĐș</translation>
-    </message>
-</context>
-<context>
-    <name>FilesDockWidget</name>
-    <message>
-        <source>Current Folder</source>
-        <translation type="obsolete">йДĐșущоĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="32"/>
-        <source>Current Directory</source>
-        <translation>йДĐșущоĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="46"/>
-        <source>Move up one directory.</source>
-        <translation>ĐŸĐ”Ń€Đ”Đčто ĐœĐ° ŃƒŃ€ĐŸĐČĐ”ĐœŃŒ ĐČŃ‹ŃˆĐ”.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="49"/>
-        <source>Enter the path or filename.</source>
-        <translation>ВĐČДЎОтД путь ОлО ĐžĐŒŃ фаĐčла.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="78"/>
-        <source>Doubleclick a file to open it.</source>
-        <translation>ДĐČĐŸĐčĐœĐŸĐč Ń‰Đ”Đ»Ń‡ĐŸĐș ĐżĐŸ фаĐčлу ĐŸŃ‚ĐșŃ€ĐŸĐ”Ń‚ Đ”ĐłĐŸ.</translation>
-    </message>
-</context>
-<context>
-    <name>HistoryDockWidget</name>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
-        <source>Doubleclick a command to transfer it to the terminal.</source>
-        <translation>ДĐČĐŸĐčĐœĐŸĐč Ń‰Đ”Đ»Ń‡ĐŸĐș ĐżĐŸ ĐșĐŸĐŒĐ°ĐœĐŽĐ” ĐżĐ”Ń€Đ”ĐœĐ”ŃŃ‘Ń‚ Дё ĐČ ĐșĐŸĐŒĐ°ĐœĐŽĐœŃƒŃŽ ŃŃ‚Ń€ĐŸĐșу.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
-        <source>Enter text to filter the command history.</source>
-        <translation>ВĐČДЎОтД Ń‚Đ”Đșст ĐŽĐ»Ń Ń„ĐžĐ»ŃŒŃ‚Ń€Đ°Ń†ĐžĐž ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
-        <source>Command History</source>
-        <translation>Đ–ŃƒŃ€ĐœĐ°Đ» ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
-    </message>
-</context>
-<context>
-    <name>LexerOctaveGui</name>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
-        <source>Default</source>
-        <translation>ĐŸĐŸ ŃƒĐŒĐŸĐ»Ń‡Đ°ĐœĐžŃŽ</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
-        <source>Comment</source>
-        <translation>ĐšĐŸĐŒĐŒĐ”ĐœŃ‚Đ°Ń€ĐžĐč</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
-        <source>Command</source>
-        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
-        <source>Number</source>
-        <translation>Đ§ĐžŃĐ»ĐŸ</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
-        <source>Keyword</source>
-        <translation>ЗарДзДрĐČĐžŃ€ĐŸĐČĐ°ĐœĐœĐŸĐ” ŃĐ»ĐŸĐČĐŸ</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
-        <source>Single-quoted string</source>
-        <translation>ĐĄŃ‚Ń€ĐŸĐșĐ° ĐČ ĐŸĐŽĐžĐœĐ°Ń€ĐœŃ‹Ń… ĐșĐ°ĐČычĐșах</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
-        <source>Operator</source>
-        <translation>ĐžĐżĐ”Ń€Đ°Ń‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
-        <source>Identifier</source>
-        <translation>Đ˜ĐŽĐ”ĐœŃ‚ĐžŃ„ĐžĐșĐ°Ń‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
-        <source>Double-quoted string</source>
-        <translation>ĐĄŃ‚Ń€ĐŸĐșĐ° ĐČ ĐŽĐČĐŸĐčĐœŃ‹Ń… ĐșĐ°ĐČычĐșах</translation>
-    </message>
-</context>
-<context>
-    <name>MainWindow</name>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="47"/>
-        <source>Opening file.</source>
-        <translation>ОтĐșрыĐČĐ°Đ”Ń‚ŃŃ фаĐčĐ».</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="124"/>
-        <source>Save Workspace</source>
-        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="134"/>
-        <source>Load Workspace</source>
-        <translation>Đ—Đ°ĐłŃ€ŃƒĐ·ĐžŃ‚ŃŒ ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="226"/>
-        <location filename="../src/MainWindow.cpp" line="362"/>
-        <source>About Octave</source>
-        <translation>Об Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="238"/>
-        <source>Saving data and shutting down.</source>
-        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ Đž Đ·Đ°ĐČĐ”Ń€ŃˆĐžŃ‚ŃŒ Ń€Đ°Đ±ĐŸŃ‚Ńƒ.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="276"/>
-        <source>View the variables in the active workspace.</source>
-        <translation>ĐŸŃ€ĐŸŃĐŒĐŸŃ‚Ń€ ŃĐŸĐŽĐ”Ń€Đ¶ĐžĐŒĐŸĐłĐŸ Ń‚Đ”ĐșŃƒŃ‰Đ”Đč ĐŸĐ±Đ»Đ°ŃŃ‚Đž ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń….</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="278"/>
-        <source>Browse and search the command history.</source>
-        <translation>ĐŸŃ€ĐŸŃĐŒĐŸŃ‚Ń€ Đž ĐżĐŸĐžŃĐș ĐČ Đ¶ŃƒŃ€ĐœĐ°Đ»Đ” ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="280"/>
-        <source>Browse your files.</source>
-        <translation>ĐŸŃ€ĐŸŃĐŒĐŸŃ‚Ń€ фаĐčĐ»ĐŸĐČ.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="294"/>
-        <source>Terminal</source>
-        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐœĐ°Ń ŃŃ‚Ń€ĐŸĐșĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="298"/>
-        <source>Enter your commands into the Octave terminal.</source>
-        <translation>ВĐČДЎОтД ĐșĐŸĐŒĐ°ĐœĐŽŃ‹ ĐČ ĐșĐŸĐŒĐ°ĐœĐŽĐœĐŸĐč ŃŃ‚Ń€ĐŸĐșĐ” Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="307"/>
-        <source>Documentation</source>
-        <translation>Đ”ĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†ĐžŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="311"/>
-        <source>Browse the Octave documentation for help.</source>
-        <translation>ОтĐșрыть ĐŽĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†ĐžŃŽ ĐżĐŸ Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="320"/>
-        <source>Chat</source>
-        <translation>Чат</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="323"/>
-        <source>Instantly chat with other Octave users for help.</source>
-        <translation>Чат с ĐżĐŸĐ»ŃŒĐ·ĐŸĐČĐ°Ń‚Đ”Đ»ŃĐŒĐž Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="330"/>
-        <source>Octave</source>
-        <translation>Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="331"/>
-        <source>Settings</source>
-        <translation>ĐŸĐ°Ń€Đ°ĐŒĐ”Ń‚Ń€Ń‹</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="333"/>
-        <source>Exit</source>
-        <translation>Đ’Ń‹Ń…ĐŸĐŽ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="335"/>
-        <source>Interface</source>
-        <translation>Đ˜ĐœŃ‚Đ”Ń€Ń„Đ”Đčс</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="337"/>
-        <source>Align Windows</source>
-        <translation>Đ’Ń‹Ń€ĐŸĐČĐœŃŃ‚ŃŒ ĐŸĐșĐœĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="339"/>
-        <location filename="../src/MainWindow.cpp" line="351"/>
-        <source>Workspace</source>
-        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="342"/>
-        <source>History</source>
-        <translation>Đ–ŃƒŃ€ĐœĐ°Đ» ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="345"/>
-        <source>File Browser</source>
-        <translation>ЀаĐčĐ»ĐŸĐČыĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="349"/>
-        <source>Open New Editor Window</source>
-        <translation>ОтĐșрыть ĐœĐŸĐČĐŸĐ” ĐŸĐșĐœĐŸ рДЎаĐșŃ‚ĐŸŃ€Đ°</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="352"/>
-        <source>Load</source>
-        <translation>Đ—Đ°ĐłŃ€ŃƒĐ·ĐžŃ‚ŃŒ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="353"/>
-        <source>Save</source>
-        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="355"/>
-        <source>Clear</source>
-        <translation>Очостоть</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="357"/>
-        <source>Community</source>
-        <translation>ĐĄĐŸĐŸĐ±Ń‰Đ”ŃŃ‚ĐČĐŸ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="358"/>
-        <source>Report Bug</source>
-        <translation>ĐĄĐŸĐŸĐ±Ń‰ĐžŃ‚ŃŒ ĐŸĐ± ĐŸŃˆĐžĐ±ĐșĐ”</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="359"/>
-        <source>Agora</source>
-        <translation>Agora</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="360"/>
-        <source>Octave Forge</source>
-        <translation>Octave Forge</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="363"/>
-        <source>About Qt</source>
-        <translation>О Qt</translation>
-    </message>
-</context>
-<context>
-    <name>SettingsDialog</name>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="29"/>
-        <source>Settings</source>
-        <translation>ĐŸĐ°Ń€Đ°ĐŒĐ”Ń‚Ń€Ń‹</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="39"/>
-        <source>Chat</source>
-        <translation>Чат</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="47"/>
-        <source>Connect to #octave on startup</source>
-        <translation>ĐŸĐŸĐŽĐșĐ»ŃŽŃ‡ĐžŃ‚ŃŒŃŃ Đș #octave про запусĐșĐ”</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="57"/>
-        <source>Show message of the day</source>
-        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать ŃĐŸĐČДт ĐŽĐœŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="64"/>
-        <source>Show topic</source>
-        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать Ń‚Đ”ĐŒŃƒ ĐŸĐ±ŃŃƒĐ¶ĐŽĐ”ĐœĐžŃ про ĐżĐŸĐŽĐșĐ»ŃŽŃ‡Đ”ĐœĐžĐž</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="71"/>
-        <source>Automatically identify on NickServ</source>
-        <translation>АĐČŃ‚ĐŸĐŒĐ°Ń‚ĐžŃ‡Đ”ŃĐșĐž ĐžĐŽĐ”ĐœŃ‚ĐžŃ„ĐžŃ†ĐžŃ€ĐŸĐČаться у NickServ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="78"/>
-        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
-        <translation>ĐŸŃ€Đ”ĐŽŃƒĐżŃ€Đ”Đ¶ĐŽĐ”ĐœĐžĐ”: ĐżĐ°Ń€ĐŸĐ»ŃŒ Đ±ŃƒĐŽĐ”Ń‚ ŃĐŸŃ…Ń€Đ°ĐœŃ‘Đœ ĐČ ~/.octavegui ĐŸĐ±Ń‹Ń‡ĐœŃ‹ĐŒ Ń‚Đ”ĐșŃŃ‚ĐŸĐŒ. ĐĐ” ĐČĐČĐŸĐŽĐžŃ‚Đ” ĐżĐ°Ń€ĐŸĐ»ŃŒ, ДслО пДрДжОĐČаДтД ĐŸ ĐČĐŸĐ·ĐŒĐŸĐ¶ĐœŃ‹Ń… ŃƒŃĐ·ĐČĐžĐŒĐŸŃŃ‚ŃŃ… ĐČ Đ±Đ”Đ·ĐŸĐżĐ°ŃĐœĐŸŃŃ‚Đž ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžŃ.</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="103"/>
-        <location filename="../src/SettingsDialog.ui" line="311"/>
-        <source>Password:</source>
-        <translation>ĐŸĐ°Ń€ĐŸĐ»ŃŒ:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="125"/>
-        <source>Editor</source>
-        <translation>РДЎаĐșŃ‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="133"/>
-        <source>Use custom file editor:</source>
-        <translation>Đ’Ń‹Đ±Ń€Đ°Ń‚ŃŒ рДЎаĐșŃ‚ĐŸŃ€:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="143"/>
-        <source>emacs</source>
-        <translation>emacs</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="166"/>
-        <source>File Browser</source>
-        <translation>ЀаĐčĐ»ĐŸĐČыĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="172"/>
-        <source>Show filenames</source>
-        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать ĐžĐŒĐ”ĐœĐ° фаĐčĐ»ĐŸĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="179"/>
-        <source>Show file size</source>
-        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать Ń€Đ°Đ·ĐŒĐ”Ń€ фаĐčĐ»ĐŸĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="186"/>
-        <source>Show file type</source>
-        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать топы фаĐčĐ»ĐŸĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="193"/>
-        <source>Show date of last modification</source>
-        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать Юату ĐżĐŸŃĐ»Đ”ĐŽĐœĐ”ĐłĐŸ ĐžĐ·ĐŒĐ”ĐœĐ”ĐœĐžŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="200"/>
-        <source>Show hidden files</source>
-        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать сĐșрытыД фаĐčлы</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="207"/>
-        <source>Alternating row colors</source>
-        <translation>Đ§Đ”Ń€Đ”ĐŽŃƒŃŽŃ‰ĐžĐ”ŃŃ цĐČДта ŃŃ‚Ń€ĐŸĐș</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="215"/>
-        <source>Network</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="221"/>
-        <source>Use proxy server</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="233"/>
-        <source>Proxy Type:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="244"/>
-        <source>HttpProxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="249"/>
-        <source>Socks5Proxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="260"/>
-        <source>Hostname:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="277"/>
-        <source>Port:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="294"/>
-        <source>Username:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="339"/>
-        <source>Reset to defaults</source>
-        <translation>ĐŁŃŃ‚Đ°ĐœĐŸĐČоть ĐżĐ°Ń€Đ°ĐŒĐ”Ń‚Ń€Ń‹ ĐżĐŸ ŃƒĐŒĐŸĐ»Ń‡Đ°ĐœĐžŃŽ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="362"/>
-        <source>Export</source>
-        <translation>Đ­ĐșŃĐżĐŸŃ€Ń‚ĐžŃ€ĐŸĐČать</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="372"/>
-        <source>Import</source>
-        <translation>Đ˜ĐŒĐżĐŸŃ€Ń‚ĐžŃ€ĐŸĐČать</translation>
-    </message>
-</context>
-<context>
-    <name>VariablesDockWidget</name>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
-        <source>Workspace</source>
-        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Name</source>
-        <translation>Đ˜ĐŽĐ”ĐœŃ‚ĐžŃ„ĐžĐșĐ°Ń‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Type</source>
-        <translation>йОп</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Value</source>
-        <translation>Đ—ĐœĐ°Ń‡Đ”ĐœĐžĐ”</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
-        <source>Local</source>
-        <translation>Đ›ĐŸĐșĐ°Đ»ŃŒĐœĐ°Ń</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
-        <source>Global</source>
-        <translation>Đ“Đ»ĐŸĐ±Đ°Đ»ŃŒĐœĐ°Ń</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
-        <source>Persistent</source>
-        <translation>ХтатОчДсĐșая</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
-        <source>Hidden</source>
-        <translation>ĐĄĐșрытая</translation>
-    </message>
-</context>
-</TS>
Binary file gui/languages/uk-ua.qm has changed
--- a/gui/languages/uk-ua.ts	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,574 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="uk_UA">
-<context>
-    <name>FileEditorMdiSubWindow</name>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
-        <source>File Editor</source>
-        <translation>РДЎаĐșŃ‚ĐŸŃ€ фаĐčліĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
-        <source>Cannot read file %1:
-%2.</source>
-        <translation>ĐĐ” ĐČĐŽĐ°Đ»ĐŸŃŃ ĐżŃ€ĐŸŃ‡ĐžŃ‚Đ°Ń‚Đž фаĐčĐ» %1:ïżŒ
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
-        <source>File loaded.</source>
-        <translation>ЀаĐčĐ» Đ·Đ°ĐČĐ°ĐœŃ‚Đ°Đ¶Đ”ĐœĐŸ.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
-        <source>Do you want to save the current file
-%1 ?</source>
-        <translation>СпраĐČЮі збДрДгтО ĐżĐŸŃ‚ĐŸŃ‡ĐœĐžĐč фаĐčĐ»
-%1?</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
-        <source>Cannot write file %1:
-%2.</source>
-        <translation>ĐĐ” ĐČĐŽĐ°Đ»ĐŸŃŃ збДрДгтО фаĐčĐ» %1:
-%2.</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
-        <source>File %1 saved</source>
-        <translation>ЀаĐčĐ» %1 Đ·Đ±Đ”Ń€Đ”Đ¶Đ”ĐœĐŸ</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
-        <source>&amp;Close File</source>
-        <translation>За&amp;Đșрото</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
-        <source>&amp;New File</source>
-        <translation>&amp;СтĐČĐŸŃ€ĐžŃ‚Đž</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
-        <source>&amp;Open File</source>
-        <translation>&amp;ВіЮĐșрото</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
-        <source>&amp;Save File</source>
-        <translation>&amp;ЗбДрДгтО</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
-        <source>Save File &amp;As</source>
-        <translation>ЗбДрДгтО &amp;яĐș</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
-        <source>&amp;Undo</source>
-        <translation>В&amp;Đ”Ń€ĐœŃƒŃ‚Đž</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
-        <source>&amp;Redo</source>
-        <translation>П&amp;ĐŸĐČŃ‚ĐŸŃ€ĐžŃ‚Đž</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
-        <source>&amp;Copy</source>
-        <translation>&amp;ĐšĐŸĐżŃ–ŃŽĐČато</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
-        <source>Cu&amp;t</source>
-        <translation>ВОріза&amp;то</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
-        <source>&amp;Paste</source>
-        <translation>&amp;ВстаĐČото</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
-        <source>&amp;Next Bookmark</source>
-        <translation>Đ”ĐŸ &amp;ĐœĐ°ŃŃ‚ŃƒĐżĐœĐŸŃ— Đ·Đ°ĐșлаЎĐșĐž</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
-        <source>Pre&amp;vious Bookmark</source>
-        <translation>Đ”ĐŸ &amp;ĐżĐŸĐżĐ”Ń€Đ”ĐŽĐœŃŒĐŸŃ— Đ·Đ°ĐșлаЎĐșĐž</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
-        <source>Toggle &amp;Bookmark</source>
-        <translation>В&amp;ŃŃ‚Đ°ĐœĐŸĐČото/ĐČОЎалОтО Đ·Đ°ĐșлаЎĐșу</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
-        <source>&amp;Run File</source>
-        <translation>&amp;ВоĐșĐŸĐœĐ°Ń‚Đž фаĐčĐ»</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
-        <source>&amp;File</source>
-        <translation>&amp;ЀаĐčĐ»</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
-        <source>&amp;Edit</source>
-        <translation>&amp;ПраĐČĐșĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
-        <source>&amp;Run</source>
-        <translation>&amp;ВоĐșĐŸĐœĐ°ĐœĐœŃ</translation>
-    </message>
-</context>
-<context>
-    <name>FilesDockWidget</name>
-    <message>
-        <source>Current Folder</source>
-        <translation type="obsolete">ĐŸĐŸŃ‚ĐŸŃ‡ĐœĐžĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="32"/>
-        <source>Current Directory</source>
-        <translation>ĐŸĐŸŃ‚ĐŸŃ‡ĐœĐžĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="46"/>
-        <source>Move up one directory.</source>
-        <translation>ĐŸĐ”Ń€Đ”Đčто ĐČĐłĐŸŃ€Ńƒ ЎДрДĐČĐŸĐŒ ĐșĐ°Ń‚Đ°Đ»ĐŸĐłŃ–ĐČ.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="49"/>
-        <source>Enter the path or filename.</source>
-        <translation>ВĐČĐ”ĐŽŃ–Ń‚ŃŒ ĐżĐŸĐČĐœĐžĐč ŃˆĐ»ŃŃ… ĐŽĐŸ фаĐčлу Đ°Đ±ĐŸ ĐœĐ°Đ·ĐČу фаĐčлу.</translation>
-    </message>
-    <message>
-        <location filename="../src/FilesDockWidget.cpp" line="78"/>
-        <source>Doubleclick a file to open it.</source>
-        <translation>ĐŸĐŸĐŽĐČіĐčĐœĐ” ĐșĐ»Đ°Ń†Đ°ĐœĐœŃ ĐČіЮĐșроє фаĐčĐ».</translation>
-    </message>
-</context>
-<context>
-    <name>HistoryDockWidget</name>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
-        <source>Doubleclick a command to transfer it to the terminal.</source>
-        <translation>ĐŸĐŸĐŽĐČіĐčĐœĐ” ĐșĐ»Đ°Ń†Đ°ĐœĐœŃ ĐżĐ”Ń€Đ”ĐœĐ”ŃĐ” ĐșĐŸĐŒĐ°ĐœĐŽŃƒ ĐŽĐŸ ĐșĐŸĐŒĐ°ĐœĐŽĐœĐŸĐłĐŸ ряЮĐșу.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
-        <source>Enter text to filter the command history.</source>
-        <translation>ВĐČĐ”ĐŽŃ–Ń‚ŃŒ Ń‚Đ”Đșст ĐŽĐ»Ń Ń„Ń–Đ»ŃŒŃ‚Ń€ŃƒĐČĐ°ĐœĐœŃ Ń–ŃŃ‚ĐŸŃ€Ń–Ń— ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
-    </message>
-    <message>
-        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
-        <source>Command History</source>
-        <translation>Đ†ŃŃ‚ĐŸŃ€Ń–Ń ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
-    </message>
-</context>
-<context>
-    <name>LexerOctaveGui</name>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
-        <source>Default</source>
-        <translation>ĐĄŃ‚Đ°ĐœĐŽĐ°Ń€Ń‚ĐœŃ– ĐœĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
-        <source>Comment</source>
-        <translation>ĐšĐŸĐŒĐ”ĐœŃ‚Đ°Ń€</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
-        <source>Command</source>
-        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
-        <source>Number</source>
-        <translation>Đ§ĐžŃĐ»ĐŸ</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
-        <source>Keyword</source>
-        <translation>ЗарДзДрĐČĐŸĐČĐ°ĐœĐ” ŃĐ»ĐŸĐČĐŸ</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
-        <source>Single-quoted string</source>
-        <translation>Đ ŃĐŽĐŸĐș ĐČ ĐŸĐŽĐžĐœĐ°Ń€ĐœĐžŃ… лапĐșах</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
-        <source>Operator</source>
-        <translation>ĐžĐżĐ”Ń€Đ°Ń‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
-        <source>Identifier</source>
-        <translation>Đ†ĐŽĐ”ĐœŃ‚ĐžŃ„Ń–ĐșĐ°Ń‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
-        <source>Double-quoted string</source>
-        <translation>Đ ŃĐŽĐŸĐș у ĐżĐŸĐŽĐČіĐčĐœĐžŃ… лапĐșах</translation>
-    </message>
-</context>
-<context>
-    <name>MainWindow</name>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="47"/>
-        <source>Opening file.</source>
-        <translation>ВіЮĐșроĐČається фаĐčĐ».</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="124"/>
-        <source>Save Workspace</source>
-        <translation>ЗбДрДгтО ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="134"/>
-        <source>Load Workspace</source>
-        <translation>ЗаĐČĐ°ĐœŃ‚Đ°Đ¶ĐžŃ‚Đž ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="226"/>
-        <location filename="../src/MainWindow.cpp" line="362"/>
-        <source>About Octave</source>
-        <translation>ĐŸŃ€ĐŸ Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="238"/>
-        <source>Saving data and shutting down.</source>
-        <translation>ЗбДрДгтО ĐŽĐ°ĐœŃ– і Đ·Đ°ĐČĐ”Ń€ŃˆĐžŃ‚Đž Ń€ĐŸĐ±ĐŸŃ‚Ńƒ.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="276"/>
-        <source>View the variables in the active workspace.</source>
-        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐŽ Đ·ĐŒŃ–ŃŃ‚Ńƒ ĐżĐŸŃ‚ĐŸŃ‡ĐœĐŸŃ— ĐŸĐ±Đ»Đ°ŃŃ‚Ń– Đ·ĐŒŃ–ĐœĐœĐžŃ….</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="278"/>
-        <source>Browse and search the command history.</source>
-        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐŽ і ĐżĐŸŃˆŃƒĐș сДрДЎ Ń–ŃŃ‚ĐŸŃ€Ń–Ń— ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="280"/>
-        <source>Browse your files.</source>
-        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐœŃƒŃ‚Đž фаĐčлО.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="294"/>
-        <source>Terminal</source>
-        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐœĐžĐč Ń€ŃĐŽĐŸĐș</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="298"/>
-        <source>Enter your commands into the Octave terminal.</source>
-        <translation>ВĐČĐ”ĐŽŃ–Ń‚ŃŒ ĐșĐŸĐŒĐ°ĐœĐŽĐž ĐŽĐŸ ĐșĐŸĐŒĐ°ĐœĐŽĐœĐŸĐłĐŸ ряЮĐșĐ° Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="307"/>
-        <source>Documentation</source>
-        <translation>Đ”ĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†Ń–Ń</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="311"/>
-        <source>Browse the Octave documentation for help.</source>
-        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐœŃƒŃ‚Đž ĐŽĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†Ń–ŃŽ ĐŽĐŸ Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="320"/>
-        <source>Chat</source>
-        <translation>Чат</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="323"/>
-        <source>Instantly chat with other Octave users for help.</source>
-        <translation>Чат Đ· ĐșĐŸŃ€ĐžŃŃ‚ŃƒĐČĐ°Ń‡Đ°ĐŒĐž Octave.</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="330"/>
-        <source>Octave</source>
-        <translation>Octave</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="331"/>
-        <source>Settings</source>
-        <translation>ĐĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="333"/>
-        <source>Exit</source>
-        <translation>ВоĐčто</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="335"/>
-        <source>Interface</source>
-        <translation>Đ†ĐœŃ‚Đ”Ń€Ń„Đ”Đčс</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="337"/>
-        <source>Align Windows</source>
-        <translation>ВоріĐČĐœŃŃ‚Đž ĐČіĐșĐœĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="339"/>
-        <location filename="../src/MainWindow.cpp" line="351"/>
-        <source>Workspace</source>
-        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="342"/>
-        <source>History</source>
-        <translation>Đ†ŃŃ‚ĐŸŃ€Ń–Ń ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="345"/>
-        <source>File Browser</source>
-        <translation>ЀаĐčĐ»ĐŸĐČĐžĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="349"/>
-        <source>Open New Editor Window</source>
-        <translation>ВіЮĐșрото ĐœĐŸĐČĐ” ĐČіĐșĐœĐŸ рДЎаĐșŃ‚ĐŸŃ€Đ°</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="352"/>
-        <source>Load</source>
-        <translation>ЗаĐČĐ°ĐœŃ‚Đ°Đ¶ĐžŃ‚Đž</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="353"/>
-        <source>Save</source>
-        <translation>ЗбДрДгтО</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="355"/>
-        <source>Clear</source>
-        <translation>Очостото</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="357"/>
-        <source>Community</source>
-        <translation>ĐĄĐżŃ–Đ»ŃŒĐœĐŸŃ‚Đ°</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="358"/>
-        <source>Report Bug</source>
-        <translation>ĐŸĐŸĐČŃ–ĐŽĐŸĐŒĐžŃ‚Đž ĐżŃ€ĐŸ ĐżĐŸĐŒĐžĐ»Đșу</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="359"/>
-        <source>Agora</source>
-        <translation>Agora</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="360"/>
-        <source>Octave Forge</source>
-        <translation>Octave Forge</translation>
-    </message>
-    <message>
-        <location filename="../src/MainWindow.cpp" line="363"/>
-        <source>About Qt</source>
-        <translation>ĐŸŃ€ĐŸ Qt</translation>
-    </message>
-</context>
-<context>
-    <name>SettingsDialog</name>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="29"/>
-        <source>Settings</source>
-        <translation>ĐĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="39"/>
-        <source>Chat</source>
-        <translation>Чат</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="47"/>
-        <source>Connect to #octave on startup</source>
-        <translation>З&apos;Ń”ĐŽĐœĐ°Ń‚ĐžŃŃ Đ· #octave про запусĐșу</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="57"/>
-        <source>Show message of the day</source>
-        <translation>ĐŸĐŸĐșазуĐČато ĐżĐŸŃ€Đ°ĐŽŃƒ ĐŽĐœŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="64"/>
-        <source>Show topic</source>
-        <translation>ĐŸĐŸĐșазуĐČато Ń‚Đ”ĐŒŃƒ чату про Đ·&apos;Ń”ĐŽĐœĐ°ĐœĐœŃ–</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="71"/>
-        <source>Automatically identify on NickServ</source>
-        <translation>АĐČŃ‚ĐŸĐŒĐ°Ń‚ĐžŃ‡ĐœĐŸ Ń–ĐŽĐ”ĐœŃ‚ĐžŃ„Ń–ĐșуĐČатося ĐČ NickServ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="78"/>
-        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
-        <translation>ĐŸĐŸĐżĐ”Ń€Đ”ĐŽĐ¶Đ”ĐœĐœŃ: ĐżĐ°Ń€ĐŸĐ»ŃŒ буЎД Đ·Đ±Đ”Ń€Đ”Đ¶Đ”ĐœĐŸ ĐČ ~/.octavegui Đ·ĐČочаĐčĐœĐžĐŒ Ń‚Đ”ĐșŃŃ‚ĐŸĐŒ. ĐĐ” ĐČĐČĐŸĐŽŃŒŃ‚Đ” ĐżĐ°Ń€ĐŸĐ»ŃŒ, яĐșŃ‰ĐŸ пДрДĐčĐŒĐ°Ń”Ń‚Đ”ŃŃŒ ĐżĐŸŃ‚Đ”ĐœŃ†Ń–ĐčĐœĐžĐŒĐž ĐżŃ€ĐŸĐ±Đ»Đ”ĐŒĐ°ĐŒĐž Ń–Đ· Đ·Đ°Ń…ĐžŃŃ‚ĐŸĐŒ ĐŽĐ°ĐœĐžŃ… ĐČ ĐżŃ€ĐŸĐłŃ€Đ°ĐŒŃ–.</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="103"/>
-        <location filename="../src/SettingsDialog.ui" line="311"/>
-        <source>Password:</source>
-        <translation>ĐŸĐ°Ń€ĐŸĐ»ŃŒ:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="125"/>
-        <source>Editor</source>
-        <translation>РДЎаĐșŃ‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="133"/>
-        <source>Use custom file editor:</source>
-        <translation>ВоĐșĐŸŃ€ĐžŃŃ‚ĐŸĐČуĐČато Ń–ĐœŃˆĐžĐč рДЎаĐșŃ‚ĐŸŃ€:</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="143"/>
-        <source>emacs</source>
-        <translation>emacs</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="166"/>
-        <source>File Browser</source>
-        <translation>ЀаĐčĐ»ĐŸĐČĐžĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="172"/>
-        <source>Show filenames</source>
-        <translation>ĐŸĐŸĐșазуĐČато ĐœĐ°Đ·ĐČĐž фаĐčліĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="179"/>
-        <source>Show file size</source>
-        <translation>ĐŸĐŸĐșазуĐČато Ń€ĐŸĐ·ĐŒŃ–Ń€ фаĐčліĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="186"/>
-        <source>Show file type</source>
-        <translation>ĐŸĐŸĐșазуĐČато топо фаĐčліĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="193"/>
-        <source>Show date of last modification</source>
-        <translation>ĐŸĐŸĐșазуĐČато Юату ĐŸŃŃ‚Đ°ĐœĐœŃŒĐŸŃ— Đ·ĐŒŃ–ĐœĐž</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="200"/>
-        <source>Show hidden files</source>
-        <translation>ĐŸĐŸĐșазуĐČато ĐżŃ€ĐžŃ…ĐŸĐČĐ°ĐœŃ– фаĐčлО</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="207"/>
-        <source>Alternating row colors</source>
-        <translation>Đ§Đ”Ń€ĐłŃƒĐČато ĐșĐŸĐ»Ń–Ń€ ряЮĐșіĐČ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="215"/>
-        <source>Network</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="221"/>
-        <source>Use proxy server</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="233"/>
-        <source>Proxy Type:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="244"/>
-        <source>HttpProxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="249"/>
-        <source>Socks5Proxy</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="260"/>
-        <source>Hostname:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="277"/>
-        <source>Port:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="294"/>
-        <source>Username:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="339"/>
-        <source>Reset to defaults</source>
-        <translation>Đ’ŃŃ‚Đ°ĐœĐŸĐČото ŃŃ‚Đ°ĐœĐŽĐ°Ń€Ń‚ĐœŃ– ĐœĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="362"/>
-        <source>Export</source>
-        <translation>ЕĐșŃĐżĐŸŃ€Ń‚ŃƒĐČато</translation>
-    </message>
-    <message>
-        <location filename="../src/SettingsDialog.ui" line="372"/>
-        <source>Import</source>
-        <translation>Đ†ĐŒĐżĐŸŃ€Ń‚ŃƒĐČато</translation>
-    </message>
-</context>
-<context>
-    <name>VariablesDockWidget</name>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
-        <source>Workspace</source>
-        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Name</source>
-        <translation>Đ†ĐŽĐ”ĐœŃ‚ĐžŃ„Ń–ĐșĐ°Ń‚ĐŸŃ€</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Type</source>
-        <translation>йОп</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
-        <source>Value</source>
-        <translation>Đ—ĐœĐ°Ń‡Đ”ĐœĐœŃ</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
-        <source>Local</source>
-        <translation>Đ›ĐŸĐșĐ°Đ»ŃŒĐœĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
-        <source>Global</source>
-        <translation>Đ“Đ»ĐŸĐ±Đ°Đ»ŃŒĐœĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
-        <source>Persistent</source>
-        <translation>ĐĄŃ‚Đ°Ń‚ĐžŃ‡ĐœĐ°</translation>
-    </message>
-    <message>
-        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
-        <source>Hidden</source>
-        <translation>ĐŸŃ€ĐžŃ…ĐŸĐČĐ°ĐœĐ°</translation>
-    </message>
-</context>
-</TS>
Binary file gui/media/chat.png has changed
Binary file gui/media/help_index.png has changed
--- a/gui/media/icons_license	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-Icons license for:
-chat.png
-help_index.png
-terminal.png
-jabber_protocol.png
-
-by http://www.everaldo.com/ on 17.07.2011:
-
-The Crystal Project are released under LGPL.
-GNU General Public License.
-
-This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
-
-A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
-
-The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
-
-"Source code" for a work means the preferred form of the work for making modifications to it. For a library, 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 library.
-
-Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
-
-You may copy and distribute verbatim copies of the Library's complete 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 distribute a copy of this License along with the Library.
-
-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.
-
-You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
-
-The modified work must itself be a software library.
-You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
-You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
-If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
-(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, 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 Library, 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 Library.
-
-In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
-
-You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
-
-Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
-
-This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
-
-You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you 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.
-
-If distribution of 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 satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
-
-A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
-
-However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
-When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
-
-If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
-
-Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
-
-As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
-
-You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
-
-Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) .
-Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
-Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
-If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
-Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
-For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be 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.
-
-It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
-
-You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
-
-Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
-
-Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
-
-You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library 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.
-
-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 Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
-
-Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library 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 with this License.
-
-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 Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library 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 Library.
-
-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.
-
-If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library 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.
-
-The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
-
-If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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
-
-Because the library is licensed free of charge, there is no warranty for the library, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the library "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 library is with you. Should the library prove defective, you assume the cost of all necessary servicing, repair or correction.
-
-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 library 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 library (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 library to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.
Binary file gui/media/jabber_protocol.png has changed
Binary file gui/media/logo.png has changed
Binary file gui/media/terminal.png has changed
--- a/gui/msvc-debug.pri	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-win32-msvc* {
-	CONFIG += release warn_off
-	QMAKE_CXXFLAGS += -MP
-	QMAKE_CXXFLAGS_RELEASE += -Zi
-	QMAKE_CXXFLAGS_RELEASE -= -O2
-	QMAKE_LFLAGS_RELEASE += -debug
-	QMAKE_CLEAN += $(DESTDIR)$(QMAKE_TARGET).pdb
-}
--- a/gui/octave-gui.pro	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-# OctaveGUI - A graphical user interface for Octave
-# Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-# Basic settings:
-QT                  += core gui webkit network	    # Qt modules
-TEMPLATE            = app                           # Build as application
-TARGET              = octave-gui                    # Name of the target binary
-
-DESTDIR             = bin                           # Destination of the output
-UI_DIR              = ui-files                      # Folder for ui files
-MOC_DIR             = moc-files                     # Folder for moc files
-OBJECTS_DIR         = object-files                  # Folder for object files
-
-TRANSLATIONS        += languages/generic.ts \
-                       languages/de-de.ts \
-                       languages/pt-br.ts \
-                       languages/es-es.ts \
-                       languages/ru-ru.ts \
-                       languages/uk-ua.ts           # Available translations
-LIBS                += -lqscintilla2 $$system(mkoctfile -p LIBS) $$system(mkoctfile -p OCTAVE_LIBS)
-
-mac {
-    CONFIG -= app_bundle
-}
-
-# Includepaths and libraries to link against:
-INCLUDEPATH         += src src/terminal src/qirc src/backend \
-                       $$system(mkoctfile -p INCFLAGS)
-INCFLAGS            += $$system(mkoctfile -p INCFLAGS)
-mac {
-    INCFLAGS += -I/opt/local-native/include
-}
-
-QMAKE_LIBDIR        += $$system(octave-config -p OCTLIBDIR)
-
-mac {
-    LFLAGS += -L/opt/local-native/lib
-}
-
-unix {
-    LIBS +=  -lutil
-}
-
-win32-g++ {
-    QMAKE_LFLAGS += --enable-auto-import
-}
-
-win32-msvc* {
-    DEFINES += QSCINTILLA_DLL
-    #CONFIG += console
-    include(msvc-debug.pri)
-}
-
-QMAKE_LFLAGS        += $$LFLAGS $$system(mkoctfile -p RLD_FLAG)
-QMAKE_CXXFLAGS      += $$INCFLAGS
-
-# Files associated with the project:
-SOURCES +=\
-    src/lexer/lexeroctavegui.cpp \
-    src/MainWindow.cpp \
-    src/WorkspaceView.cpp \
-    src/HistoryDockWidget.cpp \
-    src/FilesDockWidget.cpp \
-    src/FileEditorMdiSubWindow.cpp \
-    src/BrowserWidget.cpp \
-    src/ImageViewerMdiSubWindow.cpp \
-    src/irc/IRCWidget.cpp \
-    src/SettingsDialog.cpp \
-    src/OctaveGUI.cpp \
-    src/ResourceManager.cpp \
-    src/CommandLineParser.cpp \
-    src/backend/OctaveCallbackThread.cpp \
-    src/backend/OctaveLink.cpp \
-    src/backend/OctaveMainThread.cpp \
-    src/irc/IRCClientImpl.cpp \
-    src/backend/ReadlineAdapter.cpp \
-    src/WelcomeWizard.cpp \
-    src/AbstractTerminalView.cpp
-
-unix {
-SOURCES +=\
-    src/TerminalHighlighter.cpp \
-    src/TerminalView.cpp \
-    src/terminal/KPty.cpp \
-    src/terminal/KPtyDevice.cpp \
-    src/terminal/LinuxTerminalEmulation.cpp \
-    src/terminal/TerminalEmulation.cpp
-}
-
-win32 {
-SOURCES += \
-    src/WinTerminalView.cpp \
-    src/terminal/win32/QConsole.cpp \
-    src/terminal/win32/QConsoleColors.cpp
-}
-
-HEADERS += \
-    src/lexer/lexeroctavegui.h \
-    src/MainWindow.h \
-    src/WorkspaceView.h \
-    src/HistoryDockWidget.h \
-    src/FilesDockWidget.h \
-    src/FileEditorMdiSubWindow.h \
-    src/BrowserWidget.h \
-    src/ImageViewerMdiSubWindow.h \
-    src/irc/IRCWidget.h \
-    src/SettingsDialog.h \
-    src/ResourceManager.h \
-    src/CommandLineParser.h \
-    src/backend/OctaveCallbackThread.h \
-    src/backend/OctaveLink.h \
-    src/backend/OctaveMainThread.h \
-    src/irc/IRCClientInterface.h \
-    src/irc/IRCClientImpl.h \
-    src/backend/ReadlineAdapter.h \
-    src/WelcomeWizard.h \
-    src/AbstractTerminalView.h
-
-unix {
-HEADERS += \
-    src/TerminalHighlighter.h \
-    src/TerminalView.h \
-    src/terminal/KPtyDevice.h \
-    src/terminal/KPty.h \
-    src/terminal/LinuxTerminalEmulation.h \
-    src/terminal/TerminalEmulation.h
-}
-
-win32 {
-HEADERS += \
-    src/WinTerminalView.h \
-    src/terminal/win32/QConsole.h \
-    src/terminal/win32/QConsoleColors.h
-INCLUDEPATH += src/terminal/win32
-}
-
-FORMS += \
-    src/SettingsDialog.ui \
-    src/WelcomeWizard.ui
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/COPYING	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,185 @@
+GNU AFFERO GENERAL PUBLIC LICENSE
+
+Version 3, 19 November 2007
+
+Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/> 
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
+
+The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
+
+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 them 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.
+
+Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
+
+A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
+
+The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
+
+An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS
+
+0. Definitions.
+"This License" refers to version 3 of the GNU Affero General Public License.
+
+"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
+
+"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
+
+To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
+
+A "covered work" means either the unmodified Program or a work based on the Program.
+
+To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
+
+To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
+
+An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
+
+1. Source Code.
+The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
+
+A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
+
+The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
+
+The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
+
+The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
+
+The Corresponding Source for a work in source code form is that same work.
+
+2. Basic Permissions.
+All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
+
+You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
+
+Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
+
+3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
+
+When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
+
+4. Conveying Verbatim Copies.
+You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
+
+You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
+
+5. Conveying Modified Source Versions.
+You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
+
+a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
+b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
+c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
+d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
+A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
+
+6. Conveying Non-Source Forms.
+You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
+
+a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
+b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
+c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
+d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
+e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
+A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
+
+A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
+
+"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
+
+If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
+
+The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
+
+Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
+
+7. Additional Terms.
+"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
+
+When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
+
+Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
+
+a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
+b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
+c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
+d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
+e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
+f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
+All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
+
+If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
+
+Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
+
+8. Termination.
+You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
+
+However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
+
+9. Acceptance Not Required for Having Copies.
+You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
+
+10. Automatic Licensing of Downstream Recipients.
+Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
+
+An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
+
+You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
+
+11. Patents.
+A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
+
+A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
+
+Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
+
+In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
+
+If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
+
+If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
+
+A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
+
+Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
+
+12. No Surrender of Others' Freedom.
+If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
+
+13. Remote Network Interaction; Use with the GNU General Public License.
+Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
+
+Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
+
+14. Revised Versions of this License.
+The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
+
+Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
+
+15. Disclaimer of Warranty.
+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.
+
+16. Limitation of Liability.
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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.
+
+17. Interpretation of Sections 15 and 16.
+If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/Doxyfile	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1679 @@
+# Quint - A graphical user interface for Octave
+# Copyright (C) 2011 Jacob Dawid
+# jacob.dawid@googlemail.com
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+
+# Doxyfile 1.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = Quint
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 0.4
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = /home/jacob/Desktop/Quint-Documentation
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, 
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it 
+# parses. With this tag you can assign which parser to use for a given extension. 
+# Doxygen has a built-in mapping, but you can override or extend it using this 
+# tag. The format is ext=language, where ext is a file extension, and language 
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, 
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make 
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C 
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions 
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      = 
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to 
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter 
+# and setter methods for a property. Setting this option to YES (the default) 
+# will make doxygen to replace the get and set methods by a property in the 
+# documentation. This will only work if the methods are indeed getting or 
+# setting a simple type. If this is not the case, or you want to show the 
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
+# determine which symbols to keep in memory and which to flush to disk. 
+# When the cache is full, less often used symbols will be written to disk. 
+# For small to medium size projects (<1000 input files) the default value is 
+# probably good enough. For larger projects a too small cache size can cause 
+# doxygen to be busy swapping symbols to and from disk most of the time 
+# causing a significant performance penality. 
+# If the system has enough physical memory increasing the cache will improve the 
+# performance by keeping more symbols in memory. Note that the value works on 
+# a logarithmic scale so increasing the size by one will rougly double the 
+# memory usage. The cache size is given by this formula: 
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen 
+# will list include files with double quotes in the documentation 
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen 
+# will sort the (brief and detailed) documentation of class members so that 
+# constructors and destructors are listed first. If set to NO (the default) 
+# the constructors will appear in the respective orders defined by 
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. 
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO 
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
+# This will remove the Files entry from the Quick Index and from the 
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index 
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed 
+# by doxygen. The layout file controls the global structure of the generated 
+# output files in an output format independent way. The create the layout file 
+# that represents doxygen's defaults, run doxygen with the -l option. 
+# You can optionally specify a file name after the option, if omitted 
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = /home/jacob/Desktop/gnu-octave/gui/src
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.d \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.f90 \
+                         *.f \
+                         *.vhd \
+                         *.vhdl
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 
+# link to the source code.  Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 
+# Doxygen will adjust the colors in the stylesheet and background images 
+# according to this color. Hue is specified as an angle on a colorwheel, 
+# see http://en.wikipedia.org/wiki/Hue for more information. 
+# For instance the value 0 represents red, 60 is yellow, 120 is green, 
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. 
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of 
+# the colors in the HTML output. For a value of 0 the output will use 
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to 
+# the luminance component of the colors in the HTML output. Values below 
+# 100 gradually make the output lighter, whereas values above 100 make 
+# the output darker. The value divided by 100 is the actual gamma applied, 
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, 
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML 
+# page will contain the date and time when the page was generated. Setting 
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup. 
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html 
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify 
+# the documentation publisher. This should be a reverse domain-name style 
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file 
+# content.
+
+CHM_INDEX_ENCODING     = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and 
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated 
+# that can be used as input for Qt's qhelpgenerator to generate a 
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
+# be used to specify the file name of the resulting .qch file. 
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to 
+# add. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   = 
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the 
+# custom filter to add. For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> 
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  = 
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this 
+# project's 
+# filter section matches. 
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> 
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  = 
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
+# be used to specify the location of Qt's qhelpgenerator. 
+# If non-empty doxygen will try to run qhelpgenerator on the generated 
+# .qhp file.
+
+QHG_LOCATION           = 
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files  
+# will be generated, which together with the HTML files, form an Eclipse help 
+# plugin. To install this plugin and make it available under the help contents 
+# menu in Eclipse, the contents of the directory containing the HTML and XML 
+# files needs to be copied into the plugins directory of eclipse. The name of 
+# the directory within the plugins directory should be the same as 
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before 
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin 
+# the directory name containing the HTML and XML files should also have 
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
+# structure should be generated to display hierarchical information. 
+# If the tag value is set to YES, a side panel will be generated 
+# containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). 
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open 
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included 
+# as images in the HTML documentation. The default is 10. Note that 
+# when you change the font size after a successful doxygen run you need 
+# to manually remove any form_*.png images from the HTML output directory 
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images 
+# generated for formulas are transparent PNGs. Transparent PNGs are 
+# not supported properly for IE 6.0, but are supported on all modern browsers. 
+# Note that when changing this option you need to delete any form_*.png files 
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box 
+# for the HTML output. The underlying search engine uses javascript 
+# and DHTML and should work on any modern browser. Note that when using 
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets 
+# (GENERATE_DOCSET) there is already a search function so this one should 
+# typically be disabled. For large projects the javascript based search engine 
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be 
+# implemented using a PHP enabled web server instead of at the web client 
+# using Javascript. Doxygen will generate the search PHP script and index 
+# file to put on the web server. The advantage of the server 
+# based approach is that it scales better to large projects and allows 
+# full text search. The disadvances is that it is more difficult to setup 
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name. 
+# Note that when enabling USE_PDFLATEX this option is only used for 
+# generating bitmaps for formulas in the HTML output, but not in the 
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include 
+# source code with syntax highlighting in the LaTeX output. 
+# Note that which sources are shown also depends on other settings 
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links. 
+# Note that each tag file must have a unique name 
+# (where the name does NOT include the path) 
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = NO
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is 
+# allowed to run in parallel. When set to 0 (the default) doxygen will 
+# base this on the number of processors available in the system. You can set it 
+# explicitly to a value larger than 0 to get control over the balance 
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will write a font called FreeSans.ttf to the output 
+# directory and reference it in all dot files that doxygen generates. This 
+# font does not include all possible unicode characters however, so when you need 
+# these (or just want a differently looking font) you can specify the font name 
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font, 
+# which can be done by putting it in a standard location or by setting the 
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 
+# containing the font.
+
+DOT_FONTNAME           = FreeSans.ttf
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the 
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a 
+# different font using DOT_FONTNAME you can set the path where dot 
+# can find it using this tag.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = YES
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include 
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif 
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, because dot on Windows does not 
+# seem to support this out of the box. Warning: Depending on the platform used, 
+# enabling this option may lead to badly anti-aliased labels on the edges of 
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/README	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,24 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+Octave GUI is a graphical user interface for Octave with readline support.
+
+If you have any problems, suggestions or ideas, feel free to drop me a mail at
+jacob.dawid@googlemail.com or visit the official channel #octave on FreeNode.
+
+- Jacob Dawid
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/compile.sh	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,18 @@
+# Octave GUI - A graphical user interface for Octave
+# Copyright (C) 2011 Jacob Dawid
+# jacob.dawid@googlemail.com
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+qmake-qt4 && make -j 16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/default-settings/.octave-gui	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,23 @@
+[General]
+connectOnStartup=true
+showMessageOfTheDay=false
+showTopic=true
+autoIdentification=false
+nickServPassword=
+useCustomFileEditor=false
+customFileEditor=emacs
+showFilenames=true
+showFileSize=true
+showFileType=false
+showLastModified=false
+showHiddenFiles=false
+useAlternatingRowColors=true
+IRCNick=User1
+language=en-en
+
+[MainWindow]
+geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\0\x18\0\0\x4\xff\0\0\x3\a\0\0\0\0\0\0\0,\0\0\x5v\0\0\x3\x1c\0\0\0\0\x2\0)"
+windowState="@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x2\0\0\0\0\0\0\x1;\0\0\x2\xa3\xfc\x2\0\0\0\x2\xfb\0\0\0&\0V\0\x61\0r\0i\0\x61\0\x62\0l\0\x65\0s\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\0\x19\0\0\x1\xe\0\0\0k\0\xff\xff\xff\xfb\0\0\0\"\0H\0i\0s\0t\0o\0r\0y\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\x1-\0\0\x1\x8f\0\0\0\x8c\0\xff\xff\xff\0\0\0\x1\0\0\x1,\0\0\x2\xa3\xfc\x2\0\0\0\x1\xfb\0\0\0\x1e\0\x46\0i\0l\0\x65\0s\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\0\x19\0\0\x2\xa3\0\0\0\x9d\0\xff\xff\xff\0\0\x2\x8d\0\0\x2\xa3\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0)"
+
+[MdiArea]
+geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\x1\x41\0\0\0\x19\0\0\x3\xcd\0\0\x2\xbb\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/kb-layouts/default.keytab	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,133 @@
+# [README.default.Keytab] Buildin Keyboard Table
+#
+# To customize your keyboard, copy this file to something
+# ending with .keytab and change it to meet you needs.
+# Please read the README.KeyTab and the README.keyboard
+# in this case.
+#
+# --------------------------------------------------------------
+
+keyboard "Default (XFree 4)"
+
+# --------------------------------------------------------------
+#
+# Note that this particular table is a "risc" version made to
+# ease customization without bothering with obsolete details.
+# See VT100.keytab for the more hairy stuff.
+#
+# --------------------------------------------------------------
+
+# common keys
+
+key Escape             : "\E"
+
+key Tab   -Shift       : "\t"
+key Tab   +Shift+Ansi  : "\E[Z"
+key Tab   +Shift-Ansi  : "\t"
+key Backtab     +Ansi  : "\E[Z"
+key Backtab     -Ansi  : "\t"
+
+key Return-Shift-NewLine : "\r"
+key Return-Shift+NewLine : "\r\n"
+
+key Return+Shift         : "\EOM"
+
+# Backspace and Delete codes are preserving CTRL-H.
+
+key Backspace      : "\x7f"
+
+# Arrow keys in VT52 mode
+# shift up/down are reserved for scrolling.
+# shift left/right are reserved for switching between tabs (this is hardcoded).
+
+key Up   -Shift-Ansi : "\EA"
+key Down -Shift-Ansi : "\EB"
+key Right-Shift-Ansi : "\EC"
+key Left -Shift-Ansi : "\ED"
+
+# Arrow keys in ANSI mode with Application - and Normal Cursor Mode)
+
+key Up    -Shift-AnyMod+Ansi+AppCuKeys           : "\EOA"
+key Down  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOB"
+key Right -Shift-AnyMod+Ansi+AppCuKeys           : "\EOC"
+key Left  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOD"
+
+key Up    -Shift-AnyMod+Ansi-AppCuKeys           : "\E[A"
+key Down  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[B"
+key Right -Shift-AnyMod+Ansi-AppCuKeys           : "\E[C"
+key Left  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[D"
+
+key Up    -Shift+AnyMod+Ansi                     : "\E[1;*A"
+key Down  -Shift+AnyMod+Ansi                     : "\E[1;*B"
+key Right -Shift+AnyMod+Ansi                     : "\E[1;*C"
+key Left  -Shift+AnyMod+Ansi                     : "\E[1;*D"
+
+# other grey PC keys
+
+key Enter+NewLine : "\r\n"
+key Enter-NewLine : "\r"
+
+key Home        -AnyMod     -AppCuKeys           : "\E[H"  
+key End         -AnyMod     -AppCuKeys           : "\E[F"  
+key Home        -AnyMod     +AppCuKeys           : "\EOH"  
+key End         -AnyMod     +AppCuKeys           : "\EOF"  
+key Home        +AnyMod                          : "\E[1;*H"
+key End         +AnyMod                          : "\E[1;*F"
+
+key Insert      -AnyMod                          : "\E[2~"
+key Delete      -AnyMod                          : "\E[3~"
+key Insert      +AnyMod                          : "\E[2;*~"
+key Delete      +AnyMod                          : "\E[3;*~"
+
+key Prior -Shift-AnyMod                          : "\E[5~"
+key Next  -Shift-AnyMod                          : "\E[6~"
+key Prior -Shift+AnyMod                          : "\E[5;*~"
+key Next  -Shift+AnyMod                          : "\E[6;*~"
+
+# Function keys
+key F1          -AnyMod                          : "\EOP"
+key F2          -AnyMod                          : "\EOQ"
+key F3          -AnyMod                          : "\EOR"
+key F4          -AnyMod                          : "\EOS"
+key F5          -AnyMod                          : "\E[15~"
+key F6          -AnyMod                          : "\E[17~"
+key F7          -AnyMod                          : "\E[18~"
+key F8          -AnyMod                          : "\E[19~"
+key F9          -AnyMod                          : "\E[20~"
+key F10         -AnyMod                          : "\E[21~"
+key F11         -AnyMod                          : "\E[23~"
+key F12         -AnyMod                          : "\E[24~"
+
+key F1          +AnyMod                          : "\EO*P"
+key F2          +AnyMod                          : "\EO*Q"
+key F3          +AnyMod                          : "\EO*R"
+key F4          +AnyMod                          : "\EO*S"
+key F5          +AnyMod                          : "\E[15;*~"
+key F6          +AnyMod                          : "\E[17;*~"
+key F7          +AnyMod                          : "\E[18;*~"
+key F8          +AnyMod                          : "\E[19;*~"
+key F9          +AnyMod                          : "\E[20;*~"
+key F10         +AnyMod                          : "\E[21;*~"
+key F11         +AnyMod                          : "\E[23;*~"
+key F12         +AnyMod                          : "\E[24;*~"
+
+# Work around dead keys
+
+key Space +Control : "\x00"
+
+# Some keys are used by konsole to cause operations.
+# The scroll* operations refer to the history buffer.
+
+key Up    +Shift-AppScreen  : scrollLineUp
+key Prior +Shift-AppScreen  : scrollPageUp
+key Down  +Shift-AppScreen  : scrollLineDown
+key Next  +Shift-AppScreen  : scrollPageDown
+
+#key Up    +Shift  : scrollLineUp
+#key Prior +Shift  : scrollPageUp
+#key Down  +Shift  : scrollLineDown
+#key Next  +Shift  : scrollPageDown
+
+key ScrollLock     : scrollLock
+
+# keypad characters are not offered differently by Qt.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/kb-layouts/linux.keytab	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,133 @@
+# [linux.keytab] Konsole Keyboard Table (Linux console keys)
+#
+# --------------------------------------------------------------
+
+# NOT TESTED, MAY NEED SOME CLEANUPS
+keyboard "Linux console"
+
+# --------------------------------------------------------------
+#
+# This configuration table allows to customize the
+# meaning of the keys.
+#
+# The syntax is that each entry has the form : 
+#
+#   "key" Keyname { ("+"|"-") Modename } ":" (String|Operation)
+#
+# Keynames are those defined in <qnamespace.h> with the
+# "Qt::Key_" removed. (We'd better insert the list here)
+#
+# Mode names are : 
+#
+# - Shift
+# - Alt
+# - Control
+#
+#   The VT100 emulation has two modes that can affect the
+#   sequences emitted by certain keys. These modes are
+#   under control of the client program.
+#   
+# - Newline     : effects Return and Enter key.
+# - Application : effects Up and Down key.
+#
+# - Ansi        : effects Up and Down key (This is for VT52, really).
+#
+# Operations are
+#
+# - scrollUpLine
+# - scrollUpPage
+# - scrollDownLine
+# - scrollDownPage
+#
+# - emitSelection
+#
+# If the key is not found here, the text of the
+# key event as provided by QT is emitted, possibly
+# preceeded by ESC if the Alt key is pressed.
+#
+# --------------------------------------------------------------
+
+key Escape : "\E"
+key Tab    : "\t"
+
+# VT100 can add an extra \n after return.
+# The NewLine mode is set by an escape sequence.
+
+key Return-NewLine : "\r"  
+key Return+NewLine : "\r\n"
+
+# Some desperately try to save the ^H.
+
+key Backspace : "\x7f"
+key Delete    : "\E[3~"
+
+# These codes are for the VT52 mode of VT100
+# The Ansi mode (i.e. VT100 mode) is set by
+# an escape sequence
+
+key Up   -Shift-Ansi : "\EA"
+key Down -Shift-Ansi : "\EB"
+key Right-Shift-Ansi : "\EC"
+key Left -Shift-Ansi : "\ED"
+
+# VT100 emits a mode bit together
+# with the arrow keys.The AppCuKeys
+# mode is set by an escape sequence.
+
+key Up   -Shift+Ansi+AppCuKeys : "\EOA"
+key Down -Shift+Ansi+AppCuKeys : "\EOB"
+key Right-Shift+Ansi+AppCuKeys : "\EOC"
+key Left -Shift+Ansi+AppCuKeys : "\EOD"
+
+key Up   -Shift+Ansi-AppCuKeys : "\E[A"
+key Down -Shift+Ansi-AppCuKeys : "\E[B"
+key Right-Shift+Ansi-AppCuKeys : "\E[C"
+key Left -Shift+Ansi-AppCuKeys : "\E[D"
+
+# linux functions keys F1-F5 differ from xterm
+
+key F1 : "\E[[A" 
+key F2 : "\E[[B" 
+key F3 : "\E[[C" 
+key F4 : "\E[[D" 
+key F5 : "\E[[E" 
+
+key F6     : "\E[17~" 
+key F7     : "\E[18~" 
+key F8     : "\E[19~" 
+key F9     : "\E[20~" 
+key F10    : "\E[21~" 
+key F11    : "\E[23~" 
+key F12    : "\E[24~" 
+
+key Home   : "\E[1~"  
+key End    : "\E[4~"  
+
+key Prior -Shift : "\E[5~"  
+key Next  -Shift : "\E[6~"  
+key Insert-Shift : "\E[2~"  
+
+# Keypad-Enter. See comment on Return above.
+
+key Enter+NewLine : "\r\n"
+key Enter-NewLine : "\r"  
+
+key Space +Control : "\x00"
+
+# some of keys are used by konsole.
+
+key Up    +Shift   : scrollLineUp
+key Prior +Shift   : scrollPageUp
+key Down  +Shift   : scrollLineDown
+key Next  +Shift   : scrollPageDown
+
+key ScrollLock     : scrollLock
+
+#----------------------------------------------------------
+
+# keypad characters as offered by Qt
+# cannot be recognized as such.
+
+#----------------------------------------------------------
+
+# Following other strings as emitted by konsole.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/kb-layouts/vt420pc.keytab	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,163 @@
+# [vt420pc.keytab] Konsole Keyboard Table (VT420pc keys)
+# adapted by ferdinand gassauer f.gassauer@aon.at
+# Nov 2000
+#
+################################################################
+#
+# The escape sequences emmited by the 
+# keys Shift+F1 to Shift+F12 might not fit your needs
+#
+################# IMPORTANT NOTICE #############################
+# the key bindings (Kcontrol -> look and feel -> keybindgs) 
+# overrule the settings in this file. The key bindings might be 
+# changed by the user WITHOUT notification of the maintainer of
+# the keytab file. Konsole will not work as expected by 
+# the maintainer of the keytab file.
+################################################################
+#
+# --------------------------------------------------------------
+
+keyboard "DEC VT420 Terminal"
+
+# --------------------------------------------------------------
+#
+# This configuration table allows to customize the
+# meaning of the keys.
+#
+# The syntax is that each entry has the form : 
+#
+#   "key" Keyname { ("+"|"-") Modename } ":" (String|Operation)
+#
+# Keynames are those defined in <qnamespace.h> with the
+# "Qt::Key_" removed. (We'd better insert the list here)
+#
+# Mode names are : 
+#
+# - Shift
+# - Alt
+# - Control
+#
+#   The VT100 emulation has two modes that can affect the
+#   sequences emitted by certain keys. These modes are
+#   under control of the client program.
+#   
+# - Newline     : effects Return and Enter key.
+# - Application : effects Up and Down key.
+#
+# - Ansi        : effects Up and Down key (This is for VT52, really).
+#
+# Operations are
+#
+# - scrollUpLine
+# - scrollUpPage
+# - scrollDownLine
+# - scrollDownPage
+#
+# - emitSelection
+#
+# If the key is not found here, the text of the
+# key event as provided by QT is emitted, possibly
+# preceeded by ESC if the Alt key is pressed.
+#
+# --------------------------------------------------------------
+
+key Escape : "\E"
+key Tab    : "\t"
+key Backtab: "\E[Z"
+
+# VT100 can add an extra \n after return.
+# The NewLine mode is set by an escape sequence.
+
+key Return-NewLine : "\r"  
+key Return+NewLine : "\r\n"
+
+# Some desperately try to save the ^H.
+# may be not everyone wants this
+
+key Backspace : "\x08"  # Control H
+key Delete    : "\x7f"
+
+# These codes are for the VT420pc
+# The Ansi mode (i.e. VT100 mode) is set by
+# an escape sequence
+
+key Up   -Shift-Ansi : "\EA"
+key Down -Shift-Ansi : "\EB"
+key Right-Shift-Ansi : "\EC"
+key Left -Shift-Ansi : "\ED"
+
+# VT100 emits a mode bit together
+# with the arrow keys.The AppCuKeys
+# mode is set by an escape sequence.
+
+key Up   -Shift+Ansi+AppCuKeys : "\EOA"
+key Down -Shift+Ansi+AppCuKeys : "\EOB"
+key Right-Shift+Ansi+AppCuKeys : "\EOC"
+key Left -Shift+Ansi+AppCuKeys : "\EOD"
+
+key Up   -Shift+Ansi-AppCuKeys : "\E[A"
+key Down -Shift+Ansi-AppCuKeys : "\E[B"
+key Right-Shift+Ansi-AppCuKeys : "\E[C"
+key Left -Shift+Ansi-AppCuKeys : "\E[D"
+
+# function keys 
+
+key F1 -Shift    : "\E[11~"  
+key F2 -Shift    : "\E[12~"
+key F3 -Shift    : "\E[13~"
+key F4 -Shift    : "\E[14~"
+key F5 -Shift    : "\E[15~"
+key F6 -Shift    : "\E[17~"
+key F7 -Shift    : "\E[18~"
+key F8 -Shift    : "\E[19~"
+key F9 -Shift    : "\E[20~"
+key F10-Shift    : "\E[21~"
+key F11-Shift    : "\E[23~"
+key F12-Shift    : "\E[24~"  
+#
+# Shift F1-F12
+#
+key F1 +Shift    : "\E[11;2~"
+key F2 +Shift    : "\E[12;2~"
+key F3 +Shift    : "\E[13;2~"
+key F4 +Shift    : "\E[14;2~"
+key F5 +Shift    : "\E[15;2~"
+key F6 +Shift    : "\E[17;2~" 
+key F7 +Shift    : "\E[18;2~" 
+key F8 +Shift    : "\E[19;2~" 
+key F9 +Shift    : "\E[20;2~" 
+key F10+Shift    : "\E[21;2~" 
+key F11+Shift    : "\E[23;2~" 
+key F12+Shift    : "\E[24;2~" 
+
+key Home   : "\E[H"  
+key End    : "\E[F"  
+
+key Prior -Shift : "\E[5~"  
+key Next  -Shift : "\E[6~"  
+key Insert-Shift : "\E[2~"  
+
+# Keypad-Enter. See comment on Return above.
+
+key Enter+NewLine : "\r\n"
+key Enter-NewLine : "\r"  
+
+key Space +Control : "\x00"
+
+# some of keys are used by konsole.
+
+key Up    +Shift   : scrollLineUp
+key Prior +Shift   : scrollPageUp
+key Down  +Shift   : scrollLineDown
+key Next  +Shift   : scrollPageDown
+
+key ScrollLock     : scrollLock
+
+#----------------------------------------------------------
+
+# keypad characters as offered by Qt
+# cannot be recognized as such.
+
+#----------------------------------------------------------
+
+# Following other strings as emitted by konsole.
Binary file gui/octave-gui/languages/de-de.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/languages/de-de.ts	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,642 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="de_DE">
+<context>
+    <name>FileEditorMdiSubWindow</name>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
+        <source>File Editor</source>
+        <translation>Dateieditor</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
+        <source>Cannot read file %1:
+%2.</source>
+        <translation>Konnte Datei %1 nicht lesen:
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
+        <source>File loaded.</source>
+        <translation>Datei geladen.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
+        <source>Do you want to save the current file
+%1 ?</source>
+        <translation>Möchten Sie die Datei %1 sichern ?</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
+        <source>Cannot write file %1:
+%2.</source>
+        <translation>Konnte Datei %1 nicht schreiben:
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
+        <source>File %1 saved</source>
+        <translation>Datei %1 gesichert</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
+        <source>&amp;Close File</source>
+        <translation>&amp;Datei schließen</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
+        <source>&amp;New File</source>
+        <translation>&amp;Neue Datei</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
+        <source>&amp;Open File</source>
+        <translation>&amp;Öffne Datei</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
+        <source>&amp;Save File</source>
+        <translation>&amp;Sichere Datei</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
+        <source>Save File &amp;As</source>
+        <translation>Sichere Datei &amp;als</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
+        <source>&amp;Undo</source>
+        <translation>&amp;RĂŒckgĂ€ngig</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
+        <source>&amp;Redo</source>
+        <translation>&amp;Wiederholen</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
+        <source>&amp;Copy</source>
+        <translation>&amp;Kopieren</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
+        <source>Cu&amp;t</source>
+        <translation>&amp;Ausschneiden</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
+        <source>&amp;Paste</source>
+        <translation>&amp;EinfĂŒgen</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
+        <source>&amp;Next Bookmark</source>
+        <translation>&amp;NĂ€chstes Bookmark</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
+        <source>Pre&amp;vious Bookmark</source>
+        <translation>&amp;Voriges Bookmark</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
+        <source>Toggle &amp;Bookmark</source>
+        <translation>&amp;Bookmark setzen</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
+        <source>&amp;Run File</source>
+        <translation>&amp;AusfĂŒhren</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
+        <source>&amp;File</source>
+        <translation>&amp;Datei</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
+        <source>&amp;Edit</source>
+        <translation>&amp;Editieren</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
+        <source>&amp;Run</source>
+        <translation>&amp;AusfĂŒhren</translation>
+    </message>
+</context>
+<context>
+    <name>FilesDockWidget</name>
+    <message>
+        <source>Current Folder</source>
+        <translation type="obsolete">Aktuelles Verzeichnis</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="32"/>
+        <source>Current Directory</source>
+        <translation>Aktuelles Verzeichnis</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="46"/>
+        <source>Move up one directory.</source>
+        <translation>Ein Verzeichnis höher wechseln.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="49"/>
+        <source>Enter the path or filename.</source>
+        <translation>Geben Sie einen Pfad oder Dateinamen ein.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="78"/>
+        <source>Doubleclick a file to open it.</source>
+        <translation>FĂŒhren Sie einen Doppelklick aus, um eine Datei zu öffnen.</translation>
+    </message>
+</context>
+<context>
+    <name>HistoryDockWidget</name>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
+        <source>Doubleclick a command to transfer it to the terminal.</source>
+        <translation>FĂŒhren Sie einen Doppelklick aus, um den Befehl in das Terminal zu ĂŒbertragen.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
+        <source>Enter text to filter the command history.</source>
+        <translation>Geben Sie Text ein, um die Befehlshistorie zu filtern.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
+        <source>Command History</source>
+        <translation>Befehlshistorie</translation>
+    </message>
+    <message>
+        <source>History updated.</source>
+        <translation type="obsolete">Befehlshistorie aktualisiert.</translation>
+    </message>
+</context>
+<context>
+    <name>LexerOctaveGui</name>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
+        <source>Default</source>
+        <translation>Standard</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
+        <source>Comment</source>
+        <translation>Kommentar</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
+        <source>Command</source>
+        <translation>Befehl</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
+        <source>Number</source>
+        <translation>Zahl</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
+        <source>Keyword</source>
+        <translation>SchlĂŒsselwort</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
+        <source>Single-quoted string</source>
+        <translation>Zeichenkette in einfachen Hochkommata</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
+        <source>Operator</source>
+        <translation>Operator</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
+        <source>Identifier</source>
+        <translation>Bezeichner</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
+        <source>Double-quoted string</source>
+        <translation>Zeichenkette in doppelten Hochkommata</translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="47"/>
+        <source>Opening file.</source>
+        <translation>Öffne Datei.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="124"/>
+        <source>Save Workspace</source>
+        <translation>Speichere Arbeitsumgebung</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="134"/>
+        <source>Load Workspace</source>
+        <translation>Lade Arbeitsumgebung</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="226"/>
+        <location filename="../src/MainWindow.cpp" line="362"/>
+        <source>About Octave</source>
+        <translation>Über Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="238"/>
+        <source>Saving data and shutting down.</source>
+        <translation>Speichere Daten und schließe.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="276"/>
+        <source>View the variables in the active workspace.</source>
+        <translation>Sehen Sie die Variablen ein, die sich in der aktiven Arbeitsumgebung befinden.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="278"/>
+        <source>Browse and search the command history.</source>
+        <translation>Durchsuchen Sie die Befehlshistorie.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="280"/>
+        <source>Browse your files.</source>
+        <translation>Durchsuchen Sie Ihre Dateien.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="294"/>
+        <source>Terminal</source>
+        <translation>Terminal</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="298"/>
+        <source>Enter your commands into the Octave terminal.</source>
+        <translation>Geben Sie Ihre Befehle in das Octave Terminal ein.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="311"/>
+        <source>Browse the Octave documentation for help.</source>
+        <translation>Durchsuchen Sie die Octave Dokumentation, um Hilfe zu erhalten.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="320"/>
+        <source>Chat</source>
+        <translation>Chat</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="323"/>
+        <source>Instantly chat with other Octave users for help.</source>
+        <translation>Tauschen Sie sich direkt mit anderen Octave Benutzern aus, um Hilfe zu erhalten.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="330"/>
+        <source>Octave</source>
+        <translation>Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="331"/>
+        <source>Settings</source>
+        <translation>Einstellungen</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="333"/>
+        <source>Exit</source>
+        <translation>Beenden</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="335"/>
+        <source>Interface</source>
+        <translation>OberflÀche</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="337"/>
+        <source>Align Windows</source>
+        <translation>Fenster ausrichten</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="339"/>
+        <location filename="../src/MainWindow.cpp" line="351"/>
+        <source>Workspace</source>
+        <translation>Arbeitsumgebung</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="342"/>
+        <source>History</source>
+        <translation>Befehlshistorie</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="345"/>
+        <source>File Browser</source>
+        <translation>Dateibrowser</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="349"/>
+        <source>Open New Editor Window</source>
+        <translation>Neues Editorfenster öffnen</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="352"/>
+        <source>Load</source>
+        <translation>Laden</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="353"/>
+        <source>Save</source>
+        <translation>Sichern</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="355"/>
+        <source>Clear</source>
+        <translation>Löschen</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="357"/>
+        <source>Community</source>
+        <translation>Gemeinschaft</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="358"/>
+        <source>Report Bug</source>
+        <translation>Fehler melden</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="359"/>
+        <source>Agora</source>
+        <translation>Agora</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="360"/>
+        <source>Octave Forge</source>
+        <translation>Octave Forge</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="363"/>
+        <source>About Qt</source>
+        <translation>Über Qt</translation>
+    </message>
+    <message>
+        <source>Octave Toolbar</source>
+        <translation type="obsolete">Octave Werkzeugleiste</translation>
+    </message>
+    <message>
+        <source>Command Window</source>
+        <translation type="obsolete">Konsolenfenster</translation>
+    </message>
+    <message>
+        <source>File Editor</source>
+        <translation type="obsolete">Dateieditor</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="307"/>
+        <source>Documentation</source>
+        <translation>Dokumentation</translation>
+    </message>
+    <message>
+        <source>Service</source>
+        <translation type="obsolete">Service</translation>
+    </message>
+    <message>
+        <source>Established link to Octave.</source>
+        <translation type="obsolete">Verbindung zu Octave hergestellt.</translation>
+    </message>
+</context>
+<context>
+    <name>NumberBar</name>
+    <message>
+        <source>Stop Here</source>
+        <translation type="obsolete">Stoppe hier</translation>
+    </message>
+    <message>
+        <source>Current Line</source>
+        <translation type="obsolete">Aktuelle Zeile</translation>
+    </message>
+    <message>
+        <source>Error Line</source>
+        <translation type="obsolete">Fehlerzeile</translation>
+    </message>
+</context>
+<context>
+    <name>NumberedCodeEdit</name>
+    <message>
+        <source>This file name is not valid.</source>
+        <translation type="obsolete">Dieser Dateiname ist nicht gĂŒltig.</translation>
+    </message>
+    <message>
+        <source>Octave doesn&apos;t understand this file name:
+</source>
+        <translation type="obsolete">Octave versteht diesen Dateityp nicht:</translation>
+    </message>
+    <message>
+        <source>
+Please, change it.
+ Do you want to save your changes?</source>
+        <translation type="obsolete">Bitte Ă€ndern Sie dies. Möchten Sie Ihre Änderungen sichern?</translation>
+    </message>
+</context>
+<context>
+    <name>SettingsDialog</name>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="29"/>
+        <source>Settings</source>
+        <translation>Einstellungen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="39"/>
+        <source>Chat</source>
+        <translation>Char</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="47"/>
+        <source>Connect to #octave on startup</source>
+        <translation>Beim Start mit #octave verbinden</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="57"/>
+        <source>Show message of the day</source>
+        <translation>Nachricht des Tages anzeigen (MOTD)</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="64"/>
+        <source>Show topic</source>
+        <translation>Thema des Chatkanals anzeigen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="71"/>
+        <source>Automatically identify on NickServ</source>
+        <translation>Automatisch bei NickServ identifizieren</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="78"/>
+        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
+        <translation>Warnung: Ihre Passwort wird unter ~/.octave-gui in einem menschenlesbaren Format gesichert. Hinterlegen Sie nicht Ihr Password, wenn Sie Bedenken ĂŒber die Sicherheit haben.</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="103"/>
+        <location filename="../src/SettingsDialog.ui" line="311"/>
+        <source>Password:</source>
+        <translation>Passwort:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="125"/>
+        <source>Editor</source>
+        <translation>Editor</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="133"/>
+        <source>Use custom file editor:</source>
+        <translation>Benutzerdefinierten Editor verwenden:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="143"/>
+        <source>emacs</source>
+        <translation>emacs</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="166"/>
+        <source>File Browser</source>
+        <translation>Dateibrowser</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="172"/>
+        <source>Show filenames</source>
+        <translation>Dateinamen anzeigen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="179"/>
+        <source>Show file size</source>
+        <translation>DateigrĂ¶ĂŸe anzeigen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="186"/>
+        <source>Show file type</source>
+        <translation>Dateityp anzeigen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="193"/>
+        <source>Show date of last modification</source>
+        <translation>Datum der letzten Änderung anzeigen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="200"/>
+        <source>Show hidden files</source>
+        <translation>Versteckte Dateien anzeigen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="207"/>
+        <source>Alternating row colors</source>
+        <translation>Alternierende Farben verwenden</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="215"/>
+        <source>Network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="221"/>
+        <source>Use proxy server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="233"/>
+        <source>Proxy Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="244"/>
+        <source>HttpProxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="249"/>
+        <source>Socks5Proxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="260"/>
+        <source>Hostname:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="277"/>
+        <source>Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="294"/>
+        <source>Username:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="339"/>
+        <source>Reset to defaults</source>
+        <translation>Standardeinstellungen wiederherstellen</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="362"/>
+        <source>Export</source>
+        <translation>Exportieren</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="372"/>
+        <source>Import</source>
+        <translation>Importieren</translation>
+    </message>
+</context>
+<context>
+    <name>VariablesDockWidget</name>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Name</source>
+        <translation>Bezeichner</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Type</source>
+        <translation>Typ</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Value</source>
+        <translation>Wert</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
+        <source>Workspace</source>
+        <translation>Arbeitsumgebung</translation>
+    </message>
+    <message>
+        <source>Save</source>
+        <translation type="obsolete">Sichern</translation>
+    </message>
+    <message>
+        <source>Load</source>
+        <translation type="obsolete">Laden</translation>
+    </message>
+    <message>
+        <source>Clear</source>
+        <translation type="obsolete">Löschen</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
+        <source>Local</source>
+        <translation>Lokal</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
+        <source>Global</source>
+        <translation>Global</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
+        <source>Persistent</source>
+        <translation>Persistent</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
+        <source>Hidden</source>
+        <translation>Versteckt</translation>
+    </message>
+</context>
+</TS>
Binary file gui/octave-gui/languages/es-es.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/languages/es-es.ts	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,576 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="es_MX">
+<context>
+    <name>FileEditorMdiSubWindow</name>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
+        <source>File Editor</source>
+        <translation>Editor de archivos</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
+        <source>Cannot read file %1:
+%2.</source>
+        <translation>No se puede leer archivo %1:
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
+        <source>File loaded.</source>
+        <translation>Archivo cargado.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
+        <source>Do you want to save the current file
+%1 ?</source>
+        <translation>ÂżDesea guardar archivo actual
+%1 ?</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
+        <source>Cannot write file %1:
+%2.</source>
+        <translation>No se puede escribir archivo %1:
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
+        <source>File %1 saved</source>
+        <translation>Archivo %1 guardado</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
+        <source>&amp;Close File</source>
+        <translation>&amp;Cerrar archivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
+        <source>&amp;New File</source>
+        <translation>Archivo &amp;nuevo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
+        <source>&amp;Open File</source>
+        <translation>&amp;Abrir archivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
+        <source>&amp;Save File</source>
+        <translation>&amp;Guardar archivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
+        <source>Save File &amp;As</source>
+        <translatorcomment>Search for proper shortcut for this command</translatorcomment>
+        <translation>Guardar archivo &amp;como</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
+        <source>&amp;Undo</source>
+        <translation>&amp;Deshacer</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
+        <source>&amp;Redo</source>
+        <translation>&amp;Rehacer</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
+        <source>&amp;Copy</source>
+        <translation>&amp;Copiar</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
+        <source>Cu&amp;t</source>
+        <translation>Cor&amp;tar</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
+        <source>&amp;Paste</source>
+        <translation>&amp;Pegar</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
+        <source>&amp;Next Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
+        <source>Pre&amp;vious Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
+        <source>Toggle &amp;Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
+        <source>&amp;Run File</source>
+        <translation>&amp;Ejecutar archivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
+        <source>&amp;File</source>
+        <translation>&amp;Archivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
+        <source>&amp;Edit</source>
+        <translation>&amp;Editar</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
+        <source>&amp;Run</source>
+        <translation>&amp;Ejecutar</translation>
+    </message>
+</context>
+<context>
+    <name>FilesDockWidget</name>
+    <message>
+        <source>Current Folder</source>
+        <translation type="obsolete">Carpeta actual</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="32"/>
+        <source>Current Directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="46"/>
+        <source>Move up one directory.</source>
+        <translation>Subir un directorio.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="49"/>
+        <source>Enter the path or filename.</source>
+        <translation>Introduzca direcciĂłn o nombre de archivo.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="78"/>
+        <source>Doubleclick a file to open it.</source>
+        <translation>Haga doble clic para abir archivo.</translation>
+    </message>
+</context>
+<context>
+    <name>HistoryDockWidget</name>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
+        <source>Doubleclick a command to transfer it to the terminal.</source>
+        <translation>Haga doble clic para transferir el comando a la terminal.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
+        <source>Enter text to filter the command history.</source>
+        <translation>Introduzca texto para filtrar el historial de comandos.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
+        <source>Command History</source>
+        <translation>Historial de comandos</translation>
+    </message>
+</context>
+<context>
+    <name>LexerOctaveGui</name>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
+        <source>Default</source>
+        <translation>Valores predeterminados</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
+        <source>Comment</source>
+        <translation>Comentario</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
+        <source>Command</source>
+        <translation>Comando</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
+        <source>Number</source>
+        <translation>NĂșmero</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
+        <source>Keyword</source>
+        <translation>Contraseña</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
+        <source>Single-quoted string</source>
+        <translation>Cadena entre comillas simples</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
+        <source>Operator</source>
+        <translation>Operador</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
+        <source>Identifier</source>
+        <translation>Identificador</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
+        <source>Double-quoted string</source>
+        <translation>Cadena entre comillas dobles</translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="47"/>
+        <source>Opening file.</source>
+        <translation>Abriendo archivo.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="124"/>
+        <source>Save Workspace</source>
+        <translation>Guardar espacio de trabajo</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="134"/>
+        <source>Load Workspace</source>
+        <translation>Cargar espacio de trabajo</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="226"/>
+        <location filename="../src/MainWindow.cpp" line="362"/>
+        <source>About Octave</source>
+        <translation>Acerca de Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="238"/>
+        <source>Saving data and shutting down.</source>
+        <translation>Guardando datos y cerrando el sistema.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="276"/>
+        <source>View the variables in the active workspace.</source>
+        <translation>Ver variables en el espacio de trabajo activo.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="278"/>
+        <source>Browse and search the command history.</source>
+        <translation>Navegar y buscar en el historial de comandos.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="280"/>
+        <source>Browse your files.</source>
+        <translation>Explorar sus archivos.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="294"/>
+        <source>Terminal</source>
+        <translation>Terminal</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="298"/>
+        <source>Enter your commands into the Octave terminal.</source>
+        <translation>Introducir su comando a la terminal de Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="307"/>
+        <source>Documentation</source>
+        <translation>DocumentaciĂłn</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="311"/>
+        <source>Browse the Octave documentation for help.</source>
+        <translation>Consultar la documentaciĂłn de Octave para obtener ayuda.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="320"/>
+        <source>Chat</source>
+        <translation>Chat/conversaciĂłn instantanea</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="323"/>
+        <source>Instantly chat with other Octave users for help.</source>
+        <translation>CoversaciĂłn instantanea con otros usuarios de octave para obtener ayuda.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="330"/>
+        <source>Octave</source>
+        <translation>Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="331"/>
+        <source>Settings</source>
+        <translation>ConfiguraciĂłn</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="333"/>
+        <source>Exit</source>
+        <translation>Salir</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="335"/>
+        <source>Interface</source>
+        <translation>Interfase</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="337"/>
+        <source>Align Windows</source>
+        <translation>Alinear ventanas</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="339"/>
+        <location filename="../src/MainWindow.cpp" line="351"/>
+        <source>Workspace</source>
+        <translation>Espacio de trabajo</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="342"/>
+        <source>History</source>
+        <translation>Historial</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="345"/>
+        <source>File Browser</source>
+        <translation>Explorador de archivos</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="349"/>
+        <source>Open New Editor Window</source>
+        <translation>Abrir nueva ventana de editor</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="352"/>
+        <source>Load</source>
+        <translation>Cargar</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="353"/>
+        <source>Save</source>
+        <translation>Guardar</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="355"/>
+        <source>Clear</source>
+        <translation>Limpiar</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="357"/>
+        <source>Community</source>
+        <translation>Comunidad</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="358"/>
+        <source>Report Bug</source>
+        <translation>Reportar error de software/Bug</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="359"/>
+        <source>Agora</source>
+        <translation>Ágora</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="360"/>
+        <source>Octave Forge</source>
+        <translation>Octave Forge</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="363"/>
+        <source>About Qt</source>
+        <translation>Acerca de Qt</translation>
+    </message>
+</context>
+<context>
+    <name>SettingsDialog</name>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="29"/>
+        <source>Settings</source>
+        <translation>ConfiguraciĂłn</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="39"/>
+        <source>Chat</source>
+        <translation>Chat/conversaciĂłn instantanea</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="47"/>
+        <source>Connect to #octave on startup</source>
+        <translation>Conectar a #octave en el arranque</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="57"/>
+        <source>Show message of the day</source>
+        <translation>Mostrar mensaje del dĂ­a</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="64"/>
+        <source>Show topic</source>
+        <translation>Mostrar tema</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="71"/>
+        <source>Automatically identify on NickServ</source>
+        <translation>Identificar automĂĄticamente el NickServ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="78"/>
+        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
+        <translatorcomment>Advertencia: La contraseña se guarda en ~ / octavegui en formato legible. No introduzca su contraseña en caso de que le preocupen los aspectos de seguridad.</translatorcomment>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="103"/>
+        <location filename="../src/SettingsDialog.ui" line="311"/>
+        <source>Password:</source>
+        <translation>Contraseña:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="125"/>
+        <source>Editor</source>
+        <translation>Editor</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="133"/>
+        <source>Use custom file editor:</source>
+        <translation>Usar editor de archivos personalizados:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="143"/>
+        <source>emacs</source>
+        <translation>emacs</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="166"/>
+        <source>File Browser</source>
+        <translation>Explorador de archivos</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="172"/>
+        <source>Show filenames</source>
+        <translation>Mostrar nombres de archivos</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="179"/>
+        <source>Show file size</source>
+        <translation>Mostrar tamaño de archivo</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="186"/>
+        <source>Show file type</source>
+        <translation>Mostrar tipo de archivo</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="193"/>
+        <source>Show date of last modification</source>
+        <translation>Mostrar fecha de la Ășltima modificaciĂłn</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="200"/>
+        <source>Show hidden files</source>
+        <translation>Mostrar archivos ocultos</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="207"/>
+        <source>Alternating row colors</source>
+        <translation>Colores alternos de filas</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="215"/>
+        <source>Network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="221"/>
+        <source>Use proxy server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="233"/>
+        <source>Proxy Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="244"/>
+        <source>HttpProxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="249"/>
+        <source>Socks5Proxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="260"/>
+        <source>Hostname:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="277"/>
+        <source>Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="294"/>
+        <source>Username:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="339"/>
+        <source>Reset to defaults</source>
+        <translation>Restaurar los valores predeterminados</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="362"/>
+        <source>Export</source>
+        <translation>Exportar</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="372"/>
+        <source>Import</source>
+        <translation>Importar</translation>
+    </message>
+</context>
+<context>
+    <name>VariablesDockWidget</name>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
+        <source>Workspace</source>
+        <translation>Espacio de trabajo</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Name</source>
+        <translation>Nombre</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Type</source>
+        <translation>Tipo</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Value</source>
+        <translation>Valor</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
+        <source>Local</source>
+        <translation>Local</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
+        <source>Global</source>
+        <translation>Global</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
+        <source>Persistent</source>
+        <translation>Persistente</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
+        <source>Hidden</source>
+        <translation>Oculto</translation>
+    </message>
+</context>
+</TS>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/languages/generic.qm	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+<ždÊÍ!ż`ĄœĘ
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/languages/generic.ts	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,567 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+    <name>FileEditorMdiSubWindow</name>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
+        <source>File Editor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
+        <source>Cannot read file %1:
+%2.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
+        <source>File loaded.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
+        <source>Do you want to save the current file
+%1 ?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
+        <source>Cannot write file %1:
+%2.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
+        <source>File %1 saved</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
+        <source>&amp;Close File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
+        <source>&amp;New File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
+        <source>&amp;Open File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
+        <source>&amp;Save File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
+        <source>Save File &amp;As</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
+        <source>&amp;Undo</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
+        <source>&amp;Redo</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
+        <source>&amp;Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
+        <source>Cu&amp;t</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
+        <source>&amp;Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
+        <source>&amp;Next Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
+        <source>Pre&amp;vious Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
+        <source>Toggle &amp;Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
+        <source>&amp;Run File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
+        <source>&amp;File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
+        <source>&amp;Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
+        <source>&amp;Run</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>FilesDockWidget</name>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="32"/>
+        <source>Current Directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="46"/>
+        <source>Move up one directory.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="49"/>
+        <source>Enter the path or filename.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="78"/>
+        <source>Doubleclick a file to open it.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>HistoryDockWidget</name>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
+        <source>Doubleclick a command to transfer it to the terminal.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
+        <source>Enter text to filter the command history.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
+        <source>Command History</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>LexerOctaveGui</name>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
+        <source>Default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
+        <source>Comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
+        <source>Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
+        <source>Keyword</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
+        <source>Single-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
+        <source>Operator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
+        <source>Identifier</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
+        <source>Double-quoted string</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="47"/>
+        <source>Opening file.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="124"/>
+        <source>Save Workspace</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="134"/>
+        <source>Load Workspace</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="226"/>
+        <location filename="../src/MainWindow.cpp" line="362"/>
+        <source>About Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="238"/>
+        <source>Saving data and shutting down.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="276"/>
+        <source>View the variables in the active workspace.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="278"/>
+        <source>Browse and search the command history.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="280"/>
+        <source>Browse your files.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="294"/>
+        <source>Terminal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="298"/>
+        <source>Enter your commands into the Octave terminal.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="307"/>
+        <source>Documentation</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="311"/>
+        <source>Browse the Octave documentation for help.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="320"/>
+        <source>Chat</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="323"/>
+        <source>Instantly chat with other Octave users for help.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="330"/>
+        <source>Octave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="331"/>
+        <source>Settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="333"/>
+        <source>Exit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="335"/>
+        <source>Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="337"/>
+        <source>Align Windows</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="339"/>
+        <location filename="../src/MainWindow.cpp" line="351"/>
+        <source>Workspace</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="342"/>
+        <source>History</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="345"/>
+        <source>File Browser</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="349"/>
+        <source>Open New Editor Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="352"/>
+        <source>Load</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="353"/>
+        <source>Save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="355"/>
+        <source>Clear</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="357"/>
+        <source>Community</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="358"/>
+        <source>Report Bug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="359"/>
+        <source>Agora</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="360"/>
+        <source>Octave Forge</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="363"/>
+        <source>About Qt</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>SettingsDialog</name>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="29"/>
+        <source>Settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="39"/>
+        <source>Chat</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="47"/>
+        <source>Connect to #octave on startup</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="57"/>
+        <source>Show message of the day</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="64"/>
+        <source>Show topic</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="71"/>
+        <source>Automatically identify on NickServ</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="78"/>
+        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="103"/>
+        <location filename="../src/SettingsDialog.ui" line="311"/>
+        <source>Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="125"/>
+        <source>Editor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="133"/>
+        <source>Use custom file editor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="143"/>
+        <source>emacs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="166"/>
+        <source>File Browser</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="172"/>
+        <source>Show filenames</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="179"/>
+        <source>Show file size</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="186"/>
+        <source>Show file type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="193"/>
+        <source>Show date of last modification</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="200"/>
+        <source>Show hidden files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="207"/>
+        <source>Alternating row colors</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="215"/>
+        <source>Network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="221"/>
+        <source>Use proxy server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="233"/>
+        <source>Proxy Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="244"/>
+        <source>HttpProxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="249"/>
+        <source>Socks5Proxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="260"/>
+        <source>Hostname:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="277"/>
+        <source>Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="294"/>
+        <source>Username:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="339"/>
+        <source>Reset to defaults</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="362"/>
+        <source>Export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="372"/>
+        <source>Import</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>VariablesDockWidget</name>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
+        <source>Workspace</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Value</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
+        <source>Local</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
+        <source>Global</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
+        <source>Persistent</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
+        <source>Hidden</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+</TS>
Binary file gui/octave-gui/languages/pt-br.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/languages/pt-br.ts	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,571 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="pt_BR" sourcelanguage="en">
+<context>
+    <name>FileEditorMdiSubWindow</name>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
+        <source>File Editor</source>
+        <translation>Editor de Arquivos</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
+        <source>Cannot read file %1:
+%2.</source>
+        <translation>NĂŁo foi possĂ­vel ler o arquivo %1: %2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
+        <source>File loaded.</source>
+        <translation>Arquivo carregado.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
+        <source>Do you want to save the current file
+%1 ?</source>
+        <translation>VocĂȘ deseja salvar o arquivo atual %1 ?</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
+        <source>Cannot write file %1:
+%2.</source>
+        <translation>NĂŁo foi possĂ­vel escrever no arquivo %1: %2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
+        <source>File %1 saved</source>
+        <translation>Arquivo %1 salvo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
+        <source>&amp;Close File</source>
+        <translation>&amp;Fechar Arquivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
+        <source>&amp;New File</source>
+        <translation>&amp;Novo Arquivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
+        <source>&amp;Open File</source>
+        <translation>&amp;Abrir Arquivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
+        <source>&amp;Save File</source>
+        <translation>&amp;Salvar Arquivo</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
+        <source>Save File &amp;As</source>
+        <translation>Salvar Arquivo &amp;Como</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
+        <source>&amp;Undo</source>
+        <translation>&amp;Desfazer</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
+        <source>&amp;Redo</source>
+        <translation>&amp;Refazer</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
+        <source>&amp;Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
+        <source>Cu&amp;t</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
+        <source>&amp;Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
+        <source>&amp;Next Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
+        <source>Pre&amp;vious Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
+        <source>Toggle &amp;Bookmark</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
+        <source>&amp;Run File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
+        <source>&amp;File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
+        <source>&amp;Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
+        <source>&amp;Run</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>FilesDockWidget</name>
+    <message>
+        <source>Current Folder</source>
+        <translation type="obsolete">DiretĂłrio Atual</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="32"/>
+        <source>Current Directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="46"/>
+        <source>Move up one directory.</source>
+        <translation>Subir um diretĂłrio.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="49"/>
+        <source>Enter the path or filename.</source>
+        <translation>Digite o caminho ou o nome do arquivo.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="78"/>
+        <source>Doubleclick a file to open it.</source>
+        <translation>Clique duas vezes num arquivo para abrĂ­-lo.</translation>
+    </message>
+</context>
+<context>
+    <name>HistoryDockWidget</name>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
+        <source>Doubleclick a command to transfer it to the terminal.</source>
+        <translation>Clique duas vezes num comando para transferĂ­-lo ao terminal.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
+        <source>Enter text to filter the command history.</source>
+        <translation>Digite um texto para filtrar o hitĂłrico de comandos.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
+        <source>Command History</source>
+        <translation>HistĂłrico de Comandos</translation>
+    </message>
+</context>
+<context>
+    <name>LexerOctaveGui</name>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
+        <source>Default</source>
+        <translation>PadrĂŁo</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
+        <source>Comment</source>
+        <translation>ComentĂĄrio</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
+        <source>Command</source>
+        <translation>Comando</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
+        <source>Number</source>
+        <translation>NĂșmero</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
+        <source>Keyword</source>
+        <translation>Palavra-Chave</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
+        <source>Single-quoted string</source>
+        <translation>String com aspas simples</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
+        <source>Operator</source>
+        <translation>Operador</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
+        <source>Identifier</source>
+        <translation>Identificador</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
+        <source>Double-quoted string</source>
+        <translation>String com aspas duplas</translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="47"/>
+        <source>Opening file.</source>
+        <translation>Abrindo arquivo.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="124"/>
+        <source>Save Workspace</source>
+        <translation>Salvar ambiente de trabalho</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="134"/>
+        <source>Load Workspace</source>
+        <translation>Carregar ambiente de trabalho</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="226"/>
+        <location filename="../src/MainWindow.cpp" line="362"/>
+        <source>About Octave</source>
+        <translation>Sobre o Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="238"/>
+        <source>Saving data and shutting down.</source>
+        <translation>Salvando dados e encerrando a sessĂŁo.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="276"/>
+        <source>View the variables in the active workspace.</source>
+        <translation>Visualizar variĂĄveis no ambiente de trabalho.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="278"/>
+        <source>Browse and search the command history.</source>
+        <translation>Pesquise no histĂłrico de comandos.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="280"/>
+        <source>Browse your files.</source>
+        <translation>Procure seus arquivos.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="294"/>
+        <source>Terminal</source>
+        <translation>Terminal</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="298"/>
+        <source>Enter your commands into the Octave terminal.</source>
+        <translation>Digite seus comandos no terminal do Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="307"/>
+        <source>Documentation</source>
+        <translation>Documentação</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="311"/>
+        <source>Browse the Octave documentation for help.</source>
+        <translation>Procure na documentação do Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="320"/>
+        <source>Chat</source>
+        <translation>Chat</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="323"/>
+        <source>Instantly chat with other Octave users for help.</source>
+        <translation>Converse instantaneamente com outros usuĂĄrios do Octave para pedir ajuda.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="330"/>
+        <source>Octave</source>
+        <translation>Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="331"/>
+        <source>Settings</source>
+        <translation>ConfiguraçÔes</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="333"/>
+        <source>Exit</source>
+        <translation>Sair</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="335"/>
+        <source>Interface</source>
+        <translation>Interface</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="337"/>
+        <source>Align Windows</source>
+        <translation>Alinhar Janelas</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="339"/>
+        <location filename="../src/MainWindow.cpp" line="351"/>
+        <source>Workspace</source>
+        <translation>Ambiente de trabalho</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="342"/>
+        <source>History</source>
+        <translation>HistĂłrico</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="345"/>
+        <source>File Browser</source>
+        <translation>Navegador de Arquivos</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="349"/>
+        <source>Open New Editor Window</source>
+        <translation>Abrir nova janela de edição</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="352"/>
+        <source>Load</source>
+        <translation>Carregar</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="353"/>
+        <source>Save</source>
+        <translation>Salvar</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="355"/>
+        <source>Clear</source>
+        <translation>Limpar</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="357"/>
+        <source>Community</source>
+        <translation>Comunidade</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="358"/>
+        <source>Report Bug</source>
+        <translation>Reportar Bug</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="359"/>
+        <source>Agora</source>
+        <translation>Agora</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="360"/>
+        <source>Octave Forge</source>
+        <translation>Octave Forge</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="363"/>
+        <source>About Qt</source>
+        <translation>Sobre o Qt</translation>
+    </message>
+</context>
+<context>
+    <name>SettingsDialog</name>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="29"/>
+        <source>Settings</source>
+        <translation>ConfiguraçÔes</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="39"/>
+        <source>Chat</source>
+        <translation>Chat</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="47"/>
+        <source>Connect to #octave on startup</source>
+        <translation>Conectar ao #octave ao iniciar</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="57"/>
+        <source>Show message of the day</source>
+        <translation>Mostrar mensagem do dia</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="64"/>
+        <source>Show topic</source>
+        <translation>Mostrar tĂłpico</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="71"/>
+        <source>Automatically identify on NickServ</source>
+        <translation>Identificar-se automaticamente com o NickServ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="78"/>
+        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
+        <translation>Aviso: Sua senha serĂĄ salva em ~/.octavegui em um formato legĂ­vel. NĂŁo digite sua senha se vocĂȘ tem problemas com segurança.</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="103"/>
+        <location filename="../src/SettingsDialog.ui" line="311"/>
+        <source>Password:</source>
+        <translation>Senha:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="125"/>
+        <source>Editor</source>
+        <translation>Editor</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="133"/>
+        <source>Use custom file editor:</source>
+        <translation>Usar editor de arquivos personalizado:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="143"/>
+        <source>emacs</source>
+        <translation>emacs</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="166"/>
+        <source>File Browser</source>
+        <translation>Navegador de Arquivos</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="172"/>
+        <source>Show filenames</source>
+        <translation>Mostrar nomes de arquivo</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="179"/>
+        <source>Show file size</source>
+        <translation>Mostrar tamanho do arquivo</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="186"/>
+        <source>Show file type</source>
+        <translation>Mostrar tipo do arquivo</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="193"/>
+        <source>Show date of last modification</source>
+        <translation>Mostrar data de Ășltima modificação</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="200"/>
+        <source>Show hidden files</source>
+        <translation>Mostrar arquivos ocultos</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="207"/>
+        <source>Alternating row colors</source>
+        <translation>Alternar cores das linhas</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="215"/>
+        <source>Network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="221"/>
+        <source>Use proxy server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="233"/>
+        <source>Proxy Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="244"/>
+        <source>HttpProxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="249"/>
+        <source>Socks5Proxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="260"/>
+        <source>Hostname:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="277"/>
+        <source>Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="294"/>
+        <source>Username:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="339"/>
+        <source>Reset to defaults</source>
+        <translation>Resetar ao padrĂŁo</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="362"/>
+        <source>Export</source>
+        <translation>Exportar</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="372"/>
+        <source>Import</source>
+        <translation>Importar</translation>
+    </message>
+</context>
+<context>
+    <name>VariablesDockWidget</name>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
+        <source>Workspace</source>
+        <translation>Ambiente de trabalho</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Name</source>
+        <translation>Nome</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Type</source>
+        <translation>Tipo</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Value</source>
+        <translation>Valor</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
+        <source>Local</source>
+        <translation>Local</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
+        <source>Global</source>
+        <translation>Global</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
+        <source>Persistent</source>
+        <translation>Persistente</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
+        <source>Hidden</source>
+        <translation>Oculto</translation>
+    </message>
+</context>
+</TS>
Binary file gui/octave-gui/languages/ru-ru.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/languages/ru-ru.ts	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,574 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="ru_RU">
+<context>
+    <name>FileEditorMdiSubWindow</name>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
+        <source>File Editor</source>
+        <translation>РДЎаĐșŃ‚ĐŸŃ€ фаĐčĐ»ĐŸĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
+        <source>Cannot read file %1:
+%2.</source>
+        <translation>ĐĐ” ŃƒĐŽĐ°Đ»ĐŸŃŃŒ ĐżŃ€ĐŸŃ‡ĐžŃ‚Đ°Ń‚ŃŒ фаĐčĐ» %1:
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
+        <source>File loaded.</source>
+        <translation>ЀаĐčĐ» Đ·Đ°ĐłŃ€ŃƒĐ¶Đ”Đœ.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
+        <source>Do you want to save the current file
+%1 ?</source>
+        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ Ń‚Đ”ĐșущоĐč фаĐčĐ»
+%1?</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
+        <source>Cannot write file %1:
+%2.</source>
+        <translation>ĐĐ” ŃƒĐŽĐ°Đ»ĐŸŃŃŒ ŃĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ фаĐčĐ» %1:
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
+        <source>File %1 saved</source>
+        <translation>ЀаĐčĐ» %1 ŃĐŸŃ…Ń€Đ°ĐœŃ‘Đœ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
+        <source>&amp;Close File</source>
+        <translation>&amp;ЗаĐșрыть</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
+        <source>&amp;New File</source>
+        <translation>ĐĄĐŸĐ·ĐŽ&amp;ать</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
+        <source>&amp;Open File</source>
+        <translation>&amp;ОтĐșрыть</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
+        <source>&amp;Save File</source>
+        <translation>&amp;ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
+        <source>Save File &amp;As</source>
+        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ &amp;ĐșĐ°Đș</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
+        <source>&amp;Undo</source>
+        <translation>О&amp;Ń‚ĐŒĐ”ĐœĐžŃ‚ŃŒ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
+        <source>&amp;Redo</source>
+        <translation>&amp;ĐŸĐŸĐČŃ‚ĐŸŃ€ĐžŃ‚ŃŒ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
+        <source>&amp;Copy</source>
+        <translation>&amp;ĐšĐŸĐżĐžŃ€ĐŸĐČать</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
+        <source>Cu&amp;t</source>
+        <translation>Вы&amp;Ń€Đ”Đ·Đ°Ń‚ŃŒ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
+        <source>&amp;Paste</source>
+        <translation>&amp;ВстаĐČоть</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
+        <source>&amp;Next Bookmark</source>
+        <translation>ĐĄ&amp;Đ»Đ”ĐŽŃƒŃŽŃ‰Đ°Ń Đ·Đ°ĐșлаЎĐșĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
+        <source>Pre&amp;vious Bookmark</source>
+        <translation>Пр&amp;Đ”ĐŽŃ‹ĐŽŃƒŃ‰Đ°Ń Đ·Đ°ĐșлаЎĐșĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
+        <source>Toggle &amp;Bookmark</source>
+        <translation>&amp;ĐŁŃŃ‚Đ°ĐœĐŸĐČоть/ŃĐœŃŃ‚ŃŒ Đ·Đ°ĐșлаЎĐșу</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
+        <source>&amp;Run File</source>
+        <translation>&amp;Запустоть фаĐčĐ»</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
+        <source>&amp;File</source>
+        <translation>&amp;ЀаĐčĐ»</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
+        <source>&amp;Edit</source>
+        <translation>&amp;ПраĐČĐșĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
+        <source>&amp;Run</source>
+        <translation>&amp;ЗапусĐș</translation>
+    </message>
+</context>
+<context>
+    <name>FilesDockWidget</name>
+    <message>
+        <source>Current Folder</source>
+        <translation type="obsolete">йДĐșущоĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="32"/>
+        <source>Current Directory</source>
+        <translation>йДĐșущоĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="46"/>
+        <source>Move up one directory.</source>
+        <translation>ĐŸĐ”Ń€Đ”Đčто ĐœĐ° ŃƒŃ€ĐŸĐČĐ”ĐœŃŒ ĐČŃ‹ŃˆĐ”.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="49"/>
+        <source>Enter the path or filename.</source>
+        <translation>ВĐČДЎОтД путь ОлО ĐžĐŒŃ фаĐčла.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="78"/>
+        <source>Doubleclick a file to open it.</source>
+        <translation>ДĐČĐŸĐčĐœĐŸĐč Ń‰Đ”Đ»Ń‡ĐŸĐș ĐżĐŸ фаĐčлу ĐŸŃ‚ĐșŃ€ĐŸĐ”Ń‚ Đ”ĐłĐŸ.</translation>
+    </message>
+</context>
+<context>
+    <name>HistoryDockWidget</name>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
+        <source>Doubleclick a command to transfer it to the terminal.</source>
+        <translation>ДĐČĐŸĐčĐœĐŸĐč Ń‰Đ”Đ»Ń‡ĐŸĐș ĐżĐŸ ĐșĐŸĐŒĐ°ĐœĐŽĐ” ĐżĐ”Ń€Đ”ĐœĐ”ŃŃ‘Ń‚ Дё ĐČ ĐșĐŸĐŒĐ°ĐœĐŽĐœŃƒŃŽ ŃŃ‚Ń€ĐŸĐșу.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
+        <source>Enter text to filter the command history.</source>
+        <translation>ВĐČДЎОтД Ń‚Đ”Đșст ĐŽĐ»Ń Ń„ĐžĐ»ŃŒŃ‚Ń€Đ°Ń†ĐžĐž ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
+        <source>Command History</source>
+        <translation>Đ–ŃƒŃ€ĐœĐ°Đ» ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
+    </message>
+</context>
+<context>
+    <name>LexerOctaveGui</name>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
+        <source>Default</source>
+        <translation>ĐŸĐŸ ŃƒĐŒĐŸĐ»Ń‡Đ°ĐœĐžŃŽ</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
+        <source>Comment</source>
+        <translation>ĐšĐŸĐŒĐŒĐ”ĐœŃ‚Đ°Ń€ĐžĐč</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
+        <source>Command</source>
+        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
+        <source>Number</source>
+        <translation>Đ§ĐžŃĐ»ĐŸ</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
+        <source>Keyword</source>
+        <translation>ЗарДзДрĐČĐžŃ€ĐŸĐČĐ°ĐœĐœĐŸĐ” ŃĐ»ĐŸĐČĐŸ</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
+        <source>Single-quoted string</source>
+        <translation>ĐĄŃ‚Ń€ĐŸĐșĐ° ĐČ ĐŸĐŽĐžĐœĐ°Ń€ĐœŃ‹Ń… ĐșĐ°ĐČычĐșах</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
+        <source>Operator</source>
+        <translation>ĐžĐżĐ”Ń€Đ°Ń‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
+        <source>Identifier</source>
+        <translation>Đ˜ĐŽĐ”ĐœŃ‚ĐžŃ„ĐžĐșĐ°Ń‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
+        <source>Double-quoted string</source>
+        <translation>ĐĄŃ‚Ń€ĐŸĐșĐ° ĐČ ĐŽĐČĐŸĐčĐœŃ‹Ń… ĐșĐ°ĐČычĐșах</translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="47"/>
+        <source>Opening file.</source>
+        <translation>ОтĐșрыĐČĐ°Đ”Ń‚ŃŃ фаĐčĐ».</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="124"/>
+        <source>Save Workspace</source>
+        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="134"/>
+        <source>Load Workspace</source>
+        <translation>Đ—Đ°ĐłŃ€ŃƒĐ·ĐžŃ‚ŃŒ ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="226"/>
+        <location filename="../src/MainWindow.cpp" line="362"/>
+        <source>About Octave</source>
+        <translation>Об Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="238"/>
+        <source>Saving data and shutting down.</source>
+        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ Đž Đ·Đ°ĐČĐ”Ń€ŃˆĐžŃ‚ŃŒ Ń€Đ°Đ±ĐŸŃ‚Ńƒ.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="276"/>
+        <source>View the variables in the active workspace.</source>
+        <translation>ĐŸŃ€ĐŸŃĐŒĐŸŃ‚Ń€ ŃĐŸĐŽĐ”Ń€Đ¶ĐžĐŒĐŸĐłĐŸ Ń‚Đ”ĐșŃƒŃ‰Đ”Đč ĐŸĐ±Đ»Đ°ŃŃ‚Đž ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń….</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="278"/>
+        <source>Browse and search the command history.</source>
+        <translation>ĐŸŃ€ĐŸŃĐŒĐŸŃ‚Ń€ Đž ĐżĐŸĐžŃĐș ĐČ Đ¶ŃƒŃ€ĐœĐ°Đ»Đ” ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="280"/>
+        <source>Browse your files.</source>
+        <translation>ĐŸŃ€ĐŸŃĐŒĐŸŃ‚Ń€ фаĐčĐ»ĐŸĐČ.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="294"/>
+        <source>Terminal</source>
+        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐœĐ°Ń ŃŃ‚Ń€ĐŸĐșĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="298"/>
+        <source>Enter your commands into the Octave terminal.</source>
+        <translation>ВĐČДЎОтД ĐșĐŸĐŒĐ°ĐœĐŽŃ‹ ĐČ ĐșĐŸĐŒĐ°ĐœĐŽĐœĐŸĐč ŃŃ‚Ń€ĐŸĐșĐ” Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="307"/>
+        <source>Documentation</source>
+        <translation>Đ”ĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†ĐžŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="311"/>
+        <source>Browse the Octave documentation for help.</source>
+        <translation>ОтĐșрыть ĐŽĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†ĐžŃŽ ĐżĐŸ Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="320"/>
+        <source>Chat</source>
+        <translation>Чат</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="323"/>
+        <source>Instantly chat with other Octave users for help.</source>
+        <translation>Чат с ĐżĐŸĐ»ŃŒĐ·ĐŸĐČĐ°Ń‚Đ”Đ»ŃĐŒĐž Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="330"/>
+        <source>Octave</source>
+        <translation>Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="331"/>
+        <source>Settings</source>
+        <translation>ĐŸĐ°Ń€Đ°ĐŒĐ”Ń‚Ń€Ń‹</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="333"/>
+        <source>Exit</source>
+        <translation>Đ’Ń‹Ń…ĐŸĐŽ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="335"/>
+        <source>Interface</source>
+        <translation>Đ˜ĐœŃ‚Đ”Ń€Ń„Đ”Đčс</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="337"/>
+        <source>Align Windows</source>
+        <translation>Đ’Ń‹Ń€ĐŸĐČĐœŃŃ‚ŃŒ ĐŸĐșĐœĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="339"/>
+        <location filename="../src/MainWindow.cpp" line="351"/>
+        <source>Workspace</source>
+        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="342"/>
+        <source>History</source>
+        <translation>Đ–ŃƒŃ€ĐœĐ°Đ» ĐČŃ‹ĐżĐŸĐ»ĐœĐ”ĐœĐœŃ‹Ń… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="345"/>
+        <source>File Browser</source>
+        <translation>ЀаĐčĐ»ĐŸĐČыĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="349"/>
+        <source>Open New Editor Window</source>
+        <translation>ОтĐșрыть ĐœĐŸĐČĐŸĐ” ĐŸĐșĐœĐŸ рДЎаĐșŃ‚ĐŸŃ€Đ°</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="352"/>
+        <source>Load</source>
+        <translation>Đ—Đ°ĐłŃ€ŃƒĐ·ĐžŃ‚ŃŒ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="353"/>
+        <source>Save</source>
+        <translation>ĐĄĐŸŃ…Ń€Đ°ĐœĐžŃ‚ŃŒ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="355"/>
+        <source>Clear</source>
+        <translation>Очостоть</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="357"/>
+        <source>Community</source>
+        <translation>ĐĄĐŸĐŸĐ±Ń‰Đ”ŃŃ‚ĐČĐŸ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="358"/>
+        <source>Report Bug</source>
+        <translation>ĐĄĐŸĐŸĐ±Ń‰ĐžŃ‚ŃŒ ĐŸĐ± ĐŸŃˆĐžĐ±ĐșĐ”</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="359"/>
+        <source>Agora</source>
+        <translation>Agora</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="360"/>
+        <source>Octave Forge</source>
+        <translation>Octave Forge</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="363"/>
+        <source>About Qt</source>
+        <translation>О Qt</translation>
+    </message>
+</context>
+<context>
+    <name>SettingsDialog</name>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="29"/>
+        <source>Settings</source>
+        <translation>ĐŸĐ°Ń€Đ°ĐŒĐ”Ń‚Ń€Ń‹</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="39"/>
+        <source>Chat</source>
+        <translation>Чат</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="47"/>
+        <source>Connect to #octave on startup</source>
+        <translation>ĐŸĐŸĐŽĐșĐ»ŃŽŃ‡ĐžŃ‚ŃŒŃŃ Đș #octave про запусĐșĐ”</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="57"/>
+        <source>Show message of the day</source>
+        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать ŃĐŸĐČДт ĐŽĐœŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="64"/>
+        <source>Show topic</source>
+        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать Ń‚Đ”ĐŒŃƒ ĐŸĐ±ŃŃƒĐ¶ĐŽĐ”ĐœĐžŃ про ĐżĐŸĐŽĐșĐ»ŃŽŃ‡Đ”ĐœĐžĐž</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="71"/>
+        <source>Automatically identify on NickServ</source>
+        <translation>АĐČŃ‚ĐŸĐŒĐ°Ń‚ĐžŃ‡Đ”ŃĐșĐž ĐžĐŽĐ”ĐœŃ‚ĐžŃ„ĐžŃ†ĐžŃ€ĐŸĐČаться у NickServ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="78"/>
+        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
+        <translation>ĐŸŃ€Đ”ĐŽŃƒĐżŃ€Đ”Đ¶ĐŽĐ”ĐœĐžĐ”: ĐżĐ°Ń€ĐŸĐ»ŃŒ Đ±ŃƒĐŽĐ”Ń‚ ŃĐŸŃ…Ń€Đ°ĐœŃ‘Đœ ĐČ ~/.octavegui ĐŸĐ±Ń‹Ń‡ĐœŃ‹ĐŒ Ń‚Đ”ĐșŃŃ‚ĐŸĐŒ. ĐĐ” ĐČĐČĐŸĐŽĐžŃ‚Đ” ĐżĐ°Ń€ĐŸĐ»ŃŒ, ДслО пДрДжОĐČаДтД ĐŸ ĐČĐŸĐ·ĐŒĐŸĐ¶ĐœŃ‹Ń… ŃƒŃĐ·ĐČĐžĐŒĐŸŃŃ‚ŃŃ… ĐČ Đ±Đ”Đ·ĐŸĐżĐ°ŃĐœĐŸŃŃ‚Đž ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžŃ.</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="103"/>
+        <location filename="../src/SettingsDialog.ui" line="311"/>
+        <source>Password:</source>
+        <translation>ĐŸĐ°Ń€ĐŸĐ»ŃŒ:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="125"/>
+        <source>Editor</source>
+        <translation>РДЎаĐșŃ‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="133"/>
+        <source>Use custom file editor:</source>
+        <translation>Đ’Ń‹Đ±Ń€Đ°Ń‚ŃŒ рДЎаĐșŃ‚ĐŸŃ€:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="143"/>
+        <source>emacs</source>
+        <translation>emacs</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="166"/>
+        <source>File Browser</source>
+        <translation>ЀаĐčĐ»ĐŸĐČыĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="172"/>
+        <source>Show filenames</source>
+        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать ĐžĐŒĐ”ĐœĐ° фаĐčĐ»ĐŸĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="179"/>
+        <source>Show file size</source>
+        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать Ń€Đ°Đ·ĐŒĐ”Ń€ фаĐčĐ»ĐŸĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="186"/>
+        <source>Show file type</source>
+        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать топы фаĐčĐ»ĐŸĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="193"/>
+        <source>Show date of last modification</source>
+        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать Юату ĐżĐŸŃĐ»Đ”ĐŽĐœĐ”ĐłĐŸ ĐžĐ·ĐŒĐ”ĐœĐ”ĐœĐžŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="200"/>
+        <source>Show hidden files</source>
+        <translation>ĐŸĐŸĐșĐ°Đ·Ń‹ĐČать сĐșрытыД фаĐčлы</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="207"/>
+        <source>Alternating row colors</source>
+        <translation>Đ§Đ”Ń€Đ”ĐŽŃƒŃŽŃ‰ĐžĐ”ŃŃ цĐČДта ŃŃ‚Ń€ĐŸĐș</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="215"/>
+        <source>Network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="221"/>
+        <source>Use proxy server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="233"/>
+        <source>Proxy Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="244"/>
+        <source>HttpProxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="249"/>
+        <source>Socks5Proxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="260"/>
+        <source>Hostname:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="277"/>
+        <source>Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="294"/>
+        <source>Username:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="339"/>
+        <source>Reset to defaults</source>
+        <translation>ĐŁŃŃ‚Đ°ĐœĐŸĐČоть ĐżĐ°Ń€Đ°ĐŒĐ”Ń‚Ń€Ń‹ ĐżĐŸ ŃƒĐŒĐŸĐ»Ń‡Đ°ĐœĐžŃŽ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="362"/>
+        <source>Export</source>
+        <translation>Đ­ĐșŃĐżĐŸŃ€Ń‚ĐžŃ€ĐŸĐČать</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="372"/>
+        <source>Import</source>
+        <translation>Đ˜ĐŒĐżĐŸŃ€Ń‚ĐžŃ€ĐŸĐČать</translation>
+    </message>
+</context>
+<context>
+    <name>VariablesDockWidget</name>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
+        <source>Workspace</source>
+        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ ĐżĐ”Ń€Đ”ĐŒĐ”ĐœĐœŃ‹Ń…</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Name</source>
+        <translation>Đ˜ĐŽĐ”ĐœŃ‚ĐžŃ„ĐžĐșĐ°Ń‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Type</source>
+        <translation>йОп</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Value</source>
+        <translation>Đ—ĐœĐ°Ń‡Đ”ĐœĐžĐ”</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
+        <source>Local</source>
+        <translation>Đ›ĐŸĐșĐ°Đ»ŃŒĐœĐ°Ń</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
+        <source>Global</source>
+        <translation>Đ“Đ»ĐŸĐ±Đ°Đ»ŃŒĐœĐ°Ń</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
+        <source>Persistent</source>
+        <translation>ХтатОчДсĐșая</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
+        <source>Hidden</source>
+        <translation>ĐĄĐșрытая</translation>
+    </message>
+</context>
+</TS>
Binary file gui/octave-gui/languages/uk-ua.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/languages/uk-ua.ts	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,574 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="uk_UA">
+<context>
+    <name>FileEditorMdiSubWindow</name>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="114"/>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="207"/>
+        <source>File Editor</source>
+        <translation>РДЎаĐșŃ‚ĐŸŃ€ фаĐčліĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="115"/>
+        <source>Cannot read file %1:
+%2.</source>
+        <translation>ĐĐ” ĐČĐŽĐ°Đ»ĐŸŃŃ ĐżŃ€ĐŸŃ‡ĐžŃ‚Đ°Ń‚Đž фаĐčĐ» %1:ïżŒ
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="127"/>
+        <source>File loaded.</source>
+        <translation>ЀаĐčĐ» Đ·Đ°ĐČĐ°ĐœŃ‚Đ°Đ¶Đ”ĐœĐŸ.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="153"/>
+        <source>Do you want to save the current file
+%1 ?</source>
+        <translation>СпраĐČЮі збДрДгтО ĐżĐŸŃ‚ĐŸŃ‡ĐœĐžĐč фаĐčĐ»
+%1?</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="208"/>
+        <source>Cannot write file %1:
+%2.</source>
+        <translation>ĐĐ” ĐČĐŽĐ°Đ»ĐŸŃŃ збДрДгтО фаĐčĐ» %1:
+%2.</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="220"/>
+        <source>File %1 saved</source>
+        <translation>ЀаĐčĐ» %1 Đ·Đ±Đ”Ń€Đ”Đ¶Đ”ĐœĐŸ</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="383"/>
+        <source>&amp;Close File</source>
+        <translation>За&amp;Đșрото</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="386"/>
+        <source>&amp;New File</source>
+        <translation>&amp;СтĐČĐŸŃ€ĐžŃ‚Đž</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="389"/>
+        <source>&amp;Open File</source>
+        <translation>&amp;ВіЮĐșрото</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="392"/>
+        <source>&amp;Save File</source>
+        <translation>&amp;ЗбДрДгтО</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="395"/>
+        <source>Save File &amp;As</source>
+        <translation>ЗбДрДгтО &amp;яĐș</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="398"/>
+        <source>&amp;Undo</source>
+        <translation>В&amp;Đ”Ń€ĐœŃƒŃ‚Đž</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="401"/>
+        <source>&amp;Redo</source>
+        <translation>П&amp;ĐŸĐČŃ‚ĐŸŃ€ĐžŃ‚Đž</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="402"/>
+        <source>&amp;Copy</source>
+        <translation>&amp;ĐšĐŸĐżŃ–ŃŽĐČато</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="403"/>
+        <source>Cu&amp;t</source>
+        <translation>ВОріза&amp;то</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="404"/>
+        <source>&amp;Paste</source>
+        <translation>&amp;ВстаĐČото</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="405"/>
+        <source>&amp;Next Bookmark</source>
+        <translation>Đ”ĐŸ &amp;ĐœĐ°ŃŃ‚ŃƒĐżĐœĐŸŃ— Đ·Đ°ĐșлаЎĐșĐž</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="406"/>
+        <source>Pre&amp;vious Bookmark</source>
+        <translation>Đ”ĐŸ &amp;ĐżĐŸĐżĐ”Ń€Đ”ĐŽĐœŃŒĐŸŃ— Đ·Đ°ĐșлаЎĐșĐž</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="407"/>
+        <source>Toggle &amp;Bookmark</source>
+        <translation>В&amp;ŃŃ‚Đ°ĐœĐŸĐČото/ĐČОЎалОтО Đ·Đ°ĐșлаЎĐșу</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="410"/>
+        <source>&amp;Run File</source>
+        <translation>&amp;ВоĐșĐŸĐœĐ°Ń‚Đž фаĐčĐ»</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="449"/>
+        <source>&amp;File</source>
+        <translation>&amp;ЀаĐčĐ»</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="457"/>
+        <source>&amp;Edit</source>
+        <translation>&amp;ПраĐČĐșĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/FileEditorMdiSubWindow.cpp" line="469"/>
+        <source>&amp;Run</source>
+        <translation>&amp;ВоĐșĐŸĐœĐ°ĐœĐœŃ</translation>
+    </message>
+</context>
+<context>
+    <name>FilesDockWidget</name>
+    <message>
+        <source>Current Folder</source>
+        <translation type="obsolete">ĐŸĐŸŃ‚ĐŸŃ‡ĐœĐžĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="32"/>
+        <source>Current Directory</source>
+        <translation>ĐŸĐŸŃ‚ĐŸŃ‡ĐœĐžĐč ĐșĐ°Ń‚Đ°Đ»ĐŸĐł</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="46"/>
+        <source>Move up one directory.</source>
+        <translation>ĐŸĐ”Ń€Đ”Đčто ĐČĐłĐŸŃ€Ńƒ ЎДрДĐČĐŸĐŒ ĐșĐ°Ń‚Đ°Đ»ĐŸĐłŃ–ĐČ.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="49"/>
+        <source>Enter the path or filename.</source>
+        <translation>ВĐČĐ”ĐŽŃ–Ń‚ŃŒ ĐżĐŸĐČĐœĐžĐč ŃˆĐ»ŃŃ… ĐŽĐŸ фаĐčлу Đ°Đ±ĐŸ ĐœĐ°Đ·ĐČу фаĐčлу.</translation>
+    </message>
+    <message>
+        <location filename="../src/FilesDockWidget.cpp" line="78"/>
+        <source>Doubleclick a file to open it.</source>
+        <translation>ĐŸĐŸĐŽĐČіĐčĐœĐ” ĐșĐ»Đ°Ń†Đ°ĐœĐœŃ ĐČіЮĐșроє фаĐčĐ».</translation>
+    </message>
+</context>
+<context>
+    <name>HistoryDockWidget</name>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="36"/>
+        <source>Doubleclick a command to transfer it to the terminal.</source>
+        <translation>ĐŸĐŸĐŽĐČіĐčĐœĐ” ĐșĐ»Đ°Ń†Đ°ĐœĐœŃ ĐżĐ”Ń€Đ”ĐœĐ”ŃĐ” ĐșĐŸĐŒĐ°ĐœĐŽŃƒ ĐŽĐŸ ĐșĐŸĐŒĐ°ĐœĐŽĐœĐŸĐłĐŸ ряЮĐșу.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="38"/>
+        <source>Enter text to filter the command history.</source>
+        <translation>ВĐČĐ”ĐŽŃ–Ń‚ŃŒ Ń‚Đ”Đșст ĐŽĐ»Ń Ń„Ń–Đ»ŃŒŃ‚Ń€ŃƒĐČĐ°ĐœĐœŃ Ń–ŃŃ‚ĐŸŃ€Ń–Ń— ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
+    </message>
+    <message>
+        <location filename="../src/HistoryDockWidget.cpp" line="41"/>
+        <source>Command History</source>
+        <translation>Đ†ŃŃ‚ĐŸŃ€Ń–Ń ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
+    </message>
+</context>
+<context>
+    <name>LexerOctaveGui</name>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="111"/>
+        <source>Default</source>
+        <translation>ĐĄŃ‚Đ°ĐœĐŽĐ°Ń€Ń‚ĐœŃ– ĐœĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="113"/>
+        <source>Comment</source>
+        <translation>ĐšĐŸĐŒĐ”ĐœŃ‚Đ°Ń€</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="115"/>
+        <source>Command</source>
+        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="117"/>
+        <source>Number</source>
+        <translation>Đ§ĐžŃĐ»ĐŸ</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="119"/>
+        <source>Keyword</source>
+        <translation>ЗарДзДрĐČĐŸĐČĐ°ĐœĐ” ŃĐ»ĐŸĐČĐŸ</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="121"/>
+        <source>Single-quoted string</source>
+        <translation>Đ ŃĐŽĐŸĐș ĐČ ĐŸĐŽĐžĐœĐ°Ń€ĐœĐžŃ… лапĐșах</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="123"/>
+        <source>Operator</source>
+        <translation>ĐžĐżĐ”Ń€Đ°Ń‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="125"/>
+        <source>Identifier</source>
+        <translation>Đ†ĐŽĐ”ĐœŃ‚ĐžŃ„Ń–ĐșĐ°Ń‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/lexer/lexeroctavegui.cpp" line="127"/>
+        <source>Double-quoted string</source>
+        <translation>Đ ŃĐŽĐŸĐș у ĐżĐŸĐŽĐČіĐčĐœĐžŃ… лапĐșах</translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="47"/>
+        <source>Opening file.</source>
+        <translation>ВіЮĐșроĐČається фаĐčĐ».</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="124"/>
+        <source>Save Workspace</source>
+        <translation>ЗбДрДгтО ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="134"/>
+        <source>Load Workspace</source>
+        <translation>ЗаĐČĐ°ĐœŃ‚Đ°Đ¶ĐžŃ‚Đž ĐŸĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="226"/>
+        <location filename="../src/MainWindow.cpp" line="362"/>
+        <source>About Octave</source>
+        <translation>ĐŸŃ€ĐŸ Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="238"/>
+        <source>Saving data and shutting down.</source>
+        <translation>ЗбДрДгтО ĐŽĐ°ĐœŃ– і Đ·Đ°ĐČĐ”Ń€ŃˆĐžŃ‚Đž Ń€ĐŸĐ±ĐŸŃ‚Ńƒ.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="276"/>
+        <source>View the variables in the active workspace.</source>
+        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐŽ Đ·ĐŒŃ–ŃŃ‚Ńƒ ĐżĐŸŃ‚ĐŸŃ‡ĐœĐŸŃ— ĐŸĐ±Đ»Đ°ŃŃ‚Ń– Đ·ĐŒŃ–ĐœĐœĐžŃ….</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="278"/>
+        <source>Browse and search the command history.</source>
+        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐŽ і ĐżĐŸŃˆŃƒĐș сДрДЎ Ń–ŃŃ‚ĐŸŃ€Ń–Ń— ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="280"/>
+        <source>Browse your files.</source>
+        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐœŃƒŃ‚Đž фаĐčлО.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="294"/>
+        <source>Terminal</source>
+        <translation>ĐšĐŸĐŒĐ°ĐœĐŽĐœĐžĐč Ń€ŃĐŽĐŸĐș</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="298"/>
+        <source>Enter your commands into the Octave terminal.</source>
+        <translation>ВĐČĐ”ĐŽŃ–Ń‚ŃŒ ĐșĐŸĐŒĐ°ĐœĐŽĐž ĐŽĐŸ ĐșĐŸĐŒĐ°ĐœĐŽĐœĐŸĐłĐŸ ряЮĐșĐ° Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="307"/>
+        <source>Documentation</source>
+        <translation>Đ”ĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†Ń–Ń</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="311"/>
+        <source>Browse the Octave documentation for help.</source>
+        <translation>ĐŸĐ”Ń€Đ”ĐłĐ»ŃĐœŃƒŃ‚Đž ĐŽĐŸĐșŃƒĐŒĐ”ĐœŃ‚Đ°Ń†Ń–ŃŽ ĐŽĐŸ Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="320"/>
+        <source>Chat</source>
+        <translation>Чат</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="323"/>
+        <source>Instantly chat with other Octave users for help.</source>
+        <translation>Чат Đ· ĐșĐŸŃ€ĐžŃŃ‚ŃƒĐČĐ°Ń‡Đ°ĐŒĐž Octave.</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="330"/>
+        <source>Octave</source>
+        <translation>Octave</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="331"/>
+        <source>Settings</source>
+        <translation>ĐĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="333"/>
+        <source>Exit</source>
+        <translation>ВоĐčто</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="335"/>
+        <source>Interface</source>
+        <translation>Đ†ĐœŃ‚Đ”Ń€Ń„Đ”Đčс</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="337"/>
+        <source>Align Windows</source>
+        <translation>ВоріĐČĐœŃŃ‚Đž ĐČіĐșĐœĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="339"/>
+        <location filename="../src/MainWindow.cpp" line="351"/>
+        <source>Workspace</source>
+        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="342"/>
+        <source>History</source>
+        <translation>Đ†ŃŃ‚ĐŸŃ€Ń–Ń ĐČĐžĐșĐŸĐœĐ°ĐœĐžŃ… ĐșĐŸĐŒĐ°ĐœĐŽ</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="345"/>
+        <source>File Browser</source>
+        <translation>ЀаĐčĐ»ĐŸĐČĐžĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="349"/>
+        <source>Open New Editor Window</source>
+        <translation>ВіЮĐșрото ĐœĐŸĐČĐ” ĐČіĐșĐœĐŸ рДЎаĐșŃ‚ĐŸŃ€Đ°</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="352"/>
+        <source>Load</source>
+        <translation>ЗаĐČĐ°ĐœŃ‚Đ°Đ¶ĐžŃ‚Đž</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="353"/>
+        <source>Save</source>
+        <translation>ЗбДрДгтО</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="355"/>
+        <source>Clear</source>
+        <translation>Очостото</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="357"/>
+        <source>Community</source>
+        <translation>ĐĄĐżŃ–Đ»ŃŒĐœĐŸŃ‚Đ°</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="358"/>
+        <source>Report Bug</source>
+        <translation>ĐŸĐŸĐČŃ–ĐŽĐŸĐŒĐžŃ‚Đž ĐżŃ€ĐŸ ĐżĐŸĐŒĐžĐ»Đșу</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="359"/>
+        <source>Agora</source>
+        <translation>Agora</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="360"/>
+        <source>Octave Forge</source>
+        <translation>Octave Forge</translation>
+    </message>
+    <message>
+        <location filename="../src/MainWindow.cpp" line="363"/>
+        <source>About Qt</source>
+        <translation>ĐŸŃ€ĐŸ Qt</translation>
+    </message>
+</context>
+<context>
+    <name>SettingsDialog</name>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="29"/>
+        <source>Settings</source>
+        <translation>ĐĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="39"/>
+        <source>Chat</source>
+        <translation>Чат</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="47"/>
+        <source>Connect to #octave on startup</source>
+        <translation>З&apos;Ń”ĐŽĐœĐ°Ń‚ĐžŃŃ Đ· #octave про запусĐșу</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="57"/>
+        <source>Show message of the day</source>
+        <translation>ĐŸĐŸĐșазуĐČато ĐżĐŸŃ€Đ°ĐŽŃƒ ĐŽĐœŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="64"/>
+        <source>Show topic</source>
+        <translation>ĐŸĐŸĐșазуĐČато Ń‚Đ”ĐŒŃƒ чату про Đ·&apos;Ń”ĐŽĐœĐ°ĐœĐœŃ–</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="71"/>
+        <source>Automatically identify on NickServ</source>
+        <translation>АĐČŃ‚ĐŸĐŒĐ°Ń‚ĐžŃ‡ĐœĐŸ Ń–ĐŽĐ”ĐœŃ‚ĐžŃ„Ń–ĐșуĐČатося ĐČ NickServ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="78"/>
+        <source>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</source>
+        <translation>ĐŸĐŸĐżĐ”Ń€Đ”ĐŽĐ¶Đ”ĐœĐœŃ: ĐżĐ°Ń€ĐŸĐ»ŃŒ буЎД Đ·Đ±Đ”Ń€Đ”Đ¶Đ”ĐœĐŸ ĐČ ~/.octavegui Đ·ĐČочаĐčĐœĐžĐŒ Ń‚Đ”ĐșŃŃ‚ĐŸĐŒ. ĐĐ” ĐČĐČĐŸĐŽŃŒŃ‚Đ” ĐżĐ°Ń€ĐŸĐ»ŃŒ, яĐșŃ‰ĐŸ пДрДĐčĐŒĐ°Ń”Ń‚Đ”ŃŃŒ ĐżĐŸŃ‚Đ”ĐœŃ†Ń–ĐčĐœĐžĐŒĐž ĐżŃ€ĐŸĐ±Đ»Đ”ĐŒĐ°ĐŒĐž Ń–Đ· Đ·Đ°Ń…ĐžŃŃ‚ĐŸĐŒ ĐŽĐ°ĐœĐžŃ… ĐČ ĐżŃ€ĐŸĐłŃ€Đ°ĐŒŃ–.</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="103"/>
+        <location filename="../src/SettingsDialog.ui" line="311"/>
+        <source>Password:</source>
+        <translation>ĐŸĐ°Ń€ĐŸĐ»ŃŒ:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="125"/>
+        <source>Editor</source>
+        <translation>РДЎаĐșŃ‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="133"/>
+        <source>Use custom file editor:</source>
+        <translation>ВоĐșĐŸŃ€ĐžŃŃ‚ĐŸĐČуĐČато Ń–ĐœŃˆĐžĐč рДЎаĐșŃ‚ĐŸŃ€:</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="143"/>
+        <source>emacs</source>
+        <translation>emacs</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="166"/>
+        <source>File Browser</source>
+        <translation>ЀаĐčĐ»ĐŸĐČĐžĐč ĐŒĐ”ĐœĐ”ĐŽĐ¶Đ”Ń€</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="172"/>
+        <source>Show filenames</source>
+        <translation>ĐŸĐŸĐșазуĐČато ĐœĐ°Đ·ĐČĐž фаĐčліĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="179"/>
+        <source>Show file size</source>
+        <translation>ĐŸĐŸĐșазуĐČато Ń€ĐŸĐ·ĐŒŃ–Ń€ фаĐčліĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="186"/>
+        <source>Show file type</source>
+        <translation>ĐŸĐŸĐșазуĐČато топо фаĐčліĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="193"/>
+        <source>Show date of last modification</source>
+        <translation>ĐŸĐŸĐșазуĐČато Юату ĐŸŃŃ‚Đ°ĐœĐœŃŒĐŸŃ— Đ·ĐŒŃ–ĐœĐž</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="200"/>
+        <source>Show hidden files</source>
+        <translation>ĐŸĐŸĐșазуĐČато ĐżŃ€ĐžŃ…ĐŸĐČĐ°ĐœŃ– фаĐčлО</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="207"/>
+        <source>Alternating row colors</source>
+        <translation>Đ§Đ”Ń€ĐłŃƒĐČато ĐșĐŸĐ»Ń–Ń€ ряЮĐșіĐČ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="215"/>
+        <source>Network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="221"/>
+        <source>Use proxy server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="233"/>
+        <source>Proxy Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="244"/>
+        <source>HttpProxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="249"/>
+        <source>Socks5Proxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="260"/>
+        <source>Hostname:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="277"/>
+        <source>Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="294"/>
+        <source>Username:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="339"/>
+        <source>Reset to defaults</source>
+        <translation>Đ’ŃŃ‚Đ°ĐœĐŸĐČото ŃŃ‚Đ°ĐœĐŽĐ°Ń€Ń‚ĐœŃ– ĐœĐ°Đ»Đ°ŃˆŃ‚ŃƒĐČĐ°ĐœĐœŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="362"/>
+        <source>Export</source>
+        <translation>ЕĐșŃĐżĐŸŃ€Ń‚ŃƒĐČато</translation>
+    </message>
+    <message>
+        <location filename="../src/SettingsDialog.ui" line="372"/>
+        <source>Import</source>
+        <translation>Đ†ĐŒĐżĐŸŃ€Ń‚ŃƒĐČато</translation>
+    </message>
+</context>
+<context>
+    <name>VariablesDockWidget</name>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="36"/>
+        <source>Workspace</source>
+        <translation>ĐžĐ±Đ»Đ°ŃŃ‚ŃŒ Đ·ĐŒŃ–ĐœĐœĐžŃ…</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Name</source>
+        <translation>Đ†ĐŽĐ”ĐœŃ‚ĐžŃ„Ń–ĐșĐ°Ń‚ĐŸŃ€</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Type</source>
+        <translation>йОп</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="40"/>
+        <source>Value</source>
+        <translation>Đ—ĐœĐ°Ń‡Đ”ĐœĐœŃ</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="52"/>
+        <source>Local</source>
+        <translation>Đ›ĐŸĐșĐ°Đ»ŃŒĐœĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="56"/>
+        <source>Global</source>
+        <translation>Đ“Đ»ĐŸĐ±Đ°Đ»ŃŒĐœĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="60"/>
+        <source>Persistent</source>
+        <translation>ĐĄŃ‚Đ°Ń‚ĐžŃ‡ĐœĐ°</translation>
+    </message>
+    <message>
+        <location filename="../src/VariablesDockWidget.cpp" line="64"/>
+        <source>Hidden</source>
+        <translation>ĐŸŃ€ĐžŃ…ĐŸĐČĐ°ĐœĐ°</translation>
+    </message>
+</context>
+</TS>
Binary file gui/octave-gui/media/chat.png has changed
Binary file gui/octave-gui/media/help_index.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/media/icons_license	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,104 @@
+Icons license for:
+chat.png
+help_index.png
+terminal.png
+jabber_protocol.png
+
+by http://www.everaldo.com/ on 17.07.2011:
+
+The Crystal Project are released under LGPL.
+GNU General Public License.
+
+This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for making modifications to it. For a library, 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 library.
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
+
+You may copy and distribute verbatim copies of the Library's complete 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 distribute a copy of this License along with the Library.
+
+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.
+
+You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+The modified work must itself be a software library.
+You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
+You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
+If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
+(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, 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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
+
+Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
+
+You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you 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.
+
+If distribution of 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 satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
+
+A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
+When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
+
+As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
+
+You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
+
+Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) .
+Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
+Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
+If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
+Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
+For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be 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.
+
+It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
+
+You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
+
+Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
+
+Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
+
+You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library 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.
+
+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 Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
+
+Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library 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 with this License.
+
+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 Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library 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.
+
+The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
+
+If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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
+
+Because the library is licensed free of charge, there is no warranty for the library, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the library "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 library is with you. Should the library prove defective, you assume the cost of all necessary servicing, repair or correction.
+
+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 library 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 library (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 library to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.
Binary file gui/octave-gui/media/jabber_protocol.png has changed
Binary file gui/octave-gui/media/logo.png has changed
Binary file gui/octave-gui/media/terminal.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/msvc-debug.pri	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,8 @@
+win32-msvc* {
+	CONFIG += release warn_off
+	QMAKE_CXXFLAGS += -MP
+	QMAKE_CXXFLAGS_RELEASE += -Zi
+	QMAKE_CXXFLAGS_RELEASE -= -O2
+	QMAKE_LFLAGS_RELEASE += -debug
+	QMAKE_CLEAN += $(DESTDIR)$(QMAKE_TARGET).pdb
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/octave-gui.pro	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,162 @@
+# OctaveGUI - A graphical user interface for Octave
+# Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+# Basic settings:
+QT                  += core gui webkit network	    # Qt modules
+TEMPLATE            = app                           # Build as application
+TARGET              = octave-gui                    # Name of the target binary
+
+DESTDIR             = bin                           # Destination of the output
+UI_DIR              = ui-files                      # Folder for ui files
+MOC_DIR             = moc-files                     # Folder for moc files
+OBJECTS_DIR         = object-files                  # Folder for object files
+
+TRANSLATIONS        += languages/generic.ts \
+                       languages/de-de.ts \
+                       languages/pt-br.ts \
+                       languages/es-es.ts \
+                       languages/ru-ru.ts \
+                       languages/uk-ua.ts           # Available translations
+LIBS                += -L../qtermwidget \
+                       -lqscintilla2 \
+                       -lqtermwidget \
+                       $$system(mkoctfile -p LIBS) \
+                       $$system(mkoctfile -p OCTAVE_LIBS)
+
+mac {
+    CONFIG -= app_bundle
+}
+
+# Includepaths and libraries to link against:
+INCLUDEPATH         += src \
+                       src/terminal \
+                       src/qirc \
+                       src/backend \
+                       ../qtermwidget/lib \
+                       $$system(mkoctfile -p INCFLAGS)
+
+INCFLAGS            += $$system(mkoctfile -p INCFLAGS)
+mac {
+    INCFLAGS += -I/opt/local-native/include
+}
+
+QMAKE_LIBDIR        += $$system(octave-config -p OCTLIBDIR)
+
+mac {
+    LFLAGS += -L/opt/local-native/lib
+}
+
+unix {
+    LIBS +=  -lutil
+}
+
+win32-g++ {
+    QMAKE_LFLAGS += --enable-auto-import
+}
+
+win32-msvc* {
+    DEFINES += QSCINTILLA_DLL
+    #CONFIG += console
+    include(msvc-debug.pri)
+}
+
+QMAKE_LFLAGS        += $$LFLAGS $$system(mkoctfile -p RLD_FLAG)
+QMAKE_CXXFLAGS      += $$INCFLAGS
+
+# Files associated with the project:
+SOURCES +=\
+    src/lexer/lexeroctavegui.cpp \
+    src/MainWindow.cpp \
+    src/WorkspaceView.cpp \
+    src/HistoryDockWidget.cpp \
+    src/FilesDockWidget.cpp \
+    src/FileEditorMdiSubWindow.cpp \
+    src/BrowserWidget.cpp \
+    src/ImageViewerMdiSubWindow.cpp \
+    src/irc/IRCWidget.cpp \
+    src/SettingsDialog.cpp \
+    src/OctaveGUI.cpp \
+    src/ResourceManager.cpp \
+    src/CommandLineParser.cpp \
+    src/backend/OctaveCallbackThread.cpp \
+    src/backend/OctaveLink.cpp \
+    src/backend/OctaveMainThread.cpp \
+    src/irc/IRCClientImpl.cpp \
+    src/backend/ReadlineAdapter.cpp \
+    src/WelcomeWizard.cpp \
+    src/AbstractTerminalView.cpp
+
+unix {
+SOURCES +=\
+    src/TerminalHighlighter.cpp \
+    src/TerminalView.cpp \
+    src/terminal/KPty.cpp \
+    src/terminal/KPtyDevice.cpp \
+    src/terminal/LinuxTerminalEmulation.cpp \
+    src/terminal/TerminalEmulation.cpp
+}
+
+win32 {
+SOURCES += \
+    src/WinTerminalView.cpp \
+    src/terminal/win32/QConsole.cpp \
+    src/terminal/win32/QConsoleColors.cpp
+}
+
+HEADERS += \
+    src/lexer/lexeroctavegui.h \
+    src/MainWindow.h \
+    src/WorkspaceView.h \
+    src/HistoryDockWidget.h \
+    src/FilesDockWidget.h \
+    src/FileEditorMdiSubWindow.h \
+    src/BrowserWidget.h \
+    src/ImageViewerMdiSubWindow.h \
+    src/irc/IRCWidget.h \
+    src/SettingsDialog.h \
+    src/ResourceManager.h \
+    src/CommandLineParser.h \
+    src/backend/OctaveCallbackThread.h \
+    src/backend/OctaveLink.h \
+    src/backend/OctaveMainThread.h \
+    src/irc/IRCClientInterface.h \
+    src/irc/IRCClientImpl.h \
+    src/backend/ReadlineAdapter.h \
+    src/WelcomeWizard.h \
+    src/AbstractTerminalView.h
+
+unix {
+HEADERS += \
+    src/TerminalHighlighter.h \
+    src/TerminalView.h \
+    src/terminal/KPtyDevice.h \
+    src/terminal/KPty.h \
+    src/terminal/LinuxTerminalEmulation.h \
+    src/terminal/TerminalEmulation.h
+}
+
+win32 {
+HEADERS += \
+    src/WinTerminalView.h \
+    src/terminal/win32/QConsole.h \
+    src/terminal/win32/QConsoleColors.h
+INCLUDEPATH += src/terminal/win32
+}
+
+FORMS += \
+    src/SettingsDialog.ui \
+    src/WelcomeWizard.ui
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/AbstractTerminalView.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,35 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "AbstractTerminalView.h"
+#if defined (Q_OS_UNIX)
+#include "TerminalView.h"
+#elif defined (Q_OS_WIN)
+#include "WinTerminalView.h"
+#endif
+
+AbstractTerminalView* AbstractTerminalView::create (QWidget* parent)
+{
+#if defined (Q_OS_UNIX)
+  return new TerminalView (parent);
+#elif defined (Q_OS_WIN)
+  return new WinTerminalView (parent);
+#else
+  qFatal ("No terminal widget available for this platform.");
+  return 0
+#endif
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/AbstractTerminalView.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,42 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ABSTRACTTERMINALVIEW_H
+#define ABSTRACTTERMINALVIEW_H
+
+#include <QString>
+
+class QWidget;
+
+/**
+  * @class AbstractTerminalView
+  * Abstract class defining the interface for any terminal view widget.
+  */
+class AbstractTerminalView
+{
+public:
+  /** Sends text to the terminal. */
+  virtual void sendText (const QString&) = 0;
+
+  /** Gets the terminal widget. */
+  virtual QWidget* widget (void) = 0;
+
+  /** Creates a terminal view for the current platform. */
+  static AbstractTerminalView* create (QWidget* parent = 0);
+};
+
+#endif // ABSTRACTTERMINALVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/BrowserWidget.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,105 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "BrowserWidget.h"
+#include <QVBoxLayout>
+#include <QAction>
+#include <QStyle>
+#include <QApplication>
+
+BrowserWidget::BrowserWidget (QWidget * parent):QWidget (parent)
+{
+  construct ();
+}
+
+void
+BrowserWidget::construct ()
+{
+  QStyle *style = QApplication::style ();
+  m_navigationToolBar = new QToolBar (this);
+  m_webView = new QWebView (this);
+  m_urlLineEdit = new QLineEdit (this);
+  m_statusBar = new QStatusBar (this);
+  m_progressBar = new QProgressBar (this);
+  m_progressBar->setMaximumWidth (150);
+
+  m_webView->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
+  QAction *backAction =
+    new QAction (style->standardIcon (QStyle::SP_ArrowLeft),
+		 "", m_navigationToolBar);
+  QAction *forwardAction =
+    new QAction (style->standardIcon (QStyle::SP_ArrowRight),
+		 "", m_navigationToolBar);
+
+  m_navigationToolBar->addAction (backAction);
+  m_navigationToolBar->addAction (forwardAction);
+  m_navigationToolBar->addWidget (m_urlLineEdit);
+
+  QVBoxLayout *layout = new QVBoxLayout ();
+  layout->addWidget (m_navigationToolBar);
+  layout->addWidget (m_webView);
+
+    QWidget *bottomWidget = new QWidget (this);
+    QHBoxLayout *bottomLineLayout = new QHBoxLayout ();
+    bottomLineLayout->addWidget (m_progressBar);
+    bottomLineLayout->addWidget (m_statusBar);
+    bottomLineLayout->setMargin (0);
+    bottomWidget->setLayout (bottomLineLayout);
+
+  layout->addWidget (bottomWidget);
+  layout->setMargin (2);
+  setLayout (layout);
+
+  connect (backAction, SIGNAL (triggered ()), m_webView, SLOT (back ()));
+  connect (forwardAction, SIGNAL (triggered ()), m_webView,
+	   SLOT (forward ()));
+  connect (m_webView, SIGNAL (urlChanged (QUrl)), this, SLOT (setUrl (QUrl)));
+  connect (m_urlLineEdit, SIGNAL (returnPressed ()), this,
+	   SLOT (jumpToWebsite ()));
+
+  connect (m_webView, SIGNAL (statusBarMessage(QString)),
+           m_statusBar, SLOT (showMessage(QString)));
+  connect (m_webView, SIGNAL (loadProgress(int)),
+           m_progressBar, SLOT (setValue(int)));
+}
+
+void
+BrowserWidget::setUrl (QUrl url)
+{
+  m_urlLineEdit->setText (url.toString ());
+}
+
+void
+BrowserWidget::jumpToWebsite ()
+{
+  QString url = m_urlLineEdit->text ();
+  if (!url.startsWith ("http://") && !url.startsWith ("https://"))
+    url = "http://" + url;
+  load (url);
+}
+
+void
+BrowserWidget::showStatusMessage (QString message)
+{
+  m_statusBar->showMessage (message, 1000);
+}
+
+void
+BrowserWidget::load (QUrl url)
+{
+  m_webView->load (url);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/BrowserWidget.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,50 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BROWSERMDISUBWINDOW_H
+#define BROWSERMDISUBWINDOW_H
+
+#include <QWidget>
+#include <QToolBar>
+#include <QLineEdit>
+#include <QtWebKit/QWebView>
+#include <QStatusBar>
+#include <QProgressBar>
+
+class BrowserWidget:public QWidget
+{
+  Q_OBJECT
+public:
+  BrowserWidget (QWidget * parent = 0);
+  void load (QUrl url);
+
+public slots:
+  void setUrl (QUrl url);
+  void jumpToWebsite ();
+  void showStatusMessage (QString message);
+
+private:
+  void construct ();
+
+  QLineEdit *m_urlLineEdit;
+  QToolBar *m_navigationToolBar;
+  QWebView *m_webView;
+  QStatusBar *m_statusBar;
+  QProgressBar *m_progressBar;
+};
+
+#endif // BROWSERMDISUBWINDOW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/CommandLineParser.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,47 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "CommandLineParser.h"
+
+CommandLineParser::CommandLineParser ()
+{
+}
+
+void
+CommandLineParser::registerOption (CommandLineOption commandLineOption)
+{
+  if (m_registeredCommandLineOptions.contains(commandLineOption))
+    m_registeredCommandLineOptions.append(commandLineOption);
+}
+
+void
+CommandLineParser::registerOption (QString longOption, QString shortOption, QString description, bool withArgument)
+{
+  CommandLineOption commandLineOption;
+  commandLineOption.longOption = longOption;
+  commandLineOption.shortOption = shortOption;
+  commandLineOption.description = description;
+  commandLineOption.withArgument = withArgument;
+  registerOption (commandLineOption);
+}
+
+void
+CommandLineParser::parse (int argc, char** argv)
+{
+  Q_UNUSED(argc);
+  Q_UNUSED(argv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/CommandLineParser.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,50 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef COMMANDLINEPARSER_H
+#define COMMANDLINEPARSER_H
+
+#include <QList>
+#include <QString>
+
+class CommandLineParser
+{
+public:
+  struct CommandLineOption
+  {
+    QString longOption;
+    QString shortOption;
+    QString description;
+    bool withArgument;
+
+    bool operator== (CommandLineOption other)
+    {
+        return longOption == other.longOption
+            || shortOption == other.shortOption;
+    }
+  };
+
+  CommandLineParser ();
+  void registerOption (CommandLineOption commandLineOption);
+  void registerOption (QString longOption, QString shortOption, QString description, bool withArgument);
+  void parse (int argc, char** argv);
+
+private:
+  QList<CommandLineOption> m_registeredCommandLineOptions;
+};
+
+#endif // COMMANDLINEPARSER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/FileEditorMdiSubWindow.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,596 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "FileEditorMdiSubWindow.h"
+#include <QVBoxLayout>
+#include <QApplication>
+#include <QFile>
+#include <QFont>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QStyle>
+#include <QTextStream>
+
+FileEditorMdiSubWindow::FileEditorMdiSubWindow (QWidget * parent):QMdiSubWindow
+  (parent)
+{
+  construct ();
+}
+
+FileEditorMdiSubWindow::~FileEditorMdiSubWindow ()
+{
+}
+
+void
+FileEditorMdiSubWindow::closeEvent(QCloseEvent *event)
+{
+  if ( m_mainWindow->isCloseApplication() )
+    {
+      // close wohle application: save file or not if modified
+      checkFileModified ("Close Octave GUI",0); // no cancel possible
+    }
+  else
+    {
+      // ignore close event if file is not saved and user cancels closing this window
+      if (checkFileModified ("Close File",QMessageBox::Cancel)==QMessageBox::Cancel)
+        event->ignore();
+      else
+        event->accept();
+    }
+}
+
+void
+FileEditorMdiSubWindow::handleMarginClicked(int margin, int line, Qt::KeyboardModifiers state)
+{
+  Q_UNUSED (state);
+  if ( margin == 1 )  // marker margin
+    {
+      unsigned int mask = m_editor->markersAtLine (line);
+      if (mask && (1 << MARKER_BOOKMARK))
+        m_editor->markerDelete(line,MARKER_BOOKMARK);
+      else
+        m_editor->markerAdd(line,MARKER_BOOKMARK);
+    }
+}
+
+void
+FileEditorMdiSubWindow::newWindowTitle(bool modified)
+{
+  QString title(m_fileName);
+  if ( !m_longTitle )
+    {
+      QFileInfo file(m_fileName);
+      title = file.fileName();
+    }
+  if ( modified )
+    {
+      setWindowTitle(title.prepend("* "));
+    }
+  else
+     setWindowTitle (title);
+}
+
+void
+FileEditorMdiSubWindow::handleCopyAvailable(bool enableCopy)
+{
+  m_copyAction->setEnabled(enableCopy);
+  m_cutAction->setEnabled(enableCopy);
+}
+
+
+void
+FileEditorMdiSubWindow::openFile ()
+{
+    if (checkFileModified ("Open File",QMessageBox::Cancel)==QMessageBox::Cancel)
+      {
+        return; // existing file not saved and opening another file canceled by user
+      }
+    QString openFileName;
+    QFileDialog dlg(this);
+    dlg.setNameFilter(SAVE_FILE_FILTER);
+    dlg.setAcceptMode(QFileDialog::AcceptOpen);
+    dlg.setViewMode(QFileDialog::Detail);
+    if ( dlg.exec() )
+      {
+        openFileName = dlg.selectedFiles().at(0);
+        if (openFileName.isEmpty ())
+          return;
+        loadFile(openFileName);
+      }
+}
+
+void
+FileEditorMdiSubWindow::loadFile (QString fileName)
+{
+  QFile file (fileName);
+  if (!file.open (QFile::ReadOnly))
+    {
+      QMessageBox::warning (this, tr ("File Editor"),
+			    tr ("Cannot read file %1:\n%2.").arg (fileName).
+			    arg (file.errorString ()));
+      return;
+    }
+
+  QTextStream in (&file);
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+  m_editor->setText (in.readAll ());
+  QApplication::restoreOverrideCursor ();
+
+  m_fileName = fileName;
+  newWindowTitle (false); // window title (no modification)
+  m_statusBar->showMessage (tr ("File loaded."), 2000);
+  m_editor->setModified (false); // loaded file is not modified yet
+}
+
+void
+FileEditorMdiSubWindow::newFile ()
+{
+    if (checkFileModified ("Create New File",QMessageBox::Cancel)==QMessageBox::Cancel)
+      {
+        return; // existing file not saved and creating new file canceled by user
+      }
+    m_fileName = UNNAMED_FILE;
+    newWindowTitle (false); // window title (no modification)
+    m_editor->setText ("");
+    m_editor->setModified (false); // new file is not modified yet
+}
+
+int
+FileEditorMdiSubWindow::checkFileModified (QString msg, int cancelButton)
+{
+  int decision = QMessageBox::Yes;
+  if (m_editor->isModified ())
+    {
+      // file is modified but not saved, aks user what to do
+      decision = QMessageBox::warning (this,
+                                        msg,
+                                        tr ("The file %1\n"
+                                            "has been modified. Do you want to save the changes?").
+                                          arg (m_fileName),
+                                        QMessageBox::Save, QMessageBox::Discard, cancelButton );
+      if (decision == QMessageBox::Save)
+        {
+          saveFile ();
+          if (m_editor->isModified ())
+            {
+              // If the user attempted to save the file, but it's still
+              // modified, then probably something went wrong, so return cancel
+              // for cancel this operation or try to save files as if cancel not
+              // possible
+              if ( cancelButton )
+                return (QMessageBox::Cancel);
+              else
+                saveFileAs ();
+            }
+        }
+    }
+  return (decision);
+}
+
+void
+FileEditorMdiSubWindow::saveFile ()
+{
+  saveFile(m_fileName);
+}
+
+void
+FileEditorMdiSubWindow::saveFile (QString saveFileName)
+{
+  // it is a new file with the name "<unnamed>" -> call saveFielAs
+  if (saveFileName==UNNAMED_FILE || saveFileName.isEmpty ())
+    {
+      saveFileAs();
+      return;
+    }
+
+  // open the file for writing
+  QFile file (saveFileName);
+  if (!file.open (QFile::WriteOnly))
+    {
+      QMessageBox::warning (this, tr ("File Editor"),
+			    tr ("Cannot write file %1:\n%2.").
+          arg (saveFileName).arg (file.errorString ()));
+      return;
+    }
+
+  // save the contents into the file
+  QTextStream out (&file);
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+  out << m_editor->text ();
+  QApplication::restoreOverrideCursor ();
+  m_fileName = saveFileName;  // save file name for later use
+  newWindowTitle(false);      // set the window title to actual file name (not modified)
+  m_statusBar->showMessage (tr ("File %1 saved").arg(m_fileName), 2000);
+  m_editor->setModified (false); // files is save -> not modified
+}
+
+void
+FileEditorMdiSubWindow::saveFileAs ()
+{
+  QString saveFileName(m_fileName);
+  QFileDialog dlg(this);
+  if (saveFileName==UNNAMED_FILE || saveFileName.isEmpty ())
+    {
+      saveFileName = QDir::homePath();
+      dlg.setDirectory(saveFileName);
+    }
+  else
+    {
+      dlg.selectFile(saveFileName);
+    }
+  dlg.setNameFilter(SAVE_FILE_FILTER);
+  dlg.setDefaultSuffix("m");
+  dlg.setAcceptMode(QFileDialog::AcceptSave);
+  dlg.setViewMode(QFileDialog::Detail);
+  if ( dlg.exec() )
+    {
+      saveFileName = dlg.selectedFiles().at(0);
+      if (saveFileName.isEmpty ())
+        return;
+      saveFile(saveFileName);
+    }
+}
+
+// handle the run command
+void
+FileEditorMdiSubWindow::runFile ()
+{
+  if (m_editor->isModified ())
+    saveFile(m_fileName);
+  m_terminalView->sendText (QString ("run \'%1\'\n").arg (m_fileName));
+  //m_terminalView->widget ()->setFocus ();
+}
+
+
+// (un)comment selected text
+void
+FileEditorMdiSubWindow::commentSelectedText ()
+{
+  doCommentSelectedText (true);
+}
+void
+FileEditorMdiSubWindow::uncommentSelectedText ()
+{
+  doCommentSelectedText (false);
+}
+void
+FileEditorMdiSubWindow::doCommentSelectedText (bool comment)
+{
+  if ( m_editor->hasSelectedText() )
+    {
+      int lineFrom, lineTo, colFrom, colTo, i;
+      m_editor->getSelection (&lineFrom,&colFrom,&lineTo,&colTo);
+      if ( colTo == 0 )  // the beginning of last line is not selected
+        lineTo--;        // stop at line above
+      m_editor->beginUndoAction ();
+      for ( i=lineFrom; i<=lineTo; i++ )
+        {
+          if ( comment )
+            m_editor->insertAt("%",i,0);
+          else
+            {
+               QString line(m_editor->text(i));
+               if ( line.startsWith("%") )
+                {
+                  m_editor->setSelection(i,0,i,1);
+                  m_editor->removeSelectedText();
+                }
+            }
+        }
+      m_editor->endUndoAction ();
+    }
+}
+
+
+// remove bookmarks
+void
+FileEditorMdiSubWindow::removeBookmark ()
+{
+  m_editor->markerDeleteAll(MARKER_BOOKMARK);
+}
+// toggle bookmark
+void
+FileEditorMdiSubWindow::toggleBookmark ()
+{
+  int line,cur;
+  m_editor->getCursorPosition(&line,&cur);
+  if ( m_editor->markersAtLine (line) && (1 << MARKER_BOOKMARK) )
+    m_editor->markerDelete(line,MARKER_BOOKMARK);
+  else
+    m_editor->markerAdd(line,MARKER_BOOKMARK);
+}
+// goto next bookmark
+void
+FileEditorMdiSubWindow::nextBookmark ()
+{
+  int line,cur,nextline;
+  m_editor->getCursorPosition(&line,&cur);
+  if ( m_editor->markersAtLine(line) && (1 << MARKER_BOOKMARK) )
+    line++; // we have a bookmark here, so start search from next line
+  nextline = m_editor->markerFindNext(line,(1 << MARKER_BOOKMARK));
+  m_editor->setCursorPosition(nextline,0);
+}
+// goto previous bookmark
+void
+FileEditorMdiSubWindow::prevBookmark ()
+{
+  int line,cur,prevline;
+  m_editor->getCursorPosition(&line,&cur);
+  if ( m_editor->markersAtLine(line) && (1 << MARKER_BOOKMARK) )
+    line--; // we have a bookmark here, so start search from prev line
+  prevline = m_editor->markerFindPrevious(line,(1 << MARKER_BOOKMARK));
+  m_editor->setCursorPosition(prevline,0);
+}
+
+// function for setting the already existing lexer from MainWindow
+void
+FileEditorMdiSubWindow::initEditor (AbstractTerminalView* terminalView,
+                                    LexerOctaveGui* lexer,
+                                    MainWindow* mainWindow)
+{
+  m_editor->setLexer(lexer);
+  m_terminalView = terminalView; // for sending commands to octave
+                       // TODO: make a global commandOctave function?
+  m_mainWindow = mainWindow;  // get the MainWindow for chekcing state at subwindow close
+}
+
+// TODO: Do we still need tool tips in the status bar? Tool tips are now
+//       shown directly at the theme icons
+void
+FileEditorMdiSubWindow::showToolTipNew ()
+{
+  m_statusBar->showMessage ("Create a new file", 2000);
+}
+
+void
+FileEditorMdiSubWindow::showToolTipOpen ()
+{
+  m_statusBar->showMessage ("Open a file", 2000);
+}
+
+void
+FileEditorMdiSubWindow::showToolTipSave ()
+{
+  m_statusBar->showMessage ("Save the file", 2000);
+}
+
+void
+FileEditorMdiSubWindow::showToolTipSaveAs ()
+{
+  m_statusBar->showMessage ("Save the file as", 2000);
+}
+
+void
+FileEditorMdiSubWindow::showToolTipUndo ()
+{
+  m_statusBar->showMessage ("Revert previous changes", 2000);
+}
+
+void
+FileEditorMdiSubWindow::showToolTipRedo ()
+{
+  m_statusBar->showMessage ("Append previous changes", 2000);
+}
+
+void
+FileEditorMdiSubWindow::registerModified (bool modified)
+{
+  m_modified = modified;
+}
+
+void
+FileEditorMdiSubWindow::construct ()
+{
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  QStyle *style = QApplication::style ();
+  setWidget (new QWidget ());
+
+  m_menuBar = new QMenuBar (this);
+  m_toolBar = new QToolBar (this);
+  m_statusBar = new QStatusBar (this);
+  m_editor = new QsciScintilla (this);
+
+  // markers
+  m_editor->setMarginType (1, QsciScintilla::SymbolMargin);
+  m_editor->setMarginSensitivity(1,true);
+  m_editor->markerDefine(QsciScintilla::RightTriangle,MARKER_BOOKMARK);
+  connect(m_editor,SIGNAL(marginClicked(int,int,Qt::KeyboardModifiers)),
+          this,SLOT(handleMarginClicked(int,int,Qt::KeyboardModifiers)));
+
+  // line numbers
+  m_editor->setMarginsForegroundColor(QColor(96,96,96));
+  m_editor->setMarginsBackgroundColor(QColor(232,232,220));
+  if ( settings->value ("editor/showLineNumbers",true).toBool () )
+    {
+      QFont marginFont( settings->value ("editor/fontName","Courier").toString () ,
+                        settings->value ("editor/fontSize",10).toInt () );
+      m_editor->setMarginsFont( marginFont );
+      QFontMetrics metrics(marginFont);
+      m_editor->setMarginType (2, QsciScintilla::TextMargin);
+      m_editor->setMarginWidth(2, metrics.width("99999"));
+      m_editor->setMarginLineNumbers(2, true);
+    }
+  // code folding
+  m_editor->setMarginType (3, QsciScintilla::SymbolMargin);
+  m_editor->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3);
+  // other features
+  if ( settings->value ("editor/highlightActualLine",true).toBool () )
+    {
+      m_editor->setCaretLineVisible(true);
+      m_editor->setCaretLineBackgroundColor(QColor(255,255,200));
+    }
+  m_editor->setBraceMatching (QsciScintilla::SloppyBraceMatch);
+  m_editor->setAutoIndent (true);
+  m_editor->setIndentationWidth (2);
+  m_editor->setIndentationsUseTabs (false);
+  if ( settings->value ("editor/codeCompletion",true).toBool () )
+    {
+      m_editor->autoCompleteFromAll();
+      m_editor->setAutoCompletionSource(QsciScintilla::AcsAPIs);
+      m_editor->setAutoCompletionThreshold (3);
+    }
+  m_editor->setUtf8 (true);
+  m_longTitle = settings->value ("editor/longWindowTitle",true).toBool ();
+
+  // The Actions
+
+  // Theme icons with QStyle icons as fallback
+  QAction *closeAction = new QAction (
+        QIcon::fromTheme("window-close",style->standardIcon (QStyle::SP_DialogCloseButton)),
+        tr("&Close File"), m_toolBar);
+  QAction *newAction = new QAction (
+        QIcon::fromTheme("document-new",style->standardIcon (QStyle::SP_FileIcon)),
+        tr("&New File"), m_toolBar);
+  QAction *openAction = new QAction (
+        QIcon::fromTheme("document-open",style->standardIcon (QStyle::SP_DirOpenIcon)),
+        tr("&Open File"), m_toolBar);
+  QAction *saveAction = new QAction (
+        QIcon::fromTheme("document-save",style->standardIcon (QStyle::SP_DriveHDIcon)),
+        tr("&Save File"), m_toolBar);
+  QAction *saveAsAction = new QAction (
+        QIcon::fromTheme("document-save-as",style->standardIcon (QStyle::SP_DriveFDIcon)),
+        tr("Save File &As"), m_toolBar);
+  QAction *undoAction = new QAction (
+        QIcon::fromTheme("edit-undo",style->standardIcon (QStyle::SP_ArrowLeft)),
+        tr("&Undo"), m_toolBar);
+  QAction *redoAction = new QAction (
+        QIcon::fromTheme("edit-redo",style->standardIcon (QStyle::SP_ArrowRight)),
+        tr("&Redo"), m_toolBar);
+  m_copyAction = new QAction (QIcon::fromTheme("edit-copy"),tr("&Copy"),m_toolBar);
+  m_cutAction = new QAction (QIcon::fromTheme("edit-cut"),tr("Cu&t"),m_toolBar);
+  QAction *pasteAction = new QAction (QIcon::fromTheme("edit-paste"),tr("&Paste"),m_toolBar);
+  QAction *nextBookmarkAction = new QAction (tr("&Next Bookmark"),m_toolBar);
+  QAction *prevBookmarkAction = new QAction (tr("Pre&vious Bookmark"),m_toolBar);
+  QAction *toggleBookmarkAction = new QAction (tr("Toggle &Bookmark"),m_toolBar);
+  QAction *removeBookmarkAction = new QAction (tr("&Remove All Bookmarks"),m_toolBar);
+  QAction *commentSelectedAction = new QAction (tr("&Comment Selected Text"),m_toolBar);
+  QAction *uncommentSelectedAction = new QAction (tr("&Uncomment Selected Text"),m_toolBar);
+  QAction *runAction = new QAction (
+        QIcon::fromTheme("media-play",style->standardIcon (QStyle::SP_MediaPlay)),
+        tr("&Run File"), m_toolBar);
+
+  // some actions are disabled from the beginning
+  m_copyAction->setEnabled(false);
+  m_cutAction->setEnabled(false);
+  connect(m_editor,SIGNAL(copyAvailable(bool)),this,SLOT(handleCopyAvailable(bool)));
+
+  // short cuts
+  newAction->setShortcut(QKeySequence::New);
+  openAction->setShortcut(QKeySequence::Open);
+  saveAction->setShortcut(QKeySequence::Save);
+  saveAsAction->setShortcut(QKeySequence::SaveAs);
+  undoAction->setShortcut(QKeySequence::Undo);
+  redoAction->setShortcut(QKeySequence::Redo);
+  m_copyAction->setShortcut(QKeySequence::Copy);
+  m_cutAction->setShortcut(QKeySequence::Cut);
+  pasteAction->setShortcut(QKeySequence::Paste);
+  runAction->setShortcut(Qt::Key_F5);
+  nextBookmarkAction->setShortcut(Qt::Key_F2);
+  prevBookmarkAction->setShortcut(Qt::SHIFT + Qt::Key_F2);
+  toggleBookmarkAction->setShortcut(Qt::Key_F7);
+  commentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_R);
+  uncommentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_T);
+
+  // toolbar
+  m_toolBar->setIconSize(QSize(16,16)); // smaller icons (make configurable in user settings?)
+  m_toolBar->addAction (closeAction);
+  m_toolBar->addAction (newAction);
+  m_toolBar->addAction (openAction);
+  m_toolBar->addAction (saveAction);
+  m_toolBar->addAction (saveAsAction);
+  m_toolBar->addSeparator();
+  m_toolBar->addAction (undoAction);
+  m_toolBar->addAction (redoAction);
+  m_toolBar->addAction (m_copyAction);
+  m_toolBar->addAction (m_cutAction);
+  m_toolBar->addAction (pasteAction);
+  m_toolBar->addSeparator();
+  m_toolBar->addAction (runAction);
+
+  // menu bar  
+  QMenu *fileMenu = new QMenu(tr("&File"),m_menuBar);
+  fileMenu->addAction(newAction);
+  fileMenu->addAction(openAction);
+  fileMenu->addAction(saveAction);
+  fileMenu->addAction(saveAsAction);
+  fileMenu->addSeparator();
+  fileMenu->addAction (closeAction);
+  m_menuBar->addMenu(fileMenu);
+  QMenu *editMenu = new QMenu(tr("&Edit"),m_menuBar);
+  editMenu->addAction(undoAction);
+  editMenu->addAction(redoAction);
+  editMenu->addSeparator();
+  editMenu->addAction(m_copyAction);
+  editMenu->addAction(m_cutAction);
+  editMenu->addAction(pasteAction);
+  editMenu->addSeparator();
+  editMenu->addAction(commentSelectedAction);
+  editMenu->addAction(uncommentSelectedAction);
+  editMenu->addSeparator();
+  editMenu->addAction(toggleBookmarkAction);
+  editMenu->addAction(nextBookmarkAction);
+  editMenu->addAction(prevBookmarkAction);
+  editMenu->addAction(removeBookmarkAction);
+  m_menuBar->addMenu(editMenu);
+  QMenu *runMenu = new QMenu(tr("&Run"),m_menuBar);
+  runMenu->addAction(runAction);
+  m_menuBar->addMenu(runMenu);
+
+
+  QVBoxLayout *layout = new QVBoxLayout ();
+  layout->addWidget (m_menuBar);
+  layout->addWidget (m_toolBar);
+  layout->addWidget (m_editor);
+  layout->addWidget (m_statusBar);
+  layout->setMargin (2);
+  widget ()->setLayout (layout);
+
+  connect (closeAction, SIGNAL (triggered()), this, SLOT (close()));
+  connect (newAction, SIGNAL (triggered ()), this, SLOT (newFile ()));
+  connect (openAction, SIGNAL (triggered ()), this, SLOT (openFile ()));
+  connect (undoAction, SIGNAL (triggered ()), m_editor, SLOT (undo ()));
+  connect (redoAction, SIGNAL (triggered ()), m_editor, SLOT (redo ()));
+  connect (m_copyAction, SIGNAL (triggered ()), m_editor, SLOT (copy ()));
+  connect (m_cutAction, SIGNAL (triggered ()), m_editor, SLOT (cut ()));
+  connect (pasteAction, SIGNAL (triggered ()), m_editor, SLOT (paste ()));
+  connect (saveAction, SIGNAL (triggered ()), this, SLOT (saveFile ()));
+  connect (saveAsAction, SIGNAL (triggered ()), this, SLOT (saveFileAs ()));
+  connect (runAction, SIGNAL (triggered ()), this, SLOT (runFile ()));
+  connect (toggleBookmarkAction, SIGNAL (triggered ()), this, SLOT (toggleBookmark ()));
+  connect (nextBookmarkAction, SIGNAL (triggered ()), this, SLOT (nextBookmark ()));
+  connect (prevBookmarkAction, SIGNAL (triggered ()), this, SLOT (prevBookmark ()));
+  connect (removeBookmarkAction, SIGNAL (triggered ()), this, SLOT (removeBookmark ()));
+  connect (commentSelectedAction, SIGNAL (triggered ()), this, SLOT (commentSelectedText ()));
+  connect (uncommentSelectedAction, SIGNAL (triggered ()), this, SLOT (uncommentSelectedText ()));
+
+  // TODO: Do we still need tool tips in the status bar? Tool tips are now
+  //       shown directly at the theme icons
+  connect (newAction, SIGNAL (hovered ()), this, SLOT (showToolTipNew ()));
+  connect (openAction, SIGNAL (hovered ()), this, SLOT (showToolTipOpen ()));
+  connect (undoAction, SIGNAL (hovered ()), this, SLOT (showToolTipUndo ()));
+  connect (redoAction, SIGNAL (hovered ()), this, SLOT (showToolTipRedo ()));
+  connect (saveAction, SIGNAL (hovered ()), this, SLOT (showToolTipSave ()));
+  connect (saveAsAction, SIGNAL (hovered ()), this,SLOT (showToolTipSaveAs ()));
+
+  // connect modified signal
+  connect (m_editor, SIGNAL (modificationChanged(bool)), this, SLOT (newWindowTitle(bool)) );
+
+  m_fileName = "";
+  newWindowTitle (false);
+  setWindowIcon(QIcon::fromTheme("accessories-text-editor",style->standardIcon (QStyle::SP_FileIcon)));
+  show ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/FileEditorMdiSubWindow.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,103 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FILEEDITORMDISUBWINDOW_H
+#define FILEEDITORMDISUBWINDOW_H
+
+#include "MainWindow.h"
+#include "AbstractTerminalView.h"
+#include <QMdiSubWindow>
+#include <QToolBar>
+#include <QAction>
+#include <QMenuBar>
+#include <QStatusBar>
+#include <QCloseEvent>
+#include <Qsci/qsciscintilla.h>
+// Not available in the Debian repos yet!
+// #include <Qsci/qscilexeroctave.h>
+#include "lexer/lexeroctavegui.h"
+
+const char UNNAMED_FILE[]     = "<unnamed>";
+const char SAVE_FILE_FILTER[] = "Octave Files (*.m);;All Files (*.*)";
+enum MARKER
+  {
+    MARKER_BOOKMARK,
+    MARKER_BREAKPOINT
+  };
+
+class FileEditorMdiSubWindow:public QMdiSubWindow
+{
+Q_OBJECT public:
+  FileEditorMdiSubWindow (QWidget * parent = 0);
+  ~FileEditorMdiSubWindow ();
+  void loadFile (QString fileName);
+  void initEditor (AbstractTerminalView *terminalView,
+                   LexerOctaveGui *lexer,
+                   MainWindow *mainWindow);
+
+public slots:
+
+  void newFile ();
+  void openFile ();
+  void saveFile ();
+  void saveFile (QString fileName);
+  void saveFileAs ();
+
+  void showToolTipNew ();
+  void showToolTipOpen ();
+  void showToolTipSave ();
+  void showToolTipSaveAs ();
+  void showToolTipUndo ();
+  void showToolTipRedo ();
+  void registerModified (bool modified);
+
+protected:
+  void closeEvent(QCloseEvent *event);
+
+private:
+  int checkFileModified (QString msg, int cancelButton);
+  void construct ();
+  void doCommentSelectedText (bool comment);
+  QMenuBar *m_menuBar;
+  QToolBar *m_toolBar;
+  QsciScintilla *m_editor;
+  QStatusBar *m_statusBar;
+  QString m_fileName;
+  QString m_fileNameShort;
+  AbstractTerminalView* m_terminalView;
+  QAction* m_copyAction;
+  QAction* m_cutAction;
+  MainWindow* m_mainWindow;
+  int m_markerBookmark;
+  bool m_modified;
+  bool m_longTitle;
+
+private slots:
+  void newWindowTitle(bool modified);
+  void handleMarginClicked(int line, int margin, Qt::KeyboardModifiers state);
+  void handleCopyAvailable(bool enableCopy);
+  void runFile();
+  void removeBookmark ();
+  void toggleBookmark ();
+  void nextBookmark();
+  void prevBookmark();
+  void commentSelectedText();
+  void uncommentSelectedText();
+
+};
+
+#endif // FILEEDITORMDISUBWINDOW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/FilesDockWidget.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,201 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ResourceManager.h"
+#include "FilesDockWidget.h"
+
+#include <QApplication>
+#include <QFileInfo>
+#include <QCompleter>
+#include <QSettings>
+#include <QProcess>
+#include <QDebug>
+
+FilesDockWidget::FilesDockWidget (QWidget * parent):QDockWidget (parent)
+{
+  setObjectName ("FilesDockWidget");
+  setWindowTitle (tr ("Current Directory"));
+  setWidget (new QWidget (this));
+
+  // Create a toolbar
+  m_navigationToolBar = new QToolBar ("", widget ());
+  m_navigationToolBar->setAllowedAreas (Qt::TopToolBarArea);
+  m_navigationToolBar->setMovable (false);
+  m_navigationToolBar->setIconSize (QSize (20, 20));
+
+  // Add a button to the toolbar with the QT standard icon for up-directory
+  // TODO: Maybe change this to be an up-directory icon that is OS specific???
+  QStyle *style = QApplication::style ();
+  m_directoryIcon = style->standardIcon (QStyle::SP_FileDialogToParent);
+  m_directoryUpAction = new QAction (m_directoryIcon, "", m_navigationToolBar);
+  m_directoryUpAction->setStatusTip (tr ("Move up one directory."));
+
+  m_currentDirectory = new QLineEdit (m_navigationToolBar);
+  m_currentDirectory->setStatusTip (tr ("Enter the path or filename."));
+
+  m_navigationToolBar->addAction (m_directoryUpAction);
+  m_navigationToolBar->addWidget (m_currentDirectory);
+  connect (m_directoryUpAction, SIGNAL (triggered ()), this,
+	   SLOT (onUpDirectory ()));
+
+  // TODO: Add other buttons for creating directories
+
+  // Create the QFileSystemModel starting in the home directory
+  QString
+    homePath = QDir::homePath ();
+  // TODO: This should occur after Octave has been initialized and the startup directory of Octave is established
+
+  m_fileSystemModel = new QFileSystemModel (this);
+  m_fileSystemModel->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries);
+  QModelIndex
+    rootPathIndex = m_fileSystemModel->setRootPath (homePath);
+
+  // Attach the model to the QTreeView and set the root index
+  m_fileTreeView = new QTreeView (widget ());
+  m_fileTreeView->setModel (m_fileSystemModel);
+  m_fileTreeView->setRootIndex (rootPathIndex);
+  m_fileTreeView->setSortingEnabled (true);
+  m_fileTreeView->setAlternatingRowColors (true);
+  m_fileTreeView->setAnimated (true);
+  m_fileTreeView->setColumnHidden (1, true);
+  m_fileTreeView->setColumnHidden (2, true);
+  m_fileTreeView->setColumnHidden (3, true);
+  m_fileTreeView->setStatusTip (tr ("Doubleclick a file to open it."));
+
+  setCurrentDirectory (m_fileSystemModel->fileInfo (rootPathIndex).
+		       absoluteFilePath ());
+
+  connect (m_fileTreeView, SIGNAL (doubleClicked (const QModelIndex &)), this,
+	   SLOT (itemDoubleClicked (const QModelIndex &)));
+
+  // Layout the widgets vertically with the toolbar on top
+  QVBoxLayout *
+    layout = new QVBoxLayout ();
+  layout->setSpacing (0);
+  layout->addWidget (m_navigationToolBar);
+  layout->addWidget (m_fileTreeView);
+  layout->setMargin (1);
+  widget ()->setLayout (layout);
+  // TODO: Add right-click contextual menus for copying, pasting, deleting files (and others)
+
+  connect (m_currentDirectory, SIGNAL (returnPressed ()), this,
+	   SLOT (currentDirectoryEntered ()));
+  QCompleter *
+    completer = new QCompleter (m_fileSystemModel, this);
+  m_currentDirectory->setCompleter (completer);
+
+  connect (this,
+           SIGNAL (visibilityChanged(bool)),
+           this,
+           SLOT(handleVisibilityChanged(bool)));
+}
+
+void
+FilesDockWidget::itemDoubleClicked (const QModelIndex & index)
+{
+  // Retrieve the file info associated with the model index.
+  QFileInfo fileInfo = m_fileSystemModel->fileInfo (index);
+
+  // If it is a directory, cd into it.
+  if (fileInfo.isDir ())
+    {
+      m_fileSystemModel->setRootPath (fileInfo.absolutePath ());
+      m_fileTreeView->setRootIndex (index);
+      setCurrentDirectory (m_fileSystemModel->fileInfo (index).
+			   absoluteFilePath ());
+    }
+  // Otherwise attempt to open it.
+  else
+    {
+      // Check if the user wants to use a custom file editor.
+      QSettings *settings = ResourceManager::instance ()->settings ();
+      if (settings->value ("useCustomFileEditor").toBool ())
+        {
+          QString editor = settings->value ("customFileEditor").toString ();
+          QStringList arguments;
+          arguments << fileInfo.filePath ();
+          QProcess::execute (editor, arguments);
+        }
+      else
+        {
+          emit openFile (fileInfo.filePath ());
+        }
+    }
+}
+
+void
+FilesDockWidget::setCurrentDirectory (QString currentDirectory)
+{
+  m_currentDirectory->setText (currentDirectory);
+}
+
+void
+FilesDockWidget::onUpDirectory (void)
+{
+  QDir dir =
+    QDir (m_fileSystemModel->filePath (m_fileTreeView->rootIndex ()));
+  dir.cdUp ();
+  m_fileSystemModel->setRootPath (dir.absolutePath ());
+  m_fileTreeView->setRootIndex (m_fileSystemModel->
+				index (dir.absolutePath ()));
+  setCurrentDirectory (dir.absolutePath ());
+}
+
+void
+FilesDockWidget::currentDirectoryEntered ()
+{
+  QFileInfo fileInfo (m_currentDirectory->text ());
+  if (fileInfo.isDir ())
+    {
+      m_fileTreeView->setRootIndex (m_fileSystemModel->
+				    index (fileInfo.absolutePath ()));
+      m_fileSystemModel->setRootPath (fileInfo.absolutePath ());
+      setCurrentDirectory (fileInfo.absoluteFilePath ());
+    }
+  else
+    {
+      if (QFile::exists (fileInfo.absoluteFilePath ()))
+	emit openFile (fileInfo.absoluteFilePath ());
+    }
+}
+
+void
+FilesDockWidget::noticeSettings ()
+{
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  m_fileTreeView->setColumnHidden (0, !settings->value ("showFilenames").toBool ());
+  m_fileTreeView->setColumnHidden (1, !settings->value ("showFileSize").toBool ());
+  m_fileTreeView->setColumnHidden (2, !settings->value ("showFileType").toBool ());
+  m_fileTreeView->setColumnHidden (3, !settings->value ("showLastModified").toBool ());
+  m_fileTreeView->setAlternatingRowColors (settings->value ("useAlternatingRowColors").toBool ());
+  //if (settings.value ("showHiddenFiles").toBool ())
+  // TODO: React on option for hidden files.
+}
+
+void
+FilesDockWidget::handleVisibilityChanged (bool visible)
+{
+  if (visible)
+    emit activeChanged (true);
+}
+
+void
+FilesDockWidget::closeEvent (QCloseEvent *event)
+{
+  emit activeChanged (false);
+  QDockWidget::closeEvent (event);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/FilesDockWidget.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,85 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FILESDOCKWIDGET_H
+#define FILESDOCKWIDGET_H
+
+#include <QListView>
+#include <QDate>
+#include <QObject>
+#include <QWidget>
+#include <QListWidget>
+#include <QFileSystemModel>
+#include <QToolBar>
+#include <QToolButton>
+#include <QVBoxLayout>
+#include <QAction>
+#include <QTreeView>
+
+#include <QDockWidget>
+#include <QLineEdit>
+
+class FilesDockWidget:public QDockWidget
+{
+  Q_OBJECT
+public:
+  FilesDockWidget (QWidget * parent = 0);
+
+public slots:
+  /** Slot for handling a change in directory via double click. */
+  void itemDoubleClicked (const QModelIndex & index);
+
+  /** Slot for handling the up-directory button in the toolbar. */
+  void onUpDirectory ();
+
+  void setCurrentDirectory (QString currentDirectory);
+
+  void currentDirectoryEntered ();
+
+  /** Tells the widget to notice settings that are probably new. */
+  void noticeSettings ();
+  void handleVisibilityChanged (bool visible);
+
+signals:
+  void openFile (QString fileName);
+
+  /** Custom signal that tells if a user has clicke away that dock widget. */
+  void activeChanged (bool active);
+
+protected:
+  void closeEvent (QCloseEvent *event);
+
+private:
+  // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc
+
+    /** Toolbar for file and directory manipulation. */
+    QToolBar * m_navigationToolBar;
+
+    /** Variables for the up-directory action. */
+  QIcon m_directoryIcon;
+  QAction *m_directoryUpAction;
+  QToolButton *upDirectoryButton;
+
+    /** The file system model. */
+  QFileSystemModel *m_fileSystemModel;
+
+    /** The file system view. */
+  QTreeView *m_fileTreeView;
+  QLineEdit *m_currentDirectory;
+};
+
+#endif // FILESDOCKWIDGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/HistoryDockWidget.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,89 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "HistoryDockWidget.h"
+#include <QVBoxLayout>
+
+HistoryDockWidget::HistoryDockWidget (QWidget * parent):QDockWidget (parent)
+{
+  setObjectName ("HistoryDockWidget");
+  construct ();
+}
+
+void
+HistoryDockWidget::construct ()
+{
+  m_sortFilterProxyModel.setSourceModel(OctaveLink::instance ()->historyModel());
+  m_historyListView = new QListView (this);
+  m_historyListView->setModel (&m_sortFilterProxyModel);
+  m_historyListView->setAlternatingRowColors (true);
+  m_historyListView->setEditTriggers (QAbstractItemView::NoEditTriggers);
+  m_historyListView->setStatusTip (tr ("Doubleclick a command to transfer it to the terminal."));
+  m_filterLineEdit = new QLineEdit (this);
+  m_filterLineEdit->setStatusTip (tr ("Enter text to filter the command history."));
+  QVBoxLayout *layout = new QVBoxLayout ();
+
+  setWindowTitle (tr ("Command History"));
+  setWidget (new QWidget ());
+
+  layout->addWidget (m_historyListView);
+  layout->addWidget (m_filterLineEdit);
+  layout->setMargin (2);
+
+  widget ()->setLayout (layout);
+
+  connect (m_filterLineEdit,
+           SIGNAL (textEdited (QString)),
+           &m_sortFilterProxyModel,
+           SLOT (setFilterWildcard(QString)));
+
+  connect (m_historyListView,
+           SIGNAL (doubleClicked (QModelIndex)),
+           this,
+           SLOT (handleDoubleClick (QModelIndex)));
+
+  connect (this,
+           SIGNAL (visibilityChanged(bool)),
+           this,
+           SLOT(handleVisibilityChanged(bool)));
+}
+
+void
+HistoryDockWidget::handleDoubleClick (QModelIndex modelIndex)
+{
+  emit commandDoubleClicked (modelIndex.data().toString());
+}
+
+void
+HistoryDockWidget::handleVisibilityChanged (bool visible)
+{
+  if (visible)
+    emit activeChanged (true);
+}
+
+void
+HistoryDockWidget::noticeSettings ()
+{
+    // TODO: React on a settings change.
+}
+
+void
+HistoryDockWidget::closeEvent (QCloseEvent *event)
+{
+  emit activeChanged (false);
+  QDockWidget::closeEvent (event);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/HistoryDockWidget.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,55 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef HISTORYDOCKWIDGET_H
+#define HISTORYDOCKWIDGET_H
+
+#include <QDockWidget>
+#include <QLineEdit>
+#include <QListView>
+#include <QSortFilterProxyModel>
+#include "OctaveLink.h"
+
+class HistoryDockWidget:public QDockWidget
+{
+Q_OBJECT
+public:
+  HistoryDockWidget (QWidget *parent = 0);
+  void updateHistory (QStringList history);
+
+public slots:
+  void handleVisibilityChanged (bool visible);
+  void noticeSettings ();
+
+signals:
+  void information (QString message);
+  void commandDoubleClicked (QString command);
+  /** Custom signal that tells if a user has clicked away that dock widget. */
+  void activeChanged (bool active);
+protected:
+  void closeEvent (QCloseEvent *event);
+private slots:
+  void handleDoubleClick (QModelIndex modelIndex);
+
+private:
+  void construct ();
+  QListView *m_historyListView;
+  QLineEdit *m_filterLineEdit;
+  QSortFilterProxyModel m_sortFilterProxyModel;
+};
+
+#endif // HISTORYDOCKWIDGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/ImageViewerMdiSubWindow.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,43 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ImageViewerMdiSubWindow.h"
+#include <QLabel>
+#include <QPixmap>
+#include <QScrollArea>
+
+ImageViewerMdiSubWindow::ImageViewerMdiSubWindow (QPixmap pixmap, QWidget * parent):QMdiSubWindow (parent),
+m_pixmap
+(pixmap)
+{
+  construct ();
+}
+
+void
+ImageViewerMdiSubWindow::construct ()
+{
+  QLabel *label = new QLabel ();
+  label->setBackgroundRole (QPalette::Base);
+  label->setSizePolicy (QSizePolicy::Ignored, QSizePolicy::Ignored);
+  label->setScaledContents (true);
+  label->setPixmap (m_pixmap);
+
+  QScrollArea *scrollArea = new QScrollArea (this);
+  scrollArea->setBackgroundRole (QPalette::Dark);
+  scrollArea->setWidget (label);
+  setWidget (scrollArea);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/ImageViewerMdiSubWindow.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,33 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IMAGEVIEWERMDISUBWINDOW_H
+#define IMAGEVIEWERMDISUBWINDOW_H
+
+#include <QMdiSubWindow>
+
+class ImageViewerMdiSubWindow:public QMdiSubWindow
+{
+public:
+  ImageViewerMdiSubWindow (QPixmap pixmap, QWidget * parent = 0);
+
+private:
+  void construct ();
+  QPixmap m_pixmap;
+};
+
+#endif // IMAGEVIEWERMDISUBWINDOW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/MainWindow.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,413 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <QMenuBar>
+#include <QMenu>
+#include <QAction>
+#include <QSettings>
+#include <QDesktopServices>
+#include <QFileDialog>
+#include <QMessageBox>
+#include "MainWindow.h"
+#include "FileEditorMdiSubWindow.h"
+#include "ImageViewerMdiSubWindow.h"
+#include "SettingsDialog.h"
+
+#ifdef Q_OS_UNIX
+#   include "qtermwidget.h"
+#endif
+
+#define VERSION_STRING "Octave GUI (0.8.5)"
+
+MainWindow::MainWindow (QWidget * parent):QMainWindow (parent)
+{
+  construct ();
+  OctaveLink::instance ()->launchOctave();
+}
+
+MainWindow::~MainWindow ()
+{
+}
+
+void
+MainWindow::handleOpenFileRequest (QString fileName)
+{
+  reportStatusMessage (tr ("Opening file."));
+  QPixmap pixmap;
+  if (pixmap.load (fileName))
+    {
+//        ImageViewerMdiSubWindow *subWindow = new ImageViewerMdiSubWindow(pixmap, this);
+//        subWindow->setAttribute(Qt::WA_DeleteOnClose);
+//        m_centralMdiArea->addSubWindow(subWindow);
+//        subWindow->setWindowTitle(fileName);
+    }
+  else
+    {
+      openEditorFile(fileName);
+    }
+}
+
+void
+MainWindow::openEditor ()
+{
+  openEditorFile(QString());
+}
+void
+MainWindow::openEditorFile (QString fileName)
+{
+  FileEditorMdiSubWindow *subWindow = new FileEditorMdiSubWindow (m_centralMdiArea);
+  subWindow->setAttribute (Qt::WA_DeleteOnClose);
+  // check whether lexer is already prepared and prepare it if not
+  if ( m_lexer == NULL )
+    {
+      // this has to be done only once, not for each editor
+      m_lexer = new LexerOctaveGui();
+      // Editor font (default or from settings)
+      QSettings *settings = ResourceManager::instance ()->settings ();
+      m_lexer->setDefaultFont( QFont(
+                  settings->value ("editor/fontName","Courier").toString (),
+                  settings->value ("editor/fontSize",10).toInt () ) );
+      // TODO: Autoindent not working as it should
+      m_lexer->setAutoIndentStyle(QsciScintilla::AiMaintain ||
+                                  QsciScintilla::AiOpening  ||
+                                  QsciScintilla::AiClosing);
+      // The API info that is used for auto completion
+      // TODO: Where to store a file with API info (raw or prepared?)?
+      // TODO: Also provide infos on octave-forge functions?
+      // TODO: Also provide infos on function parameters?
+      // By now, use the keywords-list from syntax highlighting
+       m_lexerAPI = new QsciAPIs(m_lexer);
+       QString keyword;
+       QStringList keywordList;
+       keyword     = m_lexer->keywords(1);  // get whole string with all keywords
+       keywordList = keyword.split(QRegExp("\\s+"));  // split into single strings
+       int i;
+       for ( i=0; i<keywordList.size(); i++ )
+         {
+           m_lexerAPI->add(keywordList.at(i));  // add single strings to the API
+         }
+       m_lexerAPI->prepare();           // prepare API info ... this make take some time
+    }
+  subWindow->initEditor(m_terminalView, m_lexer, this);   // init necessary informations for editor
+
+  if ( fileName.isEmpty() )
+    subWindow->newFile ();
+  else
+    subWindow->loadFile (fileName);
+}
+
+
+void
+MainWindow::reportStatusMessage (QString statusMessage)
+{
+  m_statusBar->showMessage (statusMessage, 1000);
+}
+
+void
+MainWindow::openWebPage (QString url)
+{
+  m_documentationWidget->load (QUrl (url));
+}
+
+void
+MainWindow::handleSaveWorkspaceRequest ()
+{
+  QString selectedFile =
+    QFileDialog::getSaveFileName (this, tr ("Save Workspace"),
+                                  ResourceManager::instance ()->homePath ());
+  m_terminalView->sendText (QString ("save \'%1\'\n").arg (selectedFile));
+  m_terminalView->widget ()->setFocus ();
+}
+
+void
+MainWindow::handleLoadWorkspaceRequest ()
+{
+  QString selectedFile =
+    QFileDialog::getOpenFileName (this, tr ("Load Workspace"),
+                                  ResourceManager::instance ()->homePath ());
+  m_terminalView->sendText (QString ("load \'%1\'\n").arg (selectedFile));
+  m_terminalView->widget ()->setFocus ();
+}
+
+void
+MainWindow::handleClearWorkspaceRequest ()
+{
+  m_terminalView->sendText ("clear\n");
+  m_terminalView->widget ()->setFocus ();
+}
+
+void
+MainWindow::handleCommandDoubleClicked (QString command)
+{
+  m_terminalView->sendText (command);
+  m_terminalView->widget ()->setFocus ();
+}
+
+void
+MainWindow::handleUnreadMessages (bool yes)
+{
+  if (yes)
+    {
+      m_ircWidgetSubWindow
+        ->setWindowIcon
+          (ResourceManager::instance ()->icon (ResourceManager::ChatNewMessage));
+    }
+  else
+    {
+      m_ircWidgetSubWindow
+        ->setWindowIcon
+          (ResourceManager::instance ()->icon (ResourceManager::Chat));
+    }
+}
+
+void
+MainWindow::alignMdiWindows ()
+{
+  m_centralMdiArea->tileSubWindows ();
+}
+
+void
+MainWindow::openBugTrackerPage ()
+{
+  QDesktopServices::openUrl (QUrl ("http://savannah.gnu.org/bugs/?group=octave"));
+}
+
+void
+MainWindow::openAgoraPage ()
+{
+  QDesktopServices::openUrl (QUrl ("http://agora.panocha.org.mx/"));
+}
+
+void
+MainWindow::openOctaveForgePage ()
+{
+  QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/"));
+}
+
+void
+MainWindow::processSettingsDialogRequest ()
+{
+  SettingsDialog settingsDialog (this);
+  settingsDialog.exec ();
+  emit settingsChanged ();
+  ResourceManager::instance ()->updateNetworkSettings ();
+}
+
+void
+MainWindow::showAboutOctave ()
+{
+  QString message =
+      "GNU Octave\n"
+      "Copyright (C) 2009 John W. Eaton and others.\n"
+      "This is free software; see the source code for copying conditions."
+      "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or"
+      "FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.\n"
+      "\n"
+      "Octave was configured for \"x86_64-pc-linux-gnu\".\n"
+      "\n"
+      "Additional information about Octave is available at http://www.octave.org.\n"
+      "\n"
+      "Please contribute if you find this software useful."
+      "For more information, visit http://www.octave.org/help-wanted.html\n"
+      "\n"
+      "Report bugs to <bug@octave.org> (but first, please read"
+      "http://www.octave.org/bugs.html to learn how to write a helpful report).\n"
+      "\n"
+      "For information about changes from previous versions, type `news'.\n";
+
+  QMessageBox::about (this, tr ("About Octave"), message);
+}
+
+void
+MainWindow::showAboutQt ()
+{
+  QMessageBox::aboutQt (this);
+}
+
+void
+MainWindow::closeEvent (QCloseEvent * closeEvent)
+{
+  reportStatusMessage (tr ("Saving data and shutting down."));
+  writeSettings ();
+  m_closeApplication = true;  // inform editor window that whole application is closed
+  OctaveLink::instance ()->terminateOctave();
+  m_centralMdiArea->closeAllSubWindows();   // send close events to subwindows
+                                            // (editor files can be saved!)
+  QMainWindow::closeEvent (closeEvent);
+}
+
+void
+MainWindow::readSettings ()
+{
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
+  restoreState (settings->value ("MainWindow/windowState").toByteArray ());
+  m_centralMdiArea->restoreGeometry (settings->value ("MdiArea/geometry").toByteArray ());
+  emit settingsChanged ();
+}
+
+void
+MainWindow::writeSettings ()
+{
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  settings->setValue ("MainWindow/geometry", saveGeometry ());
+  settings->setValue ("MainWindow/windowState", saveState ());
+  settings->setValue ("MdiArea/geometry", m_centralMdiArea->saveGeometry ());
+}
+
+void
+MainWindow::construct ()
+{
+  m_closeApplication = false;   // flag for editor files when closed
+  setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Octave));
+
+  // Initialize MDI area.
+  m_centralMdiArea = new QMdiArea (this);
+  m_centralMdiArea->setObjectName ("CentralMdiArea");
+  m_centralMdiArea->setViewMode (QMdiArea::TabbedView);
+
+  // Setup dockable widgets and the status bar.
+  m_workspaceView = new WorkspaceView (this);
+  m_workspaceView->setStatusTip (tr ("View the variables in the active workspace."));
+  m_historyDockWidget = new HistoryDockWidget (this);
+  m_historyDockWidget->setStatusTip (tr ("Browse and search the command history."));
+  m_filesDockWidget = new FilesDockWidget (this);
+  m_filesDockWidget->setStatusTip (tr ("Browse your files."));
+  m_statusBar = new QStatusBar (this);
+
+  // Setup essential MDI Windows.
+  m_terminalView = AbstractTerminalView::create (this);
+  m_documentationWidget = new BrowserWidget (this);
+  m_ircWidget = new IRCWidget (this);
+
+  // Octave Terminal subwindow.
+  m_terminalViewSubWindow = new NonClosableMdiSubWindow (this);
+  m_terminalViewSubWindow->setWidget (m_terminalView->widget ());
+  m_centralMdiArea->addSubWindow (m_terminalViewSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
+
+  m_terminalViewSubWindow->setObjectName ("OctaveTerminalSubWindow");
+  m_terminalViewSubWindow->setWindowTitle (tr ("Terminal"));
+  m_terminalViewSubWindow
+      ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Terminal));
+  m_terminalViewSubWindow->setFocusProxy (m_terminalView->widget ());
+  m_terminalViewSubWindow->setStatusTip (tr ("Enter your commands into the Octave terminal."));
+  m_terminalViewSubWindow->setMinimumSize (300, 300);
+
+  // Documentation subwindow.
+  m_documentationWidgetSubWindow = new NonClosableMdiSubWindow (this);
+  m_documentationWidgetSubWindow->setWidget (m_documentationWidget);
+  m_centralMdiArea->addSubWindow (m_documentationWidgetSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
+
+  m_documentationWidgetSubWindow->setObjectName ("DocumentationWidgetSubWindow");
+  m_documentationWidgetSubWindow->setWindowTitle (tr ("Documentation"));
+  m_documentationWidgetSubWindow
+      ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Documentation));
+  m_documentationWidgetSubWindow->setFocusProxy (m_documentationWidget);
+  m_documentationWidgetSubWindow->setStatusTip (tr ("Browse the Octave documentation for help."));
+  m_documentationWidgetSubWindow->setMinimumSize (300, 300);
+
+  // Chat subwindow.
+  m_ircWidgetSubWindow = new NonClosableMdiSubWindow (this);
+  m_ircWidgetSubWindow->setWidget (m_ircWidget);
+  m_centralMdiArea->addSubWindow (m_ircWidgetSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
+
+  m_ircWidgetSubWindow->setObjectName ("ChatWidgetSubWindow");
+  m_ircWidgetSubWindow->setWindowTitle (tr ("Chat"));
+  m_ircWidgetSubWindow
+      ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Chat));
+  m_ircWidgetSubWindow->setStatusTip(tr ("Instantly chat with other Octave users for help."));
+  m_ircWidgetSubWindow->setFocusProxy (m_ircWidget);
+  m_ircWidgetSubWindow->setMinimumSize (300, 300);
+  connect (m_ircWidget, SIGNAL (unreadMessages (bool)), this, SLOT (handleUnreadMessages (bool)));
+
+  m_lexer = NULL;  // initialise the empty lexer for the edtiors
+
+  QMenu *controlMenu = menuBar ()->addMenu (tr ("Octave"));
+  QAction *settingsAction = controlMenu->addAction (tr ("Settings"));
+  controlMenu->addSeparator ();
+  QAction *exitAction = controlMenu->addAction (tr ("Exit"));
+
+  QMenu *interfaceMenu = menuBar ()->addMenu (tr ("Interface"));
+
+  QAction *alignWindowsAction = interfaceMenu->addAction (tr ("Align Windows"));
+  interfaceMenu->addSeparator ();
+  QAction *showWorkspaceAction = interfaceMenu->addAction (tr ("Workspace"));
+  showWorkspaceAction->setCheckable (true);
+
+  QAction *showHistoryAction = interfaceMenu->addAction (tr ("History"));
+  showHistoryAction->setCheckable (true);
+
+  QAction *showFileBrowserAction = interfaceMenu->addAction (tr ("File Browser"));
+  showFileBrowserAction->setCheckable (true);
+
+  interfaceMenu->addSeparator ();
+  QAction *openEditorAction = interfaceMenu->addAction (tr ("Open New Editor Window"));
+
+  QMenu *workspaceMenu = menuBar ()->addMenu (tr ("Workspace"));
+  QAction *loadWorkspaceAction = workspaceMenu->addAction (tr ("Load"));
+  QAction *saveWorkspaceAction = workspaceMenu->addAction (tr ("Save"));
+  workspaceMenu->addSeparator ();
+  QAction *clearWorkspaceAction = workspaceMenu->addAction (tr ("Clear"));
+
+  QMenu *communityMenu = menuBar ()->addMenu (tr ("Community"));
+  QAction *reportBugAction = communityMenu->addAction (tr ("Report Bug"));
+  QAction *agoraAction = communityMenu->addAction (tr ("Agora"));
+  QAction *octaveForgeAction = communityMenu->addAction (tr ("Octave Forge"));
+  communityMenu->addSeparator ();
+  QAction *aboutOctaveAction = communityMenu->addAction (tr ("About Octave"));
+  QAction *aboutQt = communityMenu->addAction (tr ("About Qt"));
+
+  connect (settingsAction, SIGNAL (triggered ()), this, SLOT (processSettingsDialogRequest ()));
+  connect (exitAction, SIGNAL (triggered ()), this, SLOT (close ()));
+  connect (alignWindowsAction, SIGNAL (triggered ()), this, SLOT (alignMdiWindows ()));
+  connect (openEditorAction, SIGNAL (triggered ()), this, SLOT (openEditor ()));
+  connect (reportBugAction, SIGNAL (triggered ()), this, SLOT (openBugTrackerPage ()));
+  connect (agoraAction, SIGNAL (triggered ()), this, SLOT (openAgoraPage ()));
+  connect (octaveForgeAction, SIGNAL (triggered ()), this, SLOT (openOctaveForgePage ()));
+  connect (aboutOctaveAction, SIGNAL (triggered ()), this, SLOT (showAboutOctave ()));
+  connect (aboutQt, SIGNAL (triggered ()), this, SLOT (showAboutQt ()));
+
+  connect (showWorkspaceAction, SIGNAL (toggled (bool)), m_workspaceView, SLOT (setShown (bool)));
+  connect (m_workspaceView, SIGNAL (activeChanged (bool)), showWorkspaceAction, SLOT (setChecked (bool)));
+  connect (showHistoryAction, SIGNAL (toggled (bool)), m_historyDockWidget, SLOT (setShown (bool)));
+  connect (m_historyDockWidget, SIGNAL (activeChanged (bool)), showHistoryAction, SLOT (setChecked (bool)));
+  connect (showFileBrowserAction, SIGNAL (toggled (bool)), m_filesDockWidget, SLOT (setShown (bool)));
+  connect (m_filesDockWidget, SIGNAL (activeChanged (bool)), showFileBrowserAction, SLOT (setChecked (bool)));
+
+  connect (this, SIGNAL (settingsChanged ()), m_workspaceView, SLOT (noticeSettings ()));
+  connect (this, SIGNAL (settingsChanged ()), m_historyDockWidget, SLOT (noticeSettings ()));
+  connect (this, SIGNAL (settingsChanged ()), m_filesDockWidget, SLOT (noticeSettings ()));
+
+  connect (m_filesDockWidget, SIGNAL (openFile (QString)), this, SLOT (handleOpenFileRequest (QString)));
+  connect (m_historyDockWidget, SIGNAL (information (QString)), this, SLOT (reportStatusMessage (QString)));
+  connect (m_historyDockWidget, SIGNAL (commandDoubleClicked (QString)), this, SLOT (handleCommandDoubleClicked (QString)));
+  connect (saveWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleSaveWorkspaceRequest ()));
+  connect (loadWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleLoadWorkspaceRequest ()));
+  connect (clearWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleClearWorkspaceRequest ()));
+
+  setWindowTitle (QString (VERSION_STRING));
+
+  setCentralWidget (m_centralMdiArea);
+  addDockWidget (Qt::LeftDockWidgetArea, m_workspaceView);
+  addDockWidget (Qt::LeftDockWidgetArea, m_historyDockWidget);
+  addDockWidget (Qt::RightDockWidgetArea, m_filesDockWidget);
+  setStatusBar (m_statusBar);
+
+  readSettings ();
+  openWebPage ("http://www.gnu.org/software/octave/doc/interpreter/");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/MainWindow.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,141 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QtGui/QMainWindow>
+#include <QThread>
+#include <QTabWidget>
+#include <QMdiArea>
+#include <QStatusBar>
+#include <QToolBar>
+#include <QQueue>
+#include <Qsci/qsciapis.h>
+#include <QMdiSubWindow>
+#include "ResourceManager.h"
+#include "AbstractTerminalView.h"
+#include "OctaveLink.h"
+#include "WorkspaceView.h"
+#include "HistoryDockWidget.h"
+#include "FilesDockWidget.h"
+#include "BrowserWidget.h"
+#include "irc/IRCWidget.h"
+#include "lexer/lexeroctavegui.h"
+
+class NonClosableMdiSubWindow : public QMdiSubWindow
+{
+  Q_OBJECT
+public:
+  explicit NonClosableMdiSubWindow (QWidget *parent = 0)
+    : QMdiSubWindow (parent) { }
+  virtual ~NonClosableMdiSubWindow () { }
+protected:
+  void closeEvent (QCloseEvent *closeEvent)
+  {
+    closeEvent->ignore ();
+  }
+};
+
+/**
+  * \class MainWindow
+  *
+  * Represents the main window.
+  */
+class MainWindow:public QMainWindow
+{
+Q_OBJECT public:
+  MainWindow (QWidget * parent = 0);
+  ~MainWindow ();
+
+  AbstractTerminalView *terminalView ()
+  {
+    return m_terminalView;
+  }
+
+  HistoryDockWidget *historyDockWidget ()
+  {
+    return m_historyDockWidget;
+  }
+  FilesDockWidget *filesDockWidget ()
+  {
+    return m_filesDockWidget;
+  }
+  bool isCloseApplication ()
+  {
+    return m_closeApplication;
+  }
+
+signals:
+  void settingsChanged ();
+
+public slots:
+  void handleOpenFileRequest (QString fileName);
+  void reportStatusMessage (QString statusMessage);
+  void openWebPage (QString url);
+  void handleSaveWorkspaceRequest ();
+  void handleLoadWorkspaceRequest ();
+  void handleClearWorkspaceRequest ();
+  void handleCommandDoubleClicked (QString command);
+  void handleUnreadMessages (bool yes);
+  void alignMdiWindows ();
+  void openEditor ();
+  void openEditorFile (QString fileName);
+  void openBugTrackerPage ();
+  void openAgoraPage ();
+  void openOctaveForgePage ();
+  void processSettingsDialogRequest ();
+  void showAboutOctave ();
+  void showAboutQt ();
+
+protected:
+  void closeEvent (QCloseEvent * closeEvent);
+  void readSettings ();
+  void writeSettings ();
+
+private:
+  void construct ();
+  void establishOctaveLink ();
+  QMdiArea *m_centralMdiArea;
+
+  // Mdi sub windows.
+  AbstractTerminalView *m_terminalView;
+  BrowserWidget *m_documentationWidget;
+  IRCWidget *m_ircWidget;
+
+  NonClosableMdiSubWindow *m_terminalViewSubWindow;
+  NonClosableMdiSubWindow *m_documentationWidgetSubWindow;
+  NonClosableMdiSubWindow *m_ircWidgetSubWindow;
+
+  // Dock widgets.
+  WorkspaceView *m_workspaceView;
+  HistoryDockWidget *m_historyDockWidget;
+  FilesDockWidget *m_filesDockWidget;
+
+  // Editor's lexer
+  LexerOctaveGui *m_lexer;
+  QsciAPIs *m_lexerAPI;
+
+  // Toolbars.
+  QStatusBar *m_statusBar;
+
+  // Flag for closing whole application
+  bool m_closeApplication;
+
+};
+
+#endif // MAINWINDOW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/OctaveGUI.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,96 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <QtGui/QApplication>
+#include <QTranslator>
+#include <QSettings>
+#include "CommandLineParser.h"
+#include "WelcomeWizard.h"
+#include "ResourceManager.h"
+#include "MainWindow.h"
+
+int
+main (int argc, char *argv[])
+{
+  QApplication application (argc, argv);
+
+  while (true)
+    {
+      if (ResourceManager::instance ()->isFirstRun ())
+        {
+          WelcomeWizard welcomeWizard;
+          int returnCode = welcomeWizard.exec ();
+
+          QSettings *settings = ResourceManager::instance ()->settings ();
+          settings->setValue ("connectOnStartup", true);
+          settings->setValue ("showMessageOfTheDay", true);
+          settings->setValue ("showTopic", true);
+          settings->setValue ("autoIdentification", false);
+          settings->setValue ("nickServPassword", "");
+          settings->setValue ("useCustomFileEditor", false);
+          settings->setValue ("customFileEditor", "emacs");
+          settings->setValue ("editor/showLineNumbers", true);
+          settings->setValue ("editor/highlightActualLine", true);
+          settings->setValue ("editor/codeCompletion", true);
+          settings->setValue ("editor/fontName", "Monospace");
+          settings->setValue ("editor/fontSize", 10);
+          settings->setValue ("editor/shortWindowTitle", true);
+          settings->setValue ("showFilenames", true);
+          settings->setValue ("showFileSize", false);
+          settings->setValue ("showFileType", false);
+          settings->setValue ("showLastModified", false);
+          settings->setValue ("showHiddenFiles", false);
+          settings->setValue ("useAlternatingRowColors", true);
+          settings->setValue ("useProxyServer", false);
+          settings->setValue ("proxyType", "Sock5Proxy");
+          settings->setValue ("proxyHostName", "none");
+          settings->setValue ("proxyPort", 8080);
+          settings->setValue ("proxyUserName", "");
+          settings->setValue ("proxyPassword", "");
+          settings->sync ();
+          ResourceManager::instance ()->reloadSettings ();
+
+          application.quit ();
+          // We are in an infinite loop, so everything else than a return
+          // will cause the application to restart from the very beginning.
+          if (returnCode == QDialog::Rejected)
+            return 0;
+        }
+      else
+        {
+          CommandLineParser commandLineParser;
+          commandLineParser.registerOption ("--config", "-c", "Tells OctaveGUI to use that configuration file.", true);
+          commandLineParser.parse (argc, argv);
+
+          QSettings *settings = ResourceManager::instance ()->settings ();
+          QString language = settings->value ("language").toString ();
+
+          QString translatorFile = ResourceManager::instance ()->findTranslatorFile (language);
+          QTranslator translator;
+          translator.load (translatorFile);
+          application.installTranslator (&translator);
+
+          ResourceManager::instance ()->updateNetworkSettings ();
+          ResourceManager::instance ()->loadIcons ();
+
+          MainWindow w;
+          w.show ();
+          w.activateWindow();
+          return application.exec ();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/ResourceManager.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1687 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ResourceManager.h"
+#include <QFile>
+#include <QNetworkProxy>
+
+ResourceManager ResourceManager::m_singleton;
+
+ResourceManager::ResourceManager ()
+{
+  m_settings = 0;
+  reloadSettings ();
+}
+
+ResourceManager::~ResourceManager ()
+{
+  delete m_settings;
+}
+
+QSettings *
+ResourceManager::settings ()
+{
+  return m_settings;
+}
+
+QString
+ResourceManager::homePath ()
+{
+  return m_homePath;
+}
+
+void
+ResourceManager::reloadSettings ()
+{
+  QDesktopServices desktopServices;
+  m_homePath = desktopServices.storageLocation (QDesktopServices::HomeLocation);
+  setSettings(m_homePath + "/.octave-gui");
+}
+
+void
+ResourceManager::setSettings (QString file)
+{
+  delete m_settings;
+
+  m_firstRun = false;
+  if (!QFile::exists (file))
+    m_firstRun = true;
+
+  // If the settings file does not exist, QSettings automatically creates it.
+  // Therefore we have to check if it exists before instantiating the settings object.
+  // That way we can detect if the user ran this application before.
+  m_settings = new QSettings (file, QSettings::IniFormat);
+}
+
+QString
+ResourceManager::findTranslatorFile (QString language)
+{
+  // TODO: Quick hack to be able to test language files.
+  return QString("../languages/%1.qm").arg(language);
+}
+
+QIcon
+ResourceManager::icon (Icon icon)
+{
+  if (m_icons.contains (icon))
+    {
+      return m_icons [icon];
+    }
+  return QIcon ();
+}
+
+bool
+ResourceManager::isFirstRun ()
+{
+  return m_firstRun;
+}
+
+void
+ResourceManager::updateNetworkSettings ()
+{
+  QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy;
+  if (m_settings->value ("useProxyServer").toBool ())
+    {
+      QString proxyTypeString = m_settings->value ("proxyType").toString ();
+      if (proxyTypeString == "Socks5Proxy")
+        {
+          proxyType = QNetworkProxy::Socks5Proxy;
+        }
+      else if (proxyTypeString == "HttpProxy")
+        {
+          proxyType = QNetworkProxy::HttpProxy;
+        }
+    }
+
+  QNetworkProxy proxy;
+  proxy.setType (proxyType);
+  proxy.setHostName (m_settings->value ("proxyHostName").toString ());
+  proxy.setPort (m_settings->value ("proxyPort").toInt ());
+  proxy.setUser (m_settings->value ("proxyUserName").toString ());
+  proxy.setPassword (m_settings->value ("proxyPassword").toString ());
+  QNetworkProxy::setApplicationProxy (proxy);
+}
+
+void
+ResourceManager::loadIcons ()
+{
+  m_icons [ResourceManager::Octave] = QIcon ("../media/logo.png");
+  m_icons [ResourceManager::Terminal] = QIcon ("../media/terminal.png");
+  m_icons [ResourceManager::Documentation] = QIcon ("../media/help_index.png");
+  m_icons [ResourceManager::Chat] = QIcon ("../media/chat.png");
+  m_icons [ResourceManager::ChatNewMessage] = QIcon ("../media/jabber_protocol.png");
+}
+
+const char*
+ResourceManager::octaveKeywords ()
+{
+  return
+      ".nargin. "
+      "EDITOR "
+      "EXEC_PATH "
+      "F_DUPFD "
+      "F_GETFD "
+      "F_GETFL "
+      "F_SETFD "
+      "F_SETFL "
+      "I "
+      "IMAGE_PATH "
+      "Inf "
+      "J "
+      "NA "
+      "NaN "
+      "OCTAVE_HOME "
+      "OCTAVE_VERSION "
+      "O_APPEND "
+      "O_ASYNC "
+      "O_CREAT "
+      "O_EXCL "
+      "O_NONBLOCK "
+      "O_RDONLY "
+      "O_RDWR "
+      "O_SYNC "
+      "O_TRUNC "
+      "O_WRONLY "
+      "PAGER "
+      "PAGER_FLAGS "
+      "PS1 "
+      "PS2 "
+      "PS4 "
+      "P_tmpdir "
+      "SEEK_CUR "
+      "SEEK_END "
+      "SEEK_SET "
+      "SIG "
+      "S_ISBLK "
+      "S_ISCHR "
+      "S_ISDIR "
+      "S_ISFIFO "
+      "S_ISLNK "
+      "S_ISREG "
+      "S_ISSOCK "
+      "WCONTINUE "
+      "WCOREDUMP "
+      "WEXITSTATUS "
+      "WIFCONTINUED "
+      "WIFEXITED "
+      "WIFSIGNALED "
+      "WIFSTOPPED "
+      "WNOHANG "
+      "WSTOPSIG "
+      "WTERMSIG "
+      "WUNTRACED "
+      "__accumarray_max__ "
+      "__accumarray_min__ "
+      "__accumarray_sum__ "
+      "__accumdim_sum__ "
+      "__all_opts__ "
+      "__builtins__ "
+      "__calc_dimensions__ "
+      "__contourc__ "
+      "__current_scope__ "
+      "__delaunayn__ "
+      "__dispatch__ "
+      "__display_tokens__ "
+      "__dsearchn__ "
+      "__dump_symtab_info__ "
+      "__end__ "
+      "__error_text__ "
+      "__finish__ "
+      "__fltk_ginput__ "
+      "__fltk_print__ "
+      "__fltk_uigetfile__ "
+      "__ftp__ "
+      "__ftp_ascii__ "
+      "__ftp_binary__ "
+      "__ftp_close__ "
+      "__ftp_cwd__ "
+      "__ftp_delete__ "
+      "__ftp_dir__ "
+      "__ftp_mget__ "
+      "__ftp_mkdir__ "
+      "__ftp_mode__ "
+      "__ftp_mput__ "
+      "__ftp_pwd__ "
+      "__ftp_rename__ "
+      "__ftp_rmdir__ "
+      "__get__ "
+      "__glpk__ "
+      "__gnuplot_drawnow__ "
+      "__gnuplot_get_var__ "
+      "__gnuplot_ginput__ "
+      "__gnuplot_has_feature__ "
+      "__gnuplot_open_stream__ "
+      "__gnuplot_print__ "
+      "__gnuplot_version__ "
+      "__go_axes__ "
+      "__go_axes_init__ "
+      "__go_close_all__ "
+      "__go_delete__ "
+      "__go_draw_axes__ "
+      "__go_draw_figure__ "
+      "__go_execute_callback__ "
+      "__go_figure__ "
+      "__go_figure_handles__ "
+      "__go_handles__ "
+      "__go_hggroup__ "
+      "__go_image__ "
+      "__go_line__ "
+      "__go_patch__ "
+      "__go_surface__ "
+      "__go_text__ "
+      "__go_uimenu__ "
+      "__gud_mode__ "
+      "__image_pixel_size__ "
+      "__init_fltk__ "
+      "__isa_parent__ "
+      "__keywords__ "
+      "__lexer_debug_flag__ "
+      "__lin_interpn__ "
+      "__list_functions__ "
+      "__magick_finfo__ "
+      "__magick_format_list__ "
+      "__magick_read__ "
+      "__magick_write__ "
+      "__makeinfo__ "
+      "__marching_cube__ "
+      "__next_line_color__ "
+      "__next_line_style__ "
+      "__operators__ "
+      "__parent_classes__ "
+      "__parser_debug_flag__ "
+      "__pathorig__ "
+      "__pchip_deriv__ "
+      "__plt_get_axis_arg__ "
+      "__print_parse_opts__ "
+      "__qp__ "
+      "__request_drawnow__ "
+      "__sort_rows_idx__ "
+      "__strip_html_tags__ "
+      "__token_count__ "
+      "__varval__ "
+      "__version_info__ "
+      "__voronoi__ "
+      "__which__ "
+      "abs "
+      "accumarray "
+      "accumdim "
+      "acos "
+      "acosd "
+      "acosh "
+      "acot "
+      "acotd "
+      "acoth "
+      "acsc "
+      "acscd "
+      "acsch "
+      "add_input_event_hook "
+      "addlistener "
+      "addpath "
+      "addproperty "
+      "addtodate "
+      "airy "
+      "all "
+      "allchild "
+      "allow_noninteger_range_as_index "
+      "amd "
+      "ancestor "
+      "and "
+      "angle "
+      "anova "
+      "ans "
+      "any "
+      "arch_fit "
+      "arch_rnd "
+      "arch_test "
+      "area "
+      "arg "
+      "argnames "
+      "argv "
+      "arma_rnd "
+      "arrayfun "
+      "asctime "
+      "asec "
+      "asecd "
+      "asech "
+      "asin "
+      "asind "
+      "asinh "
+      "assert "
+      "assignin "
+      "atan "
+      "atan2 "
+      "atand "
+      "atanh "
+      "atexit "
+      "autocor "
+      "autocov "
+      "autoload "
+      "autoreg_matrix "
+      "autumn "
+      "available_graphics_toolkits "
+      "axes "
+      "axis "
+      "balance "
+      "bar "
+      "barh "
+      "bartlett "
+      "bartlett_test "
+      "base2dec "
+      "beep "
+      "beep_on_error "
+      "bessel "
+      "besselh "
+      "besseli "
+      "besselj "
+      "besselk "
+      "bessely "
+      "beta "
+      "betacdf "
+      "betai "
+      "betainc "
+      "betainv "
+      "betaln "
+      "betapdf "
+      "betarnd "
+      "bicgstab "
+      "bicubic "
+      "bin2dec "
+      "bincoeff "
+      "binocdf "
+      "binoinv "
+      "binopdf "
+      "binornd "
+      "bitand "
+      "bitcmp "
+      "bitget "
+      "bitmax "
+      "bitor "
+      "bitpack "
+      "bitset "
+      "bitshift "
+      "bitunpack "
+      "bitxor "
+      "blackman "
+      "blanks "
+      "blkdiag "
+      "blkmm "
+      "bone "
+      "box "
+      "break "
+      "brighten "
+      "bsxfun "
+      "bug_report "
+      "builtin "
+      "bunzip2 "
+      "bzip2 "
+      "calendar "
+      "canonicalize_file_name "
+      "cart2pol "
+      "cart2sph "
+      "case "
+      "cast "
+      "cat "
+      "catch "
+      "cauchy_cdf "
+      "cauchy_inv "
+      "cauchy_pdf "
+      "cauchy_rnd "
+      "caxis "
+      "cbrt "
+      "ccolamd "
+      "cd "
+      "ceil "
+      "cell "
+      "cell2mat "
+      "cell2struct "
+      "celldisp "
+      "cellfun "
+      "cellidx "
+      "cellindexmat "
+      "cellslices "
+      "cellstr "
+      "center "
+      "cgs "
+      "char "
+      "chdir "
+      "chi2cdf "
+      "chi2inv "
+      "chi2pdf "
+      "chi2rnd "
+      "chisquare_test_homogeneity "
+      "chisquare_test_independence "
+      "chol "
+      "chol2inv "
+      "choldelete "
+      "cholinsert "
+      "cholinv "
+      "cholshift "
+      "cholupdate "
+      "chop "
+      "circshift "
+      "cla "
+      "clabel "
+      "class "
+      "clc "
+      "clear "
+      "clf "
+      "clg "
+      "clock "
+      "cloglog "
+      "close "
+      "closereq "
+      "colamd "
+      "colloc "
+      "colon "
+      "colorbar "
+      "colormap "
+      "colperm "
+      "colstyle "
+      "columns "
+      "comet "
+      "comet3 "
+      "comma "
+      "command_line_path "
+      "common_size "
+      "commutation_matrix "
+      "compan "
+      "compare_versions "
+      "compass "
+      "complement "
+      "completion_append_char "
+      "completion_matches "
+      "complex "
+      "computer "
+      "cond "
+      "condest "
+      "confirm_recursive_rmdir "
+      "conj "
+      "continue "
+      "contour "
+      "contour3 "
+      "contourc "
+      "contourf "
+      "contrast "
+      "conv "
+      "conv2 "
+      "convhull "
+      "convhulln "
+      "convn "
+      "cool "
+      "copper "
+      "copyfile "
+      "cor "
+      "cor_test "
+      "corrcoef "
+      "cos "
+      "cosd "
+      "cosh "
+      "cot "
+      "cotd "
+      "coth "
+      "cov "
+      "cplxpair "
+      "cputime "
+      "cquad "
+      "crash_dumps_octave_core "
+      "create_set "
+      "cross "
+      "csc "
+      "cscd "
+      "csch "
+      "cstrcat "
+      "csvread "
+      "csvwrite "
+      "csymamd "
+      "ctime "
+      "ctranspose "
+      "cummax "
+      "cummin "
+      "cumprod "
+      "cumsum "
+      "cumtrapz "
+      "curl "
+      "cut "
+      "cylinder "
+      "daspect "
+      "daspk "
+      "daspk_options "
+      "dasrt "
+      "dasrt_options "
+      "dassl "
+      "dassl_options "
+      "date "
+      "datenum "
+      "datestr "
+      "datetick "
+      "datevec "
+      "dbclear "
+      "dbcont "
+      "dbdown "
+      "dblquad "
+      "dbnext "
+      "dbquit "
+      "dbstack "
+      "dbstatus "
+      "dbstep "
+      "dbstop "
+      "dbtype "
+      "dbup "
+      "dbwhere "
+      "deal "
+      "deblank "
+      "debug "
+      "debug_on_error "
+      "debug_on_interrupt "
+      "debug_on_warning "
+      "dec2base "
+      "dec2bin "
+      "dec2hex "
+      "deconv "
+      "default_save_options "
+      "del2 "
+      "delaunay "
+      "delaunay3 "
+      "delaunayn "
+      "delete "
+      "dellistener "
+      "demo "
+      "det "
+      "detrend "
+      "diag "
+      "diary "
+      "diff "
+      "diffpara "
+      "diffuse "
+      "dir "
+      "discrete_cdf "
+      "discrete_inv "
+      "discrete_pdf "
+      "discrete_rnd "
+      "disp "
+      "dispatch "
+      "display "
+      "divergence "
+      "dlmread "
+      "dlmwrite "
+      "dmperm "
+      "dmult "
+      "do "
+      "do_braindead_shortcircuit_evaluation "
+      "do_string_escapes "
+      "doc "
+      "doc_cache_file "
+      "dos "
+      "dot "
+      "double "
+      "drawnow "
+      "dsearch "
+      "dsearchn "
+      "dump_prefs "
+      "dup2 "
+      "duplication_matrix "
+      "durbinlevinson "
+      "e "
+      "echo "
+      "echo_executing_commands "
+      "edit "
+      "edit_history "
+      "eig "
+      "eigs "
+      "ellipsoid "
+      "else "
+      "elseif "
+      "empirical_cdf "
+      "empirical_inv "
+      "empirical_pdf "
+      "empirical_rnd "
+      "end "
+      "end_try_catch "
+      "end_unwind_protect "
+      "endfor "
+      "endfunction "
+      "endgrent "
+      "endif "
+      "endpwent "
+      "endswitch "
+      "endwhile "
+      "eomday "
+      "eps "
+      "eq "
+      "erf "
+      "erfc "
+      "erfcx "
+      "erfinv "
+      "errno "
+      "errno_list "
+      "error "
+      "error_text "
+      "errorbar "
+      "etime "
+      "etree "
+      "etreeplot "
+      "eval "
+      "evalin "
+      "example "
+      "exec "
+      "exist "
+      "exit "
+      "exp "
+      "expcdf "
+      "expinv "
+      "expm "
+      "expm1 "
+      "exppdf "
+      "exprnd "
+      "eye "
+      "ezcontour "
+      "ezcontourf "
+      "ezmesh "
+      "ezmeshc "
+      "ezplot "
+      "ezplot3 "
+      "ezpolar "
+      "ezsurf "
+      "ezsurfc "
+      "f_test_regression "
+      "factor "
+      "factorial "
+      "fail "
+      "false "
+      "fcdf "
+      "fclear "
+      "fclose "
+      "fcntl "
+      "fdisp "
+      "feather "
+      "feof "
+      "ferror "
+      "feval "
+      "fflush "
+      "fft "
+      "fft2 "
+      "fftconv "
+      "fftfilt "
+      "fftn "
+      "fftshift "
+      "fftw "
+      "fgetl "
+      "fgets "
+      "fieldnames "
+      "figure "
+      "file_in_loadpath "
+      "file_in_path "
+      "fileattrib "
+      "filemarker "
+      "fileparts "
+      "fileread "
+      "filesep "
+      "fill "
+      "filter "
+      "filter2 "
+      "find "
+      "find_dir_in_path "
+      "findall "
+      "findobj "
+      "findstr "
+      "finite "
+      "finv "
+      "fix "
+      "fixed_point_format "
+      "flag "
+      "flipdim "
+      "fliplr "
+      "flipud "
+      "floor "
+      "fminbnd "
+      "fminunc "
+      "fmod "
+      "fnmatch "
+      "fopen "
+      "for "
+      "fork "
+      "format "
+      "formula "
+      "fpdf "
+      "fplot "
+      "fprintf "
+      "fputs "
+      "fractdiff "
+      "fread "
+      "freport "
+      "freqz "
+      "freqz_plot "
+      "frewind "
+      "frnd "
+      "fscanf "
+      "fseek "
+      "fskipl "
+      "fsolve "
+      "fstat "
+      "ftell "
+      "full "
+      "fullfile "
+      "func2str "
+      "function "
+      "functions "
+      "fwrite "
+      "fzero "
+      "gamcdf "
+      "gaminv "
+      "gamma "
+      "gammai "
+      "gammainc "
+      "gammaln "
+      "gampdf "
+      "gamrnd "
+      "gca "
+      "gcbf "
+      "gcbo "
+      "gcd "
+      "gcf "
+      "ge "
+      "gen_doc_cache "
+      "genpath "
+      "genvarname "
+      "geocdf "
+      "geoinv "
+      "geopdf "
+      "geornd "
+      "get "
+      "get_first_help_sentence "
+      "get_help_text "
+      "get_help_text_from_file "
+      "getappdata "
+      "getegid "
+      "getenv "
+      "geteuid "
+      "getfield "
+      "getgid "
+      "getgrent "
+      "getgrgid "
+      "getgrnam "
+      "gethostname "
+      "getpgrp "
+      "getpid "
+      "getppid "
+      "getpwent "
+      "getpwnam "
+      "getpwuid "
+      "getrusage "
+      "getuid "
+      "ginput "
+      "givens "
+      "glob "
+      "global "
+      "glpk "
+      "glpkmex "
+      "gls "
+      "gmap40 "
+      "gmres "
+      "gmtime "
+      "gnuplot_binary "
+      "gplot "
+      "gradient "
+      "graphics_toolkit "
+      "gray "
+      "gray2ind "
+      "grid "
+      "griddata "
+      "griddata3 "
+      "griddatan "
+      "gt "
+      "gtext "
+      "gunzip "
+      "gzip "
+      "hadamard "
+      "hamming "
+      "hankel "
+      "hanning "
+      "help "
+      "hess "
+      "hex2dec "
+      "hex2num "
+      "hggroup "
+      "hidden "
+      "hilb "
+      "hist "
+      "histc "
+      "history "
+      "history_control "
+      "history_file "
+      "history_size "
+      "history_timestamp_format_string "
+      "hold "
+      "home "
+      "horzcat "
+      "hot "
+      "hotelling_test "
+      "hotelling_test_2 "
+      "housh "
+      "hsv "
+      "hsv2rgb "
+      "hurst "
+      "hygecdf "
+      "hygeinv "
+      "hygepdf "
+      "hygernd "
+      "hypot "
+      "i "
+      "idivide "
+      "if "
+      "ifelse "
+      "ifft "
+      "ifft2 "
+      "ifftn "
+      "ifftshift "
+      "ignore_function_time_stamp "
+      "imag "
+      "image "
+      "imagesc "
+      "imfinfo "
+      "imread "
+      "imshow "
+      "imwrite "
+      "ind2gray "
+      "ind2rgb "
+      "ind2sub "
+      "index "
+      "inf "
+      "inferiorto "
+      "info "
+      "info_file "
+      "info_program "
+      "inline "
+      "inpolygon "
+      "input "
+      "inputname "
+      "int16 "
+      "int2str "
+      "int32 "
+      "int64 "
+      "int8 "
+      "interp1 "
+      "interp1q "
+      "interp2 "
+      "interp3 "
+      "interpft "
+      "interpn "
+      "intersect "
+      "intmax "
+      "intmin "
+      "intwarning "
+      "inv "
+      "inverse "
+      "invhilb "
+      "ipermute "
+      "iqr "
+      "is_absolute_filename "
+      "is_duplicate_entry "
+      "is_global "
+      "is_leap_year "
+      "is_rooted_relative_filename "
+      "is_valid_file_id "
+      "isa "
+      "isalnum "
+      "isalpha "
+      "isappdata "
+      "isargout "
+      "isascii "
+      "isbool "
+      "iscell "
+      "iscellstr "
+      "ischar "
+      "iscntrl "
+      "iscolumn "
+      "iscommand "
+      "iscomplex "
+      "isdebugmode "
+      "isdefinite "
+      "isdeployed "
+      "isdigit "
+      "isdir "
+      "isempty "
+      "isequal "
+      "isequalwithequalnans "
+      "isfield "
+      "isfigure "
+      "isfinite "
+      "isfloat "
+      "isglobal "
+      "isgraph "
+      "ishandle "
+      "ishermitian "
+      "ishghandle "
+      "ishold "
+      "isieee "
+      "isindex "
+      "isinf "
+      "isinteger "
+      "iskeyword "
+      "isletter "
+      "islogical "
+      "islower "
+      "ismac "
+      "ismatrix "
+      "ismember "
+      "ismethod "
+      "isna "
+      "isnan "
+      "isnull "
+      "isnumeric "
+      "isobject "
+      "isocolors "
+      "isonormals "
+      "isosurface "
+      "ispc "
+      "isprime "
+      "isprint "
+      "isprop "
+      "ispunct "
+      "israwcommand "
+      "isreal "
+      "isrow "
+      "isscalar "
+      "issorted "
+      "isspace "
+      "issparse "
+      "issquare "
+      "isstr "
+      "isstrprop "
+      "isstruct "
+      "issymmetric "
+      "isunix "
+      "isupper "
+      "isvarname "
+      "isvector "
+      "isxdigit "
+      "j "
+      "jet "
+      "kbhit "
+      "kendall "
+      "keyboard "
+      "kill "
+      "kolmogorov_smirnov_cdf "
+      "kolmogorov_smirnov_test "
+      "kolmogorov_smirnov_test_2 "
+      "kron "
+      "kruskal_wallis_test "
+      "krylov "
+      "krylovb "
+      "kurtosis "
+      "laplace_cdf "
+      "laplace_inv "
+      "laplace_pdf "
+      "laplace_rnd "
+      "lasterr "
+      "lasterror "
+      "lastwarn "
+      "lchol "
+      "lcm "
+      "ldivide "
+      "le "
+      "legend "
+      "legendre "
+      "length "
+      "lgamma "
+      "license "
+      "lin2mu "
+      "line "
+      "link "
+      "linkprop "
+      "linspace "
+      "list "
+      "list_in_columns "
+      "list_primes "
+      "load "
+      "loadaudio "
+      "loadimage "
+      "loadobj "
+      "localtime "
+      "log "
+      "log10 "
+      "log1p "
+      "log2 "
+      "logical "
+      "logistic_cdf "
+      "logistic_inv "
+      "logistic_pdf "
+      "logistic_regression "
+      "logistic_rnd "
+      "logit "
+      "loglog "
+      "loglogerr "
+      "logm "
+      "logncdf "
+      "logninv "
+      "lognpdf "
+      "lognrnd "
+      "logspace "
+      "lookfor "
+      "lookup "
+      "lower "
+      "ls "
+      "ls_command "
+      "lsode "
+      "lsode_options "
+      "lsqnonneg "
+      "lstat "
+      "lt "
+      "lu "
+      "luinc "
+      "luupdate "
+      "magic "
+      "mahalanobis "
+      "make_absolute_filename "
+      "makeinfo_program "
+      "manova "
+      "mark_as_command "
+      "mark_as_rawcommand "
+      "mat2cell "
+      "mat2str "
+      "matlabroot "
+      "matrix_type "
+      "max "
+      "max_recursion_depth "
+      "mcnemar_test "
+      "md5sum "
+      "mean "
+      "meansq "
+      "median "
+      "menu "
+      "merge "
+      "mesh "
+      "meshc "
+      "meshgrid "
+      "meshz "
+      "methods "
+      "mex "
+      "mexext "
+      "mfilename "
+      "mgorth "
+      "min "
+      "minus "
+      "mislocked "
+      "missing_function_hook "
+      "mist "
+      "mkdir "
+      "mkfifo "
+      "mkoctfile "
+      "mkpp "
+      "mkstemp "
+      "mktime "
+      "mldivide "
+      "mlock "
+      "mod "
+      "mode "
+      "moment "
+      "more "
+      "most "
+      "movefile "
+      "mpoles "
+      "mpower "
+      "mrdivide "
+      "mtimes "
+      "mu2lin "
+      "munlock "
+      "namelengthmax "
+      "nan "
+      "nargchk "
+      "nargin "
+      "nargout "
+      "nargoutchk "
+      "native_float_format "
+      "nbincdf "
+      "nbininv "
+      "nbinpdf "
+      "nbinrnd "
+      "nchoosek "
+      "ndgrid "
+      "ndims "
+      "ne "
+      "newplot "
+      "news "
+      "nextpow2 "
+      "nfields "
+      "nnz "
+      "nonzeros "
+      "norm "
+      "normcdf "
+      "normest "
+      "norminv "
+      "normpdf "
+      "normrnd "
+      "not "
+      "now "
+      "nproc "
+      "nth_element "
+      "nthroot "
+      "ntsc2rgb "
+      "null "
+      "num2cell "
+      "num2hex "
+      "num2str "
+      "numel "
+      "nzmax "
+      "ocean "
+      "octave_config_info "
+      "octave_core_file_limit "
+      "octave_core_file_name "
+      "octave_core_file_options "
+      "octave_tmp_file_name "
+      "ols "
+      "onCleanup "
+      "onenormest "
+      "ones "
+      "optimget "
+      "optimize_subsasgn_calls "
+      "optimset "
+      "or "
+      "orderfields "
+      "orient "
+      "orth "
+      "otherwise "
+      "output_max_field_width "
+      "output_precision "
+      "pack "
+      "page_output_immediately "
+      "page_screen_output "
+      "paren "
+      "pareto "
+      "parseparams "
+      "pascal "
+      "patch "
+      "path "
+      "pathdef "
+      "pathsep "
+      "pause "
+      "pbaspect "
+      "pcg "
+      "pchip "
+      "pclose "
+      "pcolor "
+      "pcr "
+      "peaks "
+      "periodogram "
+      "perl "
+      "perms "
+      "permute "
+      "perror "
+      "persistent "
+      "pi "
+      "pie "
+      "pie3 "
+      "pink "
+      "pinv "
+      "pipe "
+      "pkg "
+      "planerot "
+      "playaudio "
+      "plot "
+      "plot3 "
+      "plotmatrix "
+      "plotyy "
+      "plus "
+      "poisscdf "
+      "poissinv "
+      "poisspdf "
+      "poissrnd "
+      "pol2cart "
+      "polar "
+      "poly "
+      "polyaffine "
+      "polyarea "
+      "polyder "
+      "polyderiv "
+      "polyfit "
+      "polygcd "
+      "polyint "
+      "polyout "
+      "polyreduce "
+      "polyval "
+      "polyvalm "
+      "popen "
+      "popen2 "
+      "postpad "
+      "pow2 "
+      "power "
+      "powerset "
+      "ppder "
+      "ppint "
+      "ppjumps "
+      "ppplot "
+      "ppval "
+      "pqpnonneg "
+      "prctile "
+      "prepad "
+      "primes "
+      "print "
+      "print_empty_dimensions "
+      "print_struct_array_contents "
+      "print_usage "
+      "printf "
+      "prism "
+      "probit "
+      "prod "
+      "program_invocation_name "
+      "program_name "
+      "prop_test_2 "
+      "putenv "
+      "puts "
+      "pwd "
+      "qp "
+      "qqplot "
+      "qr "
+      "qrdelete "
+      "qrinsert "
+      "qrshift "
+      "qrupdate "
+      "quad "
+      "quad_options "
+      "quadcc "
+      "quadgk "
+      "quadl "
+      "quadv "
+      "quantile "
+      "quit "
+      "quiver "
+      "quiver3 "
+      "qz "
+      "qzhess "
+      "rainbow "
+      "rand "
+      "rande "
+      "randg "
+      "randi "
+      "randn "
+      "randp "
+      "randperm "
+      "range "
+      "rank "
+      "ranks "
+      "rat "
+      "rats "
+      "rcond "
+      "rdivide "
+      "re_read_readline_init_file "
+      "read_readline_init_file "
+      "readdir "
+      "readlink "
+      "real "
+      "reallog "
+      "realmax "
+      "realmin "
+      "realpow "
+      "realsqrt "
+      "record "
+      "rectangle "
+      "rectint "
+      "refresh "
+      "refreshdata "
+      "regexp "
+      "regexpi "
+      "regexprep "
+      "regexptranslate "
+      "rehash "
+      "rem "
+      "remove_input_event_hook "
+      "rename "
+      "repelems "
+      "replot "
+      "repmat "
+      "reset "
+      "reshape "
+      "residue "
+      "resize "
+      "restoredefaultpath "
+      "rethrow "
+      "return "
+      "rgb2hsv "
+      "rgb2ind "
+      "rgb2ntsc "
+      "ribbon "
+      "rindex "
+      "rmappdata "
+      "rmdir "
+      "rmfield "
+      "rmpath "
+      "roots "
+      "rose "
+      "rosser "
+      "rot90 "
+      "rotdim "
+      "round "
+      "roundb "
+      "rows "
+      "rref "
+      "rsf2csf "
+      "run "
+      "run_count "
+      "run_history "
+      "run_test "
+      "rundemos "
+      "runlength "
+      "runtests "
+      "save "
+      "save_header_format_string "
+      "save_precision "
+      "saveas "
+      "saveaudio "
+      "saveimage "
+      "saveobj "
+      "savepath "
+      "saving_history "
+      "scanf "
+      "scatter "
+      "scatter3 "
+      "schur "
+      "sec "
+      "secd "
+      "sech "
+      "semicolon "
+      "semilogx "
+      "semilogxerr "
+      "semilogy "
+      "semilogyerr "
+      "set "
+      "setappdata "
+      "setaudio "
+      "setdiff "
+      "setenv "
+      "setfield "
+      "setgrent "
+      "setpwent "
+      "setstr "
+      "setxor "
+      "shading "
+      "shell_cmd "
+      "shg "
+      "shift "
+      "shiftdim "
+      "sighup_dumps_octave_core "
+      "sign "
+      "sign_test "
+      "sigterm_dumps_octave_core "
+      "silent_functions "
+      "sin "
+      "sinc "
+      "sind "
+      "sinetone "
+      "sinewave "
+      "single "
+      "sinh "
+      "size "
+      "size_equal "
+      "sizemax "
+      "sizeof "
+      "skewness "
+      "sleep "
+      "slice "
+      "sombrero "
+      "sort "
+      "sortrows "
+      "source "
+      "spalloc "
+      "sparse "
+      "sparse_auto_mutate "
+      "spatan2 "
+      "spaugment "
+      "spchol "
+      "spchol2inv "
+      "spcholinv "
+      "spconvert "
+      "spcumprod "
+      "spcumsum "
+      "spdet "
+      "spdiag "
+      "spdiags "
+      "spearman "
+      "spectral_adf "
+      "spectral_xdf "
+      "specular "
+      "speed "
+      "spencer "
+      "speye "
+      "spfind "
+      "spfun "
+      "sph2cart "
+      "sphcat "
+      "sphere "
+      "spinmap "
+      "spinv "
+      "spkron "
+      "splchol "
+      "spline "
+      "split "
+      "split_long_rows "
+      "splu "
+      "spmax "
+      "spmin "
+      "spones "
+      "spparms "
+      "spprod "
+      "spqr "
+      "sprand "
+      "sprandn "
+      "sprandsym "
+      "sprank "
+      "spring "
+      "sprintf "
+      "spstats "
+      "spsum "
+      "spsumsq "
+      "spvcat "
+      "spy "
+      "sqp "
+      "sqrt "
+      "sqrtm "
+      "squeeze "
+      "sscanf "
+      "stairs "
+      "stat "
+      "static "
+      "statistics "
+      "std "
+      "stderr "
+      "stdin "
+      "stdnormal_cdf "
+      "stdnormal_inv "
+      "stdnormal_pdf "
+      "stdnormal_rnd "
+      "stdout "
+      "stem "
+      "stem3 "
+      "stft "
+      "str2double "
+      "str2func "
+      "str2mat "
+      "str2num "
+      "strcat "
+      "strchr "
+      "strcmp "
+      "strcmpi "
+      "strerror "
+      "strfind "
+      "strftime "
+      "string_fill_char "
+      "strjust "
+      "strmatch "
+      "strncmp "
+      "strncmpi "
+      "strptime "
+      "strread "
+      "strrep "
+      "strsplit "
+      "strtok "
+      "strtrim "
+      "strtrunc "
+      "struct "
+      "struct2cell "
+      "struct_levels_to_print "
+      "structfun "
+      "strvcat "
+      "studentize "
+      "sub2ind "
+      "subplot "
+      "subsasgn "
+      "subsindex "
+      "subspace "
+      "subsref "
+      "substr "
+      "substruct "
+      "sum "
+      "summer "
+      "sumsq "
+      "superiorto "
+      "suppress_verbose_help_message "
+      "surf "
+      "surface "
+      "surfc "
+      "surfl "
+      "surfnorm "
+      "svd "
+      "svd_driver "
+      "svds "
+      "swapbytes "
+      "switch "
+      "syl "
+      "sylvester_matrix "
+      "symamd "
+      "symbfact "
+      "symlink "
+      "symrcm "
+      "symvar "
+      "synthesis "
+      "system "
+      "t_test "
+      "t_test_2 "
+      "t_test_regression "
+      "table "
+      "tan "
+      "tand "
+      "tanh "
+      "tar "
+      "tcdf "
+      "tempdir "
+      "tempname "
+      "terminal_size "
+      "test "
+      "test2 "
+      "test3 "
+      "text "
+      "textread "
+      "textscan "
+      "tic "
+      "tilde_expand "
+      "time "
+      "times "
+      "tinv "
+      "title "
+      "tmpfile "
+      "tmpnam "
+      "toascii "
+      "toc "
+      "toeplitz "
+      "tolower "
+      "toupper "
+      "tpdf "
+      "trace "
+      "transpose "
+      "trapz "
+      "treelayout "
+      "treeplot "
+      "tril "
+      "trimesh "
+      "triplequad "
+      "triplot "
+      "trisurf "
+      "triu "
+      "trnd "
+      "true "
+      "try "
+      "tsearch "
+      "tsearchn "
+      "type "
+      "typecast "
+      "typeinfo "
+      "u_test "
+      "uigetdir "
+      "uigetfile "
+      "uimenu "
+      "uint16 "
+      "uint32 "
+      "uint64 "
+      "uint8 "
+      "uiputfile "
+      "umask "
+      "uminus "
+      "uname "
+      "undo_string_escapes "
+      "unidcdf "
+      "unidinv "
+      "unidpdf "
+      "unidrnd "
+      "unifcdf "
+      "unifinv "
+      "unifpdf "
+      "unifrnd "
+      "unimplemented "
+      "union "
+      "unique "
+      "unix "
+      "unlink "
+      "unmark_command "
+      "unmark_rawcommand "
+      "unmkpp "
+      "unpack "
+      "untabify "
+      "untar "
+      "until "
+      "unwind_protect "
+      "unwind_protect_cleanup "
+      "unwrap "
+      "unzip "
+      "uplus "
+      "upper "
+      "urlread "
+      "urlwrite "
+      "usage "
+      "usleep "
+      "validatestring "
+      "values "
+      "vander "
+      "var "
+      "var_test "
+      "varargin "
+      "varargout "
+      "vec "
+      "vech "
+      "vectorize "
+      "ver "
+      "version "
+      "vertcat "
+      "view "
+      "voronoi "
+      "voronoin "
+      "waitforbuttonpress "
+      "waitpid "
+      "warning "
+      "warning_ids "
+      "warranty "
+      "wavread "
+      "wavwrite "
+      "wblcdf "
+      "wblinv "
+      "wblpdf "
+      "wblrnd "
+      "weekday "
+      "weibcdf "
+      "weibinv "
+      "weibpdf "
+      "weibrnd "
+      "welch_test "
+      "what "
+      "which "
+      "while "
+      "white "
+      "whitebg "
+      "who "
+      "whos "
+      "whos_line_format "
+      "wienrnd "
+      "wilcoxon_test "
+      "wilkinson "
+      "winter "
+      "xlabel "
+      "xlim "
+      "xor "
+      "yes_or_no "
+      "ylabel "
+      "ylim "
+      "yulewalker "
+      "z_test "
+      "z_test_2 "
+      "zeros "
+      "zip "
+      "zlabel "
+      "zlim ";
+  /*            "break case catch continue do else elseif end end_unwind_protect "
+              "endfor endfunction endif endswitch endwhile for function "
+              "global if otherwise persistent return switch try until "
+              "unwind_protect unwind_protect_cleanup while";
+  */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/ResourceManager.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,67 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RESOURCEMANAGER_H
+#define RESOURCEMANAGER_H
+
+#include <QSettings>
+#include <QDesktopServices>
+#include <QMap>
+#include <QIcon>
+
+class ResourceManager
+{
+public:
+  enum Icon
+  {
+    Octave,
+    Terminal,
+    Documentation,
+    Chat,
+    ChatNewMessage
+  };
+
+  ~ResourceManager ();
+
+  static ResourceManager *
+  instance ()
+  {
+    return &m_singleton;
+  }
+
+  QSettings *settings ();
+  QString homePath ();
+  void reloadSettings ();
+  void setSettings (QString file);
+  QString findTranslatorFile (QString language);
+  void updateNetworkSettings ();
+  void loadIcons ();
+  QIcon icon (Icon icon);
+  bool isFirstRun ();
+
+  const char *octaveKeywords ();
+private:
+  ResourceManager ();
+
+  QSettings *m_settings;
+  QString m_homePath;
+  QMap <Icon, QIcon> m_icons;
+  static ResourceManager m_singleton;
+  bool m_firstRun;
+};
+
+#endif // RESOURCEMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/SettingsDialog.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,93 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ResourceManager.h"
+#include "SettingsDialog.h"
+#include "ui_SettingsDialog.h"
+#include <QSettings>
+
+SettingsDialog::SettingsDialog (QWidget * parent):
+QDialog (parent), ui (new Ui::SettingsDialog)
+{
+  ui->setupUi (this);
+
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  ui->connectOnStartup->setChecked (settings->value ("connectOnStartup").toBool ());
+  ui->showMessageOfTheDay->setChecked (settings->value ("showMessageOfTheDay").toBool ());
+  ui->showTopic->setChecked (settings->value ("showTopic").toBool ());
+  ui->autoIdentification->setChecked (settings->value ("autoIdentification").toBool ());
+  ui->nickServPassword->setText (settings->value ("nickServPassword").toString ());
+  ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor").toBool ());
+  ui->customFileEditor->setText (settings->value ("customFileEditor").toString ());
+  ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () );
+  ui->editor_highlightActualLine->setChecked (settings->value ("editor/highlightActualLine",true).toBool () );
+  ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () );
+  ui->editor_fontName->setCurrentFont (QFont (settings->value ("editor/fontName","Courier").toString()) );
+  ui->editor_fontSize->setValue (settings->value ("editor/fontSize",10).toInt ());
+  ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",true).toBool ());
+  ui->showFilenames->setChecked (settings->value ("showFilenames").toBool());
+  ui->showFileSize->setChecked (settings->value ("showFileSize").toBool());
+  ui->showFileType->setChecked (settings->value ("showFileType").toBool());
+  ui->showLastModified->setChecked (settings->value ("showLastModified").toBool());
+  ui->showHiddenFiles->setChecked (settings->value ("showHiddenFiles").toBool());
+  ui->useAlternatingRowColors->setChecked (settings->value ("useAlternatingRowColors").toBool());
+  ui->useProxyServer->setChecked (settings->value ("useProxyServer").toBool ());
+  ui->proxyHostName->setText (settings->value ("proxyHostName").toString ());
+
+  int currentIndex = 0;
+  QString proxyTypeString = settings->value ("proxyType").toString ();
+  while ( (currentIndex < ui->proxyType->count ()) && (ui->proxyType->currentText () != proxyTypeString))
+    {
+      currentIndex++;
+      ui->proxyType->setCurrentIndex (currentIndex);
+    }
+
+  ui->proxyPort->setText (settings->value ("proxyPort").toString ());
+  ui->proxyUserName->setText (settings->value ("proxyUserName").toString ());
+  ui->proxyPassword->setText (settings->value ("proxyPassword").toString ());
+}
+
+SettingsDialog::~SettingsDialog ()
+{
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  settings->setValue ("connectOnStartup", ui->connectOnStartup->isChecked ());
+  settings->setValue ("showMessageOfTheDay", ui->showMessageOfTheDay->isChecked ());
+  settings->setValue ("showTopic", ui->showTopic->isChecked ());
+  settings->setValue ("autoIdentification", ui->autoIdentification->isChecked ());
+  settings->setValue ("nickServPassword", ui->nickServPassword->text ());
+  settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ());
+  settings->setValue ("customFileEditor", ui->customFileEditor->text ());
+  settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ());
+  settings->setValue ("editor/highlightActualLine", ui->editor_highlightActualLine->isChecked ());
+  settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ());
+  settings->setValue ("editor/fontName", ui->editor_fontName->currentFont().family());
+  settings->setValue ("editor/fontSize", ui->editor_fontSize->value());
+  settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked());
+  settings->setValue ("showFilenames", ui->showFilenames->isChecked ());
+  settings->setValue ("showFileSize", ui->showFileSize->isChecked ());
+  settings->setValue ("showFileType", ui->showFileType->isChecked ());
+  settings->setValue ("showLastModified", ui->showLastModified->isChecked ());
+  settings->setValue ("showHiddenFiles", ui->showHiddenFiles->isChecked ());
+  settings->setValue ("useAlternatingRowColors", ui->useAlternatingRowColors->isChecked ());
+  settings->setValue ("useProxyServer", ui->useProxyServer->isChecked ());
+  settings->setValue ("proxyType", ui->proxyType->currentText ());
+  settings->setValue ("proxyHostName", ui->proxyHostName->text ());
+  settings->setValue ("proxyPort", ui->proxyPort->text ());
+  settings->setValue ("proxyUserName", ui->proxyUserName->text ());
+  settings->setValue ("proxyPassword", ui->proxyPassword->text ());
+  delete ui;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/SettingsDialog.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,38 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QDialog>
+
+namespace Ui
+{
+  class SettingsDialog;
+}
+
+class SettingsDialog:public QDialog
+{
+Q_OBJECT public:
+  explicit SettingsDialog (QWidget * parent);
+  ~SettingsDialog ();
+
+private:
+  Ui::SettingsDialog * ui;
+};
+
+#endif // SETTINGSDIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/SettingsDialog.ui	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,680 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SettingsDialog</class>
+ <widget class="QDialog" name="SettingsDialog">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>500</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>500</width>
+    <height>300</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>500</width>
+    <height>300</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Settings</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="chatTab">
+      <attribute name="title">
+       <string>Chat</string>
+      </attribute>
+      <layout class="QGridLayout" name="gridLayout_2">
+       <item row="0" column="0">
+        <layout class="QVBoxLayout" name="verticalLayout">
+         <item>
+          <widget class="QCheckBox" name="connectOnStartup">
+           <property name="text">
+            <string>Connect to #octave on startup</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="showMessageOfTheDay">
+           <property name="text">
+            <string>Show message of the day</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="showTopic">
+           <property name="text">
+            <string>Show topic</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="autoIdentification">
+           <property name="text">
+            <string>Automatically identify on NickServ</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</string>
+           </property>
+           <property name="wordWrap">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout">
+           <item>
+            <spacer name="horizontalSpacer">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>40</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item>
+            <widget class="QLabel" name="label">
+             <property name="text">
+              <string>Password:</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QLineEdit" name="nickServPassword">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="echoMode">
+              <enum>QLineEdit::Password</enum>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab">
+      <attribute name="title">
+       <string>Editor</string>
+      </attribute>
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="3" column="0">
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>158</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="0">
+        <layout class="QVBoxLayout" name="verticalLayout_7">
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_3">
+           <item>
+            <widget class="QCheckBox" name="useCustomFileEditor">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Use custom file editor:</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QLineEdit" name="customFileEditor">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="text">
+              <string>emacs</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="editor_showLineNumbers">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
+           <property name="text">
+            <string>Show line numbers</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="editor_highlightActualLine">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
+           <property name="text">
+            <string>Highlight actual line</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="editor_codeCompletion">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
+           <property name="text">
+            <string>Code completion</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="editor_longWindowTitle">
+           <property name="text">
+            <string>Show complete path in window title</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="2" column="0">
+        <layout class="QHBoxLayout" name="horizontalLayout_4">
+         <item>
+          <widget class="QLabel" name="label_8">
+           <property name="text">
+            <string>Font</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QFontComboBox" name="editor_fontName">
+           <property name="editable">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_9">
+           <property name="text">
+            <string>Font Size</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="editor_fontSize">
+           <property name="minimum">
+            <number>2</number>
+           </property>
+           <property name="maximum">
+            <number>96</number>
+           </property>
+           <property name="value">
+            <number>10</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_4">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_2">
+      <attribute name="title">
+       <string>File Browser</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QCheckBox" name="showFilenames">
+         <property name="text">
+          <string>Show filenames</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="showFileSize">
+         <property name="text">
+          <string>Show file size</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="showFileType">
+         <property name="text">
+          <string>Show file type</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="showLastModified">
+         <property name="text">
+          <string>Show date of last modification</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="showHiddenFiles">
+         <property name="text">
+          <string>Show hidden files</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="useAlternatingRowColors">
+         <property name="text">
+          <string>Alternating row colors</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_3">
+      <attribute name="title">
+       <string>Network</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_4">
+       <item>
+        <widget class="QCheckBox" name="useProxyServer">
+         <property name="text">
+          <string>Use proxy server</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QFormLayout" name="formLayout">
+         <item row="0" column="0">
+          <widget class="QLabel" name="label_3">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>Proxy Type:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QComboBox" name="proxyType">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <item>
+            <property name="text">
+             <string>HttpProxy</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Socks5Proxy</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="label_4">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>Hostname:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLineEdit" name="proxyHostName">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="label_5">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>Port:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1">
+          <widget class="QLineEdit" name="proxyPort">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0">
+          <widget class="QLabel" name="label_6">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>Username:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1">
+          <widget class="QLineEdit" name="proxyUserName">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="label_7">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>Password:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="1">
+          <widget class="QLineEdit" name="proxyPassword">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="echoMode">
+            <enum>QLineEdit::Password</enum>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>useCustomFileEditor</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>customFileEditor</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>111</x>
+     <y>62</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>343</x>
+     <y>63</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>autoIdentification</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>nickServPassword</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>261</x>
+     <y>139</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>384</x>
+     <y>229</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>proxyType</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>291</x>
+     <y>91</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>proxyHostName</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>291</x>
+     <y>124</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>proxyPort</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>364</x>
+     <y>154</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>label_3</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>59</x>
+     <y>91</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>label_4</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>69</x>
+     <y>122</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>label_5</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>44</x>
+     <y>152</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>proxyUserName</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>364</x>
+     <y>184</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>proxyPassword</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>364</x>
+     <y>214</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>label_6</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>68</x>
+     <y>182</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>useProxyServer</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>label_7</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>59</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>67</x>
+     <y>212</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editor_showLineNumbers</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>editor_showLineNumbers</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>87</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>249</x>
+     <y>87</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editor_highlightActualLine</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>editor_highlightActualLine</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>112</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>249</x>
+     <y>112</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editor_codeCompletion</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>editor_codeCompletion</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>137</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>249</x>
+     <y>137</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/TerminalHighlighter.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,88 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ResourceManager.h"
+#include "TerminalHighlighter.h"
+
+TerminalHighlighter::TerminalHighlighter(QTextDocument *parent)
+  : QSyntaxHighlighter(parent)
+{
+  HighlightingRule rule;
+
+  keywordFormat.setForeground(Qt::darkBlue);
+  QStringList keywordPatterns
+      = QString(ResourceManager::instance ()->octaveKeywords ()).split(" ", QString::SkipEmptyParts);
+   keywordPatterns << "GNU" << "Octave" << "OctaveGUI";
+
+  for (int i = 0; i < keywordPatterns.size (); i++)
+    keywordPatterns.replace(i, QString("\\b%1\\b").arg(keywordPatterns.at (i)));
+
+  foreach (const QString &pattern, keywordPatterns)
+    {
+      rule.pattern = QRegExp(pattern);
+      rule.format = keywordFormat;
+      highlightingRules.append(rule);
+    }
+
+  numberFormat.setForeground(Qt::darkRed);
+  rule.pattern = QRegExp("\\b[0-9\\.\\+\\-\\^]+\\b");
+  rule.format = numberFormat;
+  highlightingRules.append(rule);
+
+  doubleQouteFormat.setForeground(Qt::darkGreen);
+  rule.pattern = QRegExp("\"[^\"]*\"");
+  rule.format = doubleQouteFormat;
+  highlightingRules.append(rule);
+
+  functionFormat.setFontItalic(true);
+  functionFormat.setForeground(Qt::blue);
+  rule.pattern = QRegExp("\\b[A-Za-z0-9_]+\\s*(?=\\()");
+  rule.format = functionFormat;
+  highlightingRules.append(rule);
+
+  urlFormat.setForeground(Qt::darkYellow);
+  rule.pattern = QRegExp("((?:https?|ftp)://\\S+)");
+  rule.format = urlFormat;
+  highlightingRules.append(rule);
+
+  subCaptionFormat.setForeground (Qt::black);
+  subCaptionFormat.setFontItalic (true);
+  rule.pattern = QRegExp("^\\s+\\*.+$");
+  rule.format = subCaptionFormat;
+  highlightingRules.append(rule);
+
+  captionFormat.setForeground(Qt::black);
+  captionFormat.setFontWeight(QFont::Bold);
+  rule.pattern = QRegExp("^\\s+\\*\\*.+$");
+  rule.format = captionFormat;
+  highlightingRules.append(rule);
+}
+
+void TerminalHighlighter::highlightBlock(const QString &text)
+{
+  foreach (const HighlightingRule &rule, highlightingRules)
+    {
+      QRegExp expression(rule.pattern);
+      int index = expression.indexIn(text);
+      while (index >= 0)
+        {
+          int length = expression.matchedLength();
+          setFormat(index, length, rule.format);
+          index = expression.indexIn(text, index + length);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/TerminalHighlighter.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,56 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TERMINALHIGHLIGHTER_H
+#define TERMINALHIGHLIGHTER_H
+
+#include <QSyntaxHighlighter>
+
+#include <QHash>
+#include <QTextCharFormat>
+
+class QTextDocument;
+
+class TerminalHighlighter : public QSyntaxHighlighter
+{
+    Q_OBJECT
+
+public:
+    TerminalHighlighter(QTextDocument *parent = 0);
+
+protected:
+    void highlightBlock(const QString &text);
+
+private:
+    struct HighlightingRule
+    {
+        QRegExp pattern;
+        QTextCharFormat format;
+    };
+
+    QVector<HighlightingRule> highlightingRules;
+    QTextCharFormat keywordFormat;
+    QTextCharFormat doubleQouteFormat;
+    QTextCharFormat functionFormat;
+    QTextCharFormat urlFormat;
+    QTextCharFormat captionFormat;
+    QTextCharFormat subCaptionFormat;
+    QTextCharFormat numberFormat;
+};
+
+
+#endif // TERMINALHIGHLIGHTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/TerminalView.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,84 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "TerminalHighlighter.h"
+#include "TerminalView.h"
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QStringListModel>
+#include <QStringList>
+#include <QScrollBar>
+
+TerminalView::TerminalView (QWidget * parent)
+  : QPlainTextEdit (parent), Terminal ()
+{
+  setFont (QFont ("Monospace", 10));
+  setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
+  m_terminalEmulation = TerminalEmulation::newTerminalEmulation (this);
+
+  TerminalHighlighter *terminalHighlighter = new TerminalHighlighter ();
+  terminalHighlighter->setDocument (document ());
+}
+
+TerminalView::~TerminalView ()
+{
+}
+
+QTextCursor
+TerminalView::textCursor ()
+{
+  return QPlainTextEdit::textCursor();
+}
+
+void
+TerminalView::setTextCursor (const QTextCursor &cursor)
+{
+  QPlainTextEdit::setTextCursor (cursor);
+}
+
+void
+TerminalView::bell ()
+{
+}
+
+void
+TerminalView::keyPressEvent (QKeyEvent * keyEvent)
+{
+  if(m_terminalEmulation)
+    m_terminalEmulation->processKeyEvent (keyEvent);
+}
+
+void
+TerminalView::mousePressEvent (QMouseEvent *mouseEvent)
+{
+  // TODO: Pass mouse events to the terminal emulation.
+  mouseEvent->accept();
+}
+
+void
+TerminalView::mouseDoubleClickEvent (QMouseEvent *mouseEvent)
+{
+  // TODO: Pass mouse events to the terminal emulation.
+  mouseEvent->accept();
+}
+
+void
+TerminalView::wheelEvent (QWheelEvent *wheelEvent)
+{
+  // TODO: Pass mouse events to the terminal emulation.
+  wheelEvent->accept();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/TerminalView.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,58 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef OCTAVETERMINAL_H
+#define OCTAVETERMINAL_H
+#include <QPlainTextEdit>
+#include "AbstractTerminalView.h"
+#include "TerminalEmulation.h"
+
+class TerminalView:
+  public QPlainTextEdit,
+  public AbstractTerminalView,
+  Terminal
+{
+Q_OBJECT
+public:
+  TerminalView (QWidget * parent = 0);
+  ~TerminalView ();
+
+  TerminalEmulation *terminalEmulation ()
+  {
+    return m_terminalEmulation;
+  }
+
+  // AbstractTerminalView interface
+  void sendText (const QString& text)
+    { m_terminalEmulation->transmitText(text); }
+  QWidget* widget (void) { return this; }
+
+  // Terminal Interface
+  QTextCursor textCursor();
+  void setTextCursor (const QTextCursor &cursor);
+  void bell ();
+
+protected:
+  void keyPressEvent (QKeyEvent *keyEvent);
+  void mousePressEvent (QMouseEvent *mouseEvent);
+  void mouseDoubleClickEvent (QMouseEvent *mouseEvent);
+  void wheelEvent (QWheelEvent *wheelEvent);
+
+private:
+  TerminalEmulation *m_terminalEmulation;
+};
+#endif // OCTAVETERMINAL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/WelcomeWizard.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,53 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "WelcomeWizard.h"
+#include "ui_WelcomeWizard.h"
+
+WelcomeWizard::WelcomeWizard (QWidget *parent) :
+  QDialog (parent),
+  ui (new Ui::WelcomeWizard)
+{
+  ui->setupUi (this);
+  connect (ui->nextButton1, SIGNAL (clicked ()), this, SLOT (next ()));
+  connect (ui->nextButton2, SIGNAL (clicked ()), this, SLOT (next ()));
+  connect (ui->nextButton3, SIGNAL (clicked ()), this, SLOT (next ()));
+  connect (ui->nextButton4, SIGNAL (clicked ()), this, SLOT (next ()));
+
+  connect (ui->previousButton2, SIGNAL (clicked ()), this, SLOT (previous ()));
+  connect (ui->previousButton3, SIGNAL (clicked ()), this, SLOT (previous ()));
+  connect (ui->previousButton4, SIGNAL (clicked ()), this, SLOT (previous ()));
+  connect (ui->previousButton5, SIGNAL (clicked ()), this, SLOT (previous ()));
+}
+
+WelcomeWizard::~WelcomeWizard()
+{
+  delete ui;
+}
+
+void
+WelcomeWizard::next ()
+{
+  ui->stackedWidget->setCurrentIndex (ui->stackedWidget->currentIndex () + 1);
+}
+
+void
+WelcomeWizard::previous ()
+{
+  ui->stackedWidget->setCurrentIndex (ui->stackedWidget->currentIndex () - 1);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/WelcomeWizard.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,43 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WELCOMEWIZARD_H
+#define WELCOMEWIZARD_H
+
+#include <QDialog>
+
+namespace Ui {
+class WelcomeWizard;
+}
+
+class WelcomeWizard : public QDialog
+{
+  Q_OBJECT
+
+public:
+  explicit WelcomeWizard(QWidget *parent = 0);
+  ~WelcomeWizard();
+
+public slots:
+  void next ();
+  void previous ();
+
+private:
+  Ui::WelcomeWizard *ui;
+};
+
+#endif // WELCOMEWIZARD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/WelcomeWizard.ui	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WelcomeWizard</class>
+ <widget class="QDialog" name="WelcomeWizard">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>647</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>647</width>
+    <height>400</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>647</width>
+    <height>400</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Welcome to GNU Octave</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QStackedWidget" name="stackedWidget">
+     <property name="currentIndex">
+      <number>4</number>
+     </property>
+     <widget class="QWidget" name="page">
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at '~/.octave-gui'. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignJustify|Qt::AlignVCenter</set>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>218</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="nextButton1">
+           <property name="text">
+            <string>Next</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="page_2">
+      <layout class="QVBoxLayout" name="verticalLayout_4">
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_3">
+         <item>
+          <spacer name="verticalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout">
+           <item>
+            <widget class="QPushButton" name="previousButton2">
+             <property name="text">
+              <string>Previous</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="horizontalSpacer_2">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>40</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item>
+            <widget class="QPushButton" name="nextButton2">
+             <property name="text">
+              <string>Next</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="page_3">
+      <layout class="QHBoxLayout" name="horizontalLayout_4">
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_5">
+         <item>
+          <spacer name="verticalSpacer_3">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_3">
+           <item>
+            <widget class="QPushButton" name="previousButton3">
+             <property name="text">
+              <string>Previous</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="horizontalSpacer_3">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>40</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item>
+            <widget class="QPushButton" name="nextButton3">
+             <property name="text">
+              <string>Next</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="page_4">
+      <layout class="QHBoxLayout" name="horizontalLayout_6">
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_6">
+         <item>
+          <spacer name="verticalSpacer_4">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_5">
+           <item>
+            <widget class="QPushButton" name="previousButton4">
+             <property name="text">
+              <string>Previous</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="horizontalSpacer_4">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>40</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item>
+            <widget class="QPushButton" name="nextButton4">
+             <property name="text">
+              <string>Next</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="page_5">
+      <layout class="QHBoxLayout" name="horizontalLayout_8">
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_7">
+         <item>
+          <spacer name="verticalSpacer_5">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_7">
+           <item>
+            <widget class="QPushButton" name="previousButton5">
+             <property name="text">
+              <string>Previous</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="horizontalSpacer_5">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>40</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item>
+            <widget class="QPushButton" name="finishButton">
+             <property name="text">
+              <string>Finish</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>finishButton</sender>
+   <signal>clicked()</signal>
+   <receiver>WelcomeWizard</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>577</x>
+     <y>372</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>323</x>
+     <y>199</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/WinTerminalView.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,32 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "WinTerminalView.h"
+
+WinTerminalView::WinTerminalView (QWidget* parent)
+    : QConsole (parent)
+{
+}
+
+WinTerminalView::~WinTerminalView (void)
+{
+}
+
+void WinTerminalView::sendText (const QString& txt)
+{
+  QConsole::sendText (txt);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/WinTerminalView.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,39 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WINTERMINALVIEW_H
+#define WINTERMINALVIEW_H
+
+#include "QConsole.h"
+#include "AbstractTerminalView.h"
+
+/**
+  * @class WinTerminalView
+  * A Windows terminal widget, based on QConsole.
+  */
+class WinTerminalView : public QConsole, public AbstractTerminalView
+{
+public:
+  WinTerminalView (QWidget* parent = 0);
+  ~WinTerminalView (void);
+
+  // AbstractTerminalView interface
+  void sendText (const QString&);
+  QWidget* widget (void) { return this; }
+};
+
+#endif // WINTERMINALVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/WorkspaceView.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,220 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "WorkspaceView.h"
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QPushButton>
+
+WorkspaceView::WorkspaceView (QWidget * parent) : QDockWidget
+  (parent)
+{
+  setObjectName ("WorkspaceView");
+  setWindowTitle (tr ("Workspace"));
+
+  m_updateSemaphore = new QSemaphore (1);
+  QStringList headerLabels;
+  headerLabels << tr ("Name") << tr ("Type") << tr ("Value");
+  m_variablesTreeWidget = new QTreeWidget (this);
+  m_variablesTreeWidget->setHeaderHidden (false);
+  m_variablesTreeWidget->setHeaderLabels (headerLabels);
+
+  setWidget (new QWidget (this));
+  QVBoxLayout *layout = new QVBoxLayout ();
+  layout->addWidget (m_variablesTreeWidget);
+  layout->setMargin (2);
+  widget ()->setLayout (layout);
+
+  QTreeWidgetItem *treeWidgetItem = new QTreeWidgetItem ();
+  treeWidgetItem->setData (0, 0, QString (tr ("Local")));
+  m_variablesTreeWidget->insertTopLevelItem (0, treeWidgetItem);
+
+  treeWidgetItem = new QTreeWidgetItem ();
+  treeWidgetItem->setData (0, 0, QString (tr ("Global")));
+  m_variablesTreeWidget->insertTopLevelItem (1, treeWidgetItem);
+
+  treeWidgetItem = new QTreeWidgetItem ();
+  treeWidgetItem->setData (0, 0, QString (tr ("Persistent")));
+  m_variablesTreeWidget->insertTopLevelItem (2, treeWidgetItem);
+
+  treeWidgetItem = new QTreeWidgetItem ();
+  treeWidgetItem->setData (0, 0, QString (tr ("Hidden")));
+  m_variablesTreeWidget->insertTopLevelItem (3, treeWidgetItem);
+
+  m_variablesTreeWidget->expandAll ();
+  m_variablesTreeWidget->setAlternatingRowColors (true);
+  m_variablesTreeWidget->setAnimated (true);
+
+  connect (this,
+           SIGNAL (visibilityChanged(bool)),
+           this,
+           SLOT(handleVisibilityChanged(bool)));
+
+  connect (OctaveLink::instance(),
+           SIGNAL (symbolTableChanged()),
+           this,
+           SLOT (fetchSymbolTable()));
+}
+
+void
+WorkspaceView::noticeSettings ()
+{
+    // TODO: React on a settings change.
+}
+
+void
+WorkspaceView::updateTreeEntry (QTreeWidgetItem * treeItem, SymbolRecord symbolRecord)
+{
+  treeItem->setData (0, 0, QString (symbolRecord.name ().c_str ()));
+  treeItem->setData (1, 0,
+		     QString (symbolRecord.varval ().type_name ().c_str ()));
+  treeItem->setData (2, 0,
+		     OctaveLink::octaveValueAsQString (symbolRecord.
+						       varval ()));
+}
+
+void
+WorkspaceView::updateFromSymbolTable (QList < SymbolRecord > symbolTable)
+{
+  m_updateSemaphore->acquire ();
+  // Split the symbol table into its different scopes.
+  QList < SymbolRecord > localSymbolTable;
+  QList < SymbolRecord > globalSymbolTable;
+  QList < SymbolRecord > persistentSymbolTable;
+  QList < SymbolRecord > hiddenSymbolTable;
+
+  foreach (SymbolRecord symbolRecord, symbolTable)
+  {
+    // It's true that being global or hidden includes it's can mean it's also locally visible,
+    // but we want to distinguish that here.
+    if (symbolRecord.is_local () && !symbolRecord.is_global ()
+        && !symbolRecord.is_hidden ())
+      {
+        localSymbolTable.append (symbolRecord);
+      }
+
+    if (symbolRecord.is_global ())
+      {
+        globalSymbolTable.append (symbolRecord);
+      }
+
+    if (symbolRecord.is_persistent ())
+      {
+        persistentSymbolTable.append (symbolRecord);
+      }
+
+    if (symbolRecord.is_hidden ())
+      {
+        hiddenSymbolTable.append (symbolRecord);
+      }
+  }
+
+  updateScope (0, localSymbolTable);
+  updateScope (1, globalSymbolTable);
+  updateScope (2, persistentSymbolTable);
+  updateScope (3, hiddenSymbolTable);
+  m_updateSemaphore->release ();
+}
+
+void
+WorkspaceView::updateScope (int topLevelItemIndex, QList < SymbolRecord > symbolTable)
+{
+  // This method may be a little bit confusing; variablesList is a complete list of all
+  // variables that are in the workspace currently.
+  QTreeWidgetItem *topLevelItem =
+    m_variablesTreeWidget->topLevelItem (topLevelItemIndex);
+
+  // First we check, if any variables that exist in the model tree have to be updated
+  // or created. So we walk the variablesList check against the tree.
+  foreach (SymbolRecord symbolRecord, symbolTable)
+  {
+    int childCount = topLevelItem->childCount ();
+    bool alreadyExists = false;
+    QTreeWidgetItem *child;
+
+    // Search for the corresponding item in the tree. If it has been found, child
+    // will contain the appropriate QTreeWidgetItem* pointing at it.
+    for (int i = 0; i < childCount; i++)
+      {
+        child = topLevelItem->child (i);
+        if (child->data (0, 0).toString () ==
+            QString (symbolRecord.name ().c_str ()))
+          {
+            alreadyExists = true;
+            break;
+          }
+      }
+
+    // If it already exists, just update it.
+    if (alreadyExists)
+      {
+        updateTreeEntry (child, symbolRecord);
+      }
+    else
+      {
+        // It does not exist, so create a new one and set the right values.
+        child = new QTreeWidgetItem ();
+        updateTreeEntry (child, symbolRecord);
+        topLevelItem->addChild (child);
+      }
+  }
+
+  // Check the tree against the list for deleted variables.
+  for (int i = 0; i < topLevelItem->childCount (); i++)
+    {
+      bool existsInVariableList = false;
+      QTreeWidgetItem *child = topLevelItem->child (i);
+      foreach (SymbolRecord symbolRecord, symbolTable)
+        {
+          if (QString (symbolRecord.name ().c_str ()) ==
+              child->data (0, 0).toString ())
+            {
+              existsInVariableList = true;
+            }
+        }
+
+      if (!existsInVariableList)
+        {
+          topLevelItem->removeChild (child);
+          delete child;
+          i--;
+        }
+    }
+}
+
+void
+WorkspaceView::fetchSymbolTable ()
+{
+  OctaveLink::instance ()->acquireSymbolTable();
+  QList < SymbolRecord > symbolTable = OctaveLink::instance ()->symbolTable();
+  updateFromSymbolTable (symbolTable);
+  OctaveLink::instance ()->releaseSymbolTable();
+}
+
+void
+WorkspaceView::handleVisibilityChanged (bool visible)
+{
+  if (visible)
+  emit activeChanged (true);
+}
+
+void
+WorkspaceView::closeEvent (QCloseEvent *event)
+{
+  emit activeChanged (false);
+  QDockWidget::closeEvent (event);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/WorkspaceView.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,53 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WORKSPACEVIEW_H
+#define WORKSPACEVIEW_H
+
+#include <QDockWidget>
+#include <QTreeWidget>
+#include <QSemaphore>
+#include "OctaveLink.h"
+
+class WorkspaceView:public QDockWidget
+{
+  Q_OBJECT
+public:
+  WorkspaceView (QWidget * parent = 0);
+
+public slots:
+  void fetchSymbolTable ();
+  void handleVisibilityChanged (bool visible);
+  void noticeSettings ();
+
+signals:
+  /** Custom signal that tells if a user has clicke away that dock widget. */
+  void activeChanged (bool active);
+
+protected:
+  void closeEvent (QCloseEvent *event);
+
+private:
+  void updateFromSymbolTable (QList < SymbolRecord > symbolTable);
+  void updateTreeEntry (QTreeWidgetItem * treeItem, SymbolRecord symbolRecord);
+  void updateScope (int topLevelItemIndex, QList < SymbolRecord > symbolTable);
+
+  QTreeWidget *m_variablesTreeWidget;
+  QSemaphore *m_updateSemaphore;
+};
+
+#endif // WORKSPACEVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/OctaveCallbackThread.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,50 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "OctaveCallbackThread.h"
+#include "MainWindow.h"
+
+OctaveCallbackThread::OctaveCallbackThread (QObject * parent)
+  : QThread (parent)
+{
+  m_runningSemaphore = new QSemaphore(1);
+  m_running = true;
+}
+
+void
+OctaveCallbackThread::halt ()
+{
+  m_runningSemaphore->acquire ();
+  m_running = false;
+  m_runningSemaphore->release ();
+}
+
+void
+OctaveCallbackThread::run ()
+{
+  bool running = true;
+  while (running)
+    {
+      OctaveLink::instance ()->emitSymbolTableChanged();
+      OctaveLink::instance ()->updateHistoryModel ();
+      usleep (500000);
+
+      m_runningSemaphore->acquire ();
+      running = m_running;
+      m_runningSemaphore->release ();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/OctaveCallbackThread.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,37 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef OCTAVECALLBACKTHREAD_H
+#define OCTAVECALLBACKTHREAD_H
+
+#include <QThread>
+#include <QSemaphore>
+
+class OctaveCallbackThread:public QThread
+{
+  Q_OBJECT
+public:
+  void halt();
+  OctaveCallbackThread (QObject * parent);
+protected:
+  void run ();
+private:
+  QSemaphore *m_runningSemaphore;
+  bool m_running;
+};
+
+#endif // OCTAVECALLBACKTHREAD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/OctaveLink.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,150 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 John P. Swensen, Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "OctaveLink.h"
+
+OctaveLink OctaveLink::m_singleton;
+
+OctaveLink::OctaveLink ():QObject ()
+{
+  m_symbolTableSemaphore = new QSemaphore (1);
+  m_historyModel = new QStringListModel (this);
+}
+
+OctaveLink::~OctaveLink ()
+{
+}
+
+QString
+OctaveLink::octaveValueAsQString (OctaveValue octaveValue)
+{
+  // Convert single qouted string.
+  if (octaveValue.is_sq_string ())
+    {
+      return QString ("\'%1\'").arg (octaveValue.string_value ().c_str ());
+
+      // Convert double qouted string.
+    }
+  else if (octaveValue.is_dq_string ())
+    {
+      return QString ("\"%1\"").arg (octaveValue.string_value ().c_str ());
+
+      // Convert real scalar.
+    }
+  else if (octaveValue.is_real_scalar ())
+    {
+      return QString ("%1").arg (octaveValue.scalar_value ());
+
+      // Convert complex scalar.
+    }
+  else if (octaveValue.is_complex_scalar ())
+    {
+      return QString ("%1 + %2i").arg (octaveValue.scalar_value ()).
+	arg (octaveValue.complex_value ().imag ());
+
+      // Convert range.
+    }
+  else if (octaveValue.is_range ())
+    {
+      return QString ("%1 : %2 : %3").arg (octaveValue.range_value ().
+					   base ()).arg (octaveValue.
+							 range_value ().
+							 inc ()).
+	arg (octaveValue.range_value ().limit ());
+
+      // Convert real matrix.
+    }
+  else if (octaveValue.is_real_matrix ())
+    {
+      return QString ("%1x%2 matrix")
+          .arg (octaveValue.matrix_value ().rows ())
+          .arg (octaveValue.matrix_value ().cols ());
+
+      // Convert complex matrix.
+    }
+  else if (octaveValue.is_complex_matrix ())
+    {
+    return QString ("%1x%2 complex matrix")
+        .arg (octaveValue.matrix_value ().rows ())
+        .arg (octaveValue.matrix_value ().cols ());
+
+      // If everything else does not fit, we could not recognize the type.
+    }
+  else
+    {
+      return QString ("<Type not recognized>");
+    }
+}
+
+void
+OctaveLink::launchOctave ()
+{
+  // Create both threads.
+  m_octaveMainThread = new OctaveMainThread (this);
+  m_octaveCallbackThread = new OctaveCallbackThread (this);
+
+  // Launch the second as soon as the first ist ready.
+  connect (m_octaveMainThread, SIGNAL(ready()), m_octaveCallbackThread, SLOT(start()));
+
+  // Start the first one.
+  m_octaveMainThread->start ();
+}
+
+void
+OctaveLink::terminateOctave ()
+{
+  m_octaveCallbackThread->halt();
+  m_octaveCallbackThread->wait ();
+
+  m_octaveMainThread->terminate ();
+  //m_octaveMainThread->wait();
+}
+
+QList < SymbolRecord > OctaveLink::symbolTable ()
+{
+  m_symbolTableBuffer.clear ();
+  std::list < SymbolRecord > allVariables = symbol_table::all_variables ();
+  std::list < SymbolRecord >::iterator iterator;
+  for (iterator = allVariables.begin (); iterator != allVariables.end ();
+       iterator++)
+    m_symbolTableBuffer.append (iterator->dup());
+  return m_symbolTableBuffer;
+}
+
+void
+OctaveLink::updateHistoryModel ()
+{
+  // Determine the client's (our) history length and the one of the server.
+  int clientHistoryLength = m_historyModel->rowCount ();
+  int serverHistoryLength = command_history::length ();
+
+  // If were behind the server, iterate through all new entries and add them to our history.
+  if (clientHistoryLength < serverHistoryLength)
+    {
+      for (int i = clientHistoryLength; i < serverHistoryLength; i++)
+        {
+          m_historyModel->insertRow (0);
+          m_historyModel->setData (m_historyModel->index (0), QString (command_history::get_entry (i).c_str ()));
+        }
+    }
+}
+
+QStringListModel *
+OctaveLink::historyModel ()
+{
+  return m_historyModel;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/OctaveLink.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,138 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 John P. Swensen, Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef OCTAVELINK_H
+#define OCTAVELINK_H
+
+// Octave includes
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_URL
+#include "octave/config.h"
+#include "octave/cmd-edit.h"
+#include "octave/error.h"
+#include "octave/file-io.h"
+#include "octave/input.h"
+#include "octave/lex.h"
+#include "octave/load-path.h"
+#include "octave/octave.h"
+#include "octave/oct-hist.h"
+#include "octave/oct-map.h"
+#include "octave/oct-obj.h"
+#include "octave/ops.h"
+#include "octave/ov.h"
+#include "octave/ov-usr-fcn.h"
+#include "octave/symtab.h"
+#include "octave/pt.h"
+#include "octave/pt-eval.h"
+#include "octave/config.h"
+#include "octave/Range.h"
+#include "octave/toplev.h"
+#include "octave/procstream.h"
+#include "octave/sighandlers.h"
+#include "octave/debug.h"
+#include "octave/sysdep.h"
+#include "octave/ov.h"
+#include "octave/unwind-prot.h"
+#include "octave/utils.h"
+#include "octave/variables.h"
+
+// Standard includes
+#include <iostream>
+#include <string>
+#include <vector>
+#include <readline/readline.h>
+
+// Qt includes
+#include <QMutexLocker>
+#include <QMutex>
+#include <QFileInfo>
+#include <QList>
+#include <QString>
+#include <QStringList>
+#include <QVector>
+#include <QSemaphore>
+#include <QObject>
+#include <QStringListModel>
+
+#include "OctaveCallbackThread.h"
+#include "OctaveMainThread.h"
+
+typedef symbol_table::symbol_record SymbolRecord;
+typedef octave_value OctaveValue;
+
+/**
+  * \class OctaveLink
+  * Manages a link to an octave instance.
+  */
+class OctaveLink:public QObject
+{
+  Q_OBJECT
+public:
+  static OctaveLink *
+  instance ()
+  {
+    return &m_singleton;
+  }
+  static QString
+  octaveValueAsQString (OctaveValue octaveValue);
+
+  void launchOctave ();
+  void terminateOctave ();
+  void acquireSymbolTable () { m_symbolTableSemaphore->acquire (); }
+  void releaseSymbolTable () { m_symbolTableSemaphore->release (); }
+
+  /**
+    * For performance reasons this is not thread safe. Before you use this,
+    * acquire a lock with acquireSymbolTable and releaseSymbolTable.
+    */
+  QList < SymbolRecord > symbolTable ();
+
+  /**
+    * Returns a copy of the current symbol table buffer.
+    * \return Copy of the current symbol table buffer.
+    */
+  QList < SymbolRecord > copyCurrentSymbolTable ();
+
+  void updateHistoryModel ();
+  QStringListModel *historyModel ();
+  void emitSymbolTableChanged() { emit symbolTableChanged(); }
+
+signals:
+  void symbolTableChanged ();
+
+private:
+  OctaveLink ();
+  ~OctaveLink ();
+
+  /** Variable related member variables. */
+  QSemaphore * m_symbolTableSemaphore;
+  QList < SymbolRecord > m_symbolTableBuffer;
+
+  /** History related member variables. */
+  QStringListModel *m_historyModel;
+
+  // Threads for running octave and managing the data interaction.
+  OctaveMainThread *m_octaveMainThread;
+  OctaveCallbackThread *m_octaveCallbackThread;
+
+  static OctaveLink m_singleton;
+};
+#endif // OCTAVELINK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/OctaveMainThread.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,35 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "OctaveMainThread.h"
+#include "OctaveLink.h"
+
+OctaveMainThread::OctaveMainThread (QObject * parent):QThread (parent)
+{
+}
+
+void
+OctaveMainThread::run ()
+{
+  int argc = 3;
+  const char *argv[] = { "OctaveGUI", "--interactive", "--line-editing" };
+  octave_main (argc, (char **) argv, 1);
+  emit ready();
+  main_loop ();
+  // TODO: Close application on quit.
+  clean_up_and_exit (0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/OctaveMainThread.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,35 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef OCTAVEMAINTHREAD_H
+#define OCTAVEMAINTHREAD_H
+
+#include <QThread>
+class OctaveMainThread:public QThread
+{
+  Q_OBJECT
+public:
+  OctaveMainThread (QObject * parent);
+
+signals:
+  void ready();
+
+protected:
+  void run ();
+};
+
+#endif // OCTAVEMAINTHREAD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/ReadlineAdapter.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,23 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ReadlineAdapter.h"
+
+ReadlineAdapter::ReadlineAdapter (QObject *parent) :
+  QObject (parent), command_editor ()
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/backend/ReadlineAdapter.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,37 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef READLINEADAPTER_H
+#define READLINEADAPTER_H
+
+#include "octave/config.h"
+#include "octave/cmd-edit.h"
+#include <QObject>
+
+class ReadlineAdapter : public QObject, public command_editor
+{
+  Q_OBJECT
+public:
+  explicit ReadlineAdapter (QObject *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // READLINEADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/irc/IRCClientImpl.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,513 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "IRCClientImpl.h"
+
+IRCServerMessage::IRCServerMessage (const QString& serverMessage)
+{
+  if (serverMessage.isEmpty ())
+    return;
+
+  int position = 0;
+  QString buffer;
+
+  m_nick = "";
+  m_user = "";
+  m_host = "";
+
+  // A server message starting with a prefix indicates
+  // a prefix. A prefix has the format:
+  // :nick!user@host
+  // followed by a space character.
+  if (serverMessage.startsWith (":"))
+    {
+      position++;
+      while ((position < serverMessage.size ())
+             &&(serverMessage.at (position) != '!')
+             && !serverMessage.at (position).isSpace ())
+        {
+          buffer.append (serverMessage.at (position));
+          position++;
+        }
+      m_nick = buffer, buffer.clear (), position++;
+
+      // If it belongs to the prefix, it must be concatenanted neatlessly without
+      // any spaces.
+      if (position < serverMessage.size())
+      if (!serverMessage.at (position - 1).isSpace ())
+        {
+          while ((position < serverMessage.size ())
+                 && serverMessage.at (position) != '@')
+            {
+              buffer.append (serverMessage.at (position));
+              position++;
+            }
+          m_user = buffer, buffer.clear (), position++;
+        }
+
+      // If it belongs to the prefix, it must be concatenanted neatlessly without
+      // any spaces.
+      if (position < serverMessage.size())
+      if (!serverMessage.at (position - 1).isSpace ())
+        {
+          while ((position < serverMessage.size ())
+                 && serverMessage.at (position) != ' ')
+            {
+              buffer.append (serverMessage.at (position));
+              position++;
+            }
+          m_host = buffer, buffer.clear (), position++;
+        }
+    }
+
+  // The next part is the command. The command can either be numeric
+  // or a written command.
+  while ((position < serverMessage.size ())
+         && !serverMessage.at (position).isSpace ())
+    {
+      buffer.append (serverMessage.at (position));
+      position++;
+    }
+  m_command = buffer.toUpper (), buffer.clear (), position++;
+  m_codeNumber = m_command.toInt (&m_isNumeric);
+
+  // Next: a list of parameters. If any of these parameters
+  // starts with a colon, we have to read everything that follows
+  // as a single parameter.
+  bool readUntilEnd = false;
+  while (position < serverMessage.size ())
+    {
+      if (buffer.isEmpty () && !readUntilEnd && (serverMessage.at (position) == ':'))
+        {
+          readUntilEnd = true;
+        }
+      else
+        {
+          if (readUntilEnd)
+            {
+              buffer.append (serverMessage.at (position));
+            }
+          else
+            {
+              if (serverMessage.at (position).isSpace ())
+                {
+                  if (!buffer.isEmpty ())
+                    {
+                      m_parameters.append (buffer);
+                      buffer.clear ();
+                    }
+                }
+              else
+                {
+                  buffer.append (serverMessage.at (position));
+                }
+            }
+        }
+      position++;
+    }
+
+  if (!buffer.isEmpty ())
+    {
+      // We need to chop off \r\n here.
+      buffer.chop (2);
+      m_parameters.append (buffer);
+    }
+}
+
+int
+IRCServerMessage::numericValue ()
+{
+  if (m_isNumeric)
+    return m_codeNumber;
+  return -1;
+}
+
+QString
+IRCServerMessage::parameter (int index)
+{
+  if (index >= 0 && index < m_parameters.size ())
+    return m_parameters.at (index);
+  return "";
+}
+
+
+IRCChannelProxyImpl::IRCChannelProxyImpl (IRCClientInterface *clientInterface, const QString& channelName, QObject *parent)
+  : IRCChannelProxyInterface (clientInterface, channelName, parent),
+    m_clientInterface (clientInterface)
+{
+  m_channelName = channelName;
+  connect (clientInterface, SIGNAL (nicknameChanged (QString,QString)),
+           this, SLOT (handleNickChange (QString,QString)));
+}
+
+QTextDocument *
+IRCChannelProxyImpl::conversationModel ()
+{
+  return &m_conversationModel;
+}
+
+QStringListModel *
+IRCChannelProxyImpl::userListModel ()
+{
+  return &m_userListModel;
+}
+
+QString
+IRCChannelProxyImpl::channelName ()
+{
+  return m_channelName;
+}
+
+void
+IRCChannelProxyImpl::setNickList (const QStringList &nickList)
+{
+  m_userList = nickList;
+  m_userListModel.setStringList (nickList);
+}
+
+void
+IRCChannelProxyImpl::sendMessage (const QString& message)
+{
+  QStringList arguments;
+  arguments << m_channelName;
+  arguments << message;
+  m_clientInterface->sendIRCCommand (IRCCommand::PrivateMessage, arguments);
+}
+
+void
+IRCChannelProxyImpl::sendJoinRequest ()
+{
+  m_clientInterface->sendIRCCommand (IRCCommand::Join, QStringList (m_channelName));
+}
+
+
+void
+IRCChannelProxyImpl::leave (const QString& reason)
+{
+  Q_UNUSED (reason);
+}
+
+void
+IRCChannelProxyImpl::handleNickChange (const QString &oldNick, const QString &newNick)
+{
+  m_userList = m_userListModel.stringList ();
+  m_userList.removeAll (oldNick);
+  m_userList.append (newNick);
+  m_userListModel.setStringList (m_userList);
+}
+
+void
+IRCChannelProxyImpl::handleJoin (const QString &nick)
+{
+  m_userList = m_userListModel.stringList ();
+  m_userList.append (nick);
+  m_userListModel.setStringList (m_userList);
+}
+
+IRCClientImpl::IRCClientImpl (QObject *parent)
+  : IRCClientInterface (parent)
+{
+  m_loggedIn = false;
+  connect (&m_tcpSocket, SIGNAL (connected ()), this, SLOT (handleConnected ()));
+  connect (&m_tcpSocket, SIGNAL (disconnected ()), this, SLOT (handleDisconnected ()));
+  connect (&m_tcpSocket, SIGNAL (readyRead ()), this, SLOT (handleReadyRead ()));
+}
+
+IRCClientImpl::~IRCClientImpl ()
+{
+  foreach (IRCChannelProxyInterface *ircChannelProxy, m_channels)
+    {
+      delete ircChannelProxy;
+    }
+}
+
+void
+IRCClientImpl::connectToHost (const QHostAddress& host, int port, const QString& initialNick)
+{
+  m_host = host;
+  m_nickname = initialNick;
+  m_tcpSocket.connectToHost(host, port);
+}
+
+void
+IRCClientImpl::disconnect ()
+{
+  m_tcpSocket.disconnect ();
+}
+
+void
+IRCClientImpl::reconnect ()
+{
+  disconnect ();
+  connectToHost (m_host, m_port, m_nickname);
+}
+
+bool
+IRCClientImpl::isConnected ()
+{
+  return m_connected;
+}
+
+bool
+IRCClientImpl::isLoggedIn ()
+{
+  return m_loggedIn;
+}
+
+const QHostAddress&
+IRCClientImpl::host()
+{
+  return m_host;
+}
+
+int
+IRCClientImpl::port()
+{
+  return m_port;
+}
+
+IRCChannelProxyInterface *
+IRCClientImpl::ircChannelProxy (const QString &channel)
+{
+  if (!m_channels.contains (channel))
+      m_channels[channel] = new IRCChannelProxyImpl(this, channel);
+  return m_channels[channel];
+}
+
+void
+IRCClientImpl::sendNicknameChangeRequest (const QString &nickname)
+{
+  sendIRCCommand (IRCCommand::Nick, QStringList (nickname));
+}
+
+void
+IRCClientImpl::sendPrivateMessage (const QString &recipient, const QString &message)
+{
+  QStringList arguments;
+  arguments << recipient;
+  arguments << message;
+  sendIRCCommand (IRCCommand::PrivateMessage, arguments);
+}
+
+const QString&
+IRCClientImpl::nickname ()
+{
+  return m_nickname;
+}
+
+void
+IRCClientImpl::handleConnected ()
+{
+  m_connected = true;
+  QStringList arguments;
+  arguments << "na" << "0" << "0" << "na";
+  sendIRCCommand (IRCCommand::User, arguments);
+  sendNicknameChangeRequest (m_nickname);
+  emit connected (m_host.toString ());
+}
+
+void
+IRCClientImpl::handleDisconnected ()
+{
+  m_connected = false;
+  emit disconnected ();
+}
+
+void
+IRCClientImpl::handleReadyRead ()
+{
+  QByteArray line;
+  do
+    {
+      line = m_tcpSocket.readLine();
+      if (line.size ())
+        handleIncomingLine(QString::fromUtf8(line.data ()));
+      else
+        break;
+    }
+  while (true);
+}
+
+void
+IRCClientImpl::handleNicknameChanged (const QString &oldNick, const QString &newNick)
+{
+  // Check if our nickname changed.
+  if (oldNick == m_nickname)
+    {
+      m_nickname = newNick;
+      emit userNicknameChanged (m_nickname);
+    }
+  emit nicknameChanged (oldNick, newNick);
+}
+
+void
+IRCClientImpl::handleUserJoined (const QString &nick, const QString &channel)
+{
+  ircChannelProxy (channel)->handleJoin (nick);
+  emit userJoined (nick, channel);
+}
+
+void
+IRCClientImpl::handleUserQuit (const QString &nick, const QString &reason)
+{
+  emit userQuit (nick, reason);
+}
+
+void
+IRCClientImpl::handleIncomingLine (const QString &line)
+{
+  if (m_connected && !line.isEmpty())
+    {
+      IRCServerMessage ircServerMessage(line);
+      if (ircServerMessage.isNumeric () == true)
+        {
+          switch (ircServerMessage.numericValue ())
+            {
+              case IRCReply::Welcome:
+                m_loggedIn = true;
+                emit userNicknameChanged (nickname ());
+                emit loggedIn (nickname ());
+                break;
+              case IRCError::NicknameInUse:
+              case IRCError::NickCollision:
+                // If we are already logged in, the user attempted to
+                // switch to a username that is already existing.
+                // In that case warn him.
+                if (isLoggedIn ())
+                  {
+                    emit error ("The nickname is already in use.");
+                  }
+                // Otherwise we are attempting to log in to the server.
+                // Change the nick so that we can at least log in.
+                else
+                  {
+                    m_nickname += "_";
+                    sendNicknameChangeRequest (m_nickname);
+                  }
+                break;
+              case IRCError::PasswordMismatch:
+                emit error ("The password you provided is not correct.");
+                break;
+              case IRCReply::MessageOfTheDayStart:
+              case IRCReply::MessageOfTheDay:
+              case IRCReply::MessageOfTheDayEnd:
+              case IRCError::NoMessageOfTheDay:
+                break;
+              case IRCReply::NoTopic:
+              case IRCReply::Topic:
+                break;
+              case IRCReply::NameReply:
+                QString channel = ircServerMessage.parameter (2);
+                QString nickList = ircServerMessage.parameter (3);
+                emit debugMessage (nickList);
+                ircChannelProxy (channel)->setNickList (nickList.split (QRegExp ("\\s+"), QString::SkipEmptyParts));
+                break;
+            }
+        }
+      else
+        {
+          QString command = ircServerMessage.command ();
+          if (command == IRCCommand::Nick)
+            {
+              handleNicknameChanged (ircServerMessage.nick(), ircServerMessage.parameter (0));
+            }
+          else if (command == IRCCommand::Quit)
+            {
+              handleUserQuit (ircServerMessage.nick (), ircServerMessage.parameter (0));
+            }
+          else if (command == IRCCommand::Join)
+            {
+              handleUserJoined(ircServerMessage.nick (), ircServerMessage.parameter (0));
+            }
+          else if (command == IRCCommand::Part)
+            {
+              emit debugMessage ("WRITEME: Received part.");
+              //emit part (ircEvent.getNick ().toStdString ().c_str (),
+              //           ircEvent.getParam (0).toStdString ().c_str (),
+              //           ircEvent.getParam (1).toStdString ().c_str ());
+            }
+          else if (command == IRCCommand::Mode)
+            {
+              emit debugMessage ("WRITEME: Received mode.");
+              //emit mode (&ircEvent);
+            }
+          else if (command == IRCCommand::Topic)
+            {
+              emit debugMessage
+                (QString("WRITEME: Received topic: %1")
+                  .arg (ircServerMessage.parameter (0)));
+            }
+          else if (command == IRCCommand::Kick)
+            {
+              emit debugMessage ("WRITEME: Received kick command.");
+            }
+          else if (command == IRCCommand::Invite)
+            {
+              emit debugMessage ("WRITEME: Received invite command.");
+
+            }
+          else if (command == IRCCommand::PrivateMessage)
+            {
+              emit message (ircServerMessage.parameter (0), ircServerMessage.nick (), ircServerMessage.parameter (1));
+            }
+          else if (command == IRCCommand::Notice)
+            {
+              emit notification (ircServerMessage.nick ().toStdString ().c_str (),
+                                 ircServerMessage.parameter (1).toStdString ().c_str ());
+            }
+          else if (command == IRCCommand::Ping)
+            {
+              sendIRCCommand (IRCCommand::Pong, QStringList (m_nickname));
+            }
+          else if (command == IRCCommand::Error)
+            {
+              emit error (ircServerMessage.parameter (0));
+            }
+          else
+            {
+              emit debugMessage (QString("FIXME: Received unknown reply: %1").arg(command));
+            }
+        }
+    }
+}
+
+void
+IRCClientImpl::sendLine (const QString &line)
+{
+  if (m_connected)
+    m_tcpSocket.write ( (line +  + "\r\n").toUtf8 ());
+}
+
+void
+IRCClientImpl::sendIRCCommand (const QString &command, const QStringList &arguments)
+{
+  QString line = command;
+  for (int i = 0; i < arguments.size (); i++)
+    {
+      bool applyColon = false;
+      // Usually all parameters are separated by spaces.
+      // The last parameter of the message may contain spaces, it is usually used
+      // to transmit messages. In order to parse it correctly, if needs to be prefixed
+      // with a colon, so the server knows to ignore all forthcoming spaces and has to treat
+      // all remaining characters as a single parameter. If we detect any whitespace in the
+      // last argument, prefix it with a colon:
+      if ((i == arguments.size () - 1) && arguments.at (i).contains (QRegExp("\\s")))
+        applyColon = true;
+      line += QString (" %1%2").arg (applyColon ? ":" : "").arg (arguments.at (i));
+    }
+  sendLine (line);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/irc/IRCClientImpl.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,355 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IRCCLIENTIMPL_H
+#define IRCCLIENTIMPL_H
+
+#include <QTcpSocket>
+#include <QHostInfo>
+#include <QStringList>
+#include <QTextDocument>
+#include <QStringListModel>
+#include "IRCClientInterface.h"
+
+/**
+  * \namespace IRCCommand
+  * This namespace includes all IRC commands.
+  */
+namespace IRCCommand
+{
+  const QString Password = "PASS";
+  const QString Nick = "NICK";
+  const QString User = "USER";
+  const QString Operation = "OPER";
+  const QString Service = "SERVICE";
+  const QString Quit = "QUIT";
+  const QString ServerQuit = "SQUIT";
+
+  const QString Join = "JOIN";
+  const QString Part = "PART";
+  const QString Mode = "MODE";
+  const QString Topic = "TOPIC";
+  const QString Names = "NAMES";
+  const QString List = "LIST";
+  const QString Invite = "INVITE";
+  const QString Kick = "KICK";
+
+  const QString PrivateMessage = "PRIVMSG";
+  const QString Notice = "NOTICE";
+
+  const QString MessageOfTheDay = "MOTD";
+  const QString ListUsers = "LUSERS";
+  const QString Version = "VERSION";
+  const QString Stats = "STATS";
+  const QString Links = "LINKS";
+  const QString Time = "TIME";
+  const QString Command = "CONNECT";
+  const QString Trace = "TRACE";
+  const QString Admin = "ADMIN";
+  const QString Info = "INFO";
+
+  const QString ServerList = "SERVLIST";
+  const QString ServerQuery = "SQUERY";
+
+  const QString Who = "WHO";
+  const QString WhoIs = "WHOIS";
+  const QString WhoWas = "WHOWAS";
+
+  const QString Kill = "KILL";
+  const QString Ping = "PING";
+  const QString Pong = "PONG";
+  const QString Error = "ERROR";
+
+  const QString Away = "AWAY";
+  const QString Rehash = "REHASH";
+  const QString Die = "DIE";
+  const QString Restart = "RESTART";
+  const QString Summon = "SUMMON";
+  const QString Users = "USERS";
+  const QString OperatorWall = "OPERWALL";
+  const QString UserHost = "USERHOST";
+  const QString IsOn = "ISON";
+};
+
+/**
+  * \namespace IRCReply
+  * This namespace includes all numeric IRC replies.
+  */
+namespace IRCReply
+{
+  const int Welcome = 1;
+  const int YourHost = 2;
+  const int Created = 3;
+  const int MyInfo = 4;
+  const int ReplyBounce = 5;
+  const int UserHost = 302;
+  const int IsOn = 303;
+  const int Away = 301;
+  const int UnAway = 305;
+  const int NoAway = 306;
+  const int WhoIsUser = 311;
+  const int WhoIsServer = 312;
+  const int WhoIsOperator = 313;
+  const int WhoIsIdle = 317;
+  const int EndOfWhoIs = 318;
+  const int WhoIsChannels = 319;
+  const int WhoWasUser = 314;
+  const int EndOfWhoWas = 369;
+  const int ListStart = 321;
+  const int List = 322;
+  const int ListEnd = 323;
+  const int UniqueOpIs = 325;
+  const int ChannelModeIs = 324;
+  const int NoTopic = 331;
+  const int Topic = 332;
+  const int Inviting = 341;
+  const int Summoning = 342;
+  const int InviteList = 346;
+  const int EndOfInviteList = 347;
+  const int ExceptList = 348;
+  const int EndOfExceptList = 349;
+  const int Version = 351;
+  const int WhoReply = 352;
+  const int EndOfWho = 315;
+  const int NameReply = 353;
+  const int EndOfNames = 366;
+  const int Links = 364;
+  const int EndOfLinks = 367;
+  const int BanList = 368;
+  const int Info = 371;
+  const int EndOfInfo = 374;
+  const int MessageOfTheDayStart = 375;
+  const int MessageOfTheDay = 372;
+  const int MessageOfTheDayEnd = 376;
+  const int YouAreOperator = 381;
+  const int Rehashing = 382;
+  const int YouAreService = 383;
+  const int Time = 391;
+  const int UserStart = 392;
+  const int Users = 393;
+  const int EndOfUsers = 394;
+  const int NoUsers = 395;
+  const int TraceLink = 200;
+  const int TraceConnecting = 201;
+  const int TraceHandshake = 202;
+  const int TraceUnknown = 203;
+  const int TraceOperator = 204;
+  const int TraceUser = 205;
+  const int TraceServer = 206;
+  const int TraceService = 207;
+  const int TraceNewType = 208;
+  const int TraceClass = 209;
+  const int TraceConnect = 210;
+  const int TraceLog = 261;
+  const int TraceEnd = 262;
+  const int StatsLinkInfo = 211;
+  const int StatsCommands = 212;
+  const int EndOfStats = 219;
+  const int StatsUptime = 242;
+  const int StatsOnline = 243;
+  const int UModeIs = 221;
+  const int ServerList = 234;
+  const int ServerListEnd = 235;
+  const int ListUserClient = 251;
+  const int ListUserOperator = 252;
+  const int ListUserUnknown = 253;
+  const int ListUserChannels = 254;
+  const int ListUserMe = 255;
+  const int AdminMe = 256;
+  const int AdminLoc1 = 257;
+  const int AdminLoc2 = 258;
+  const int AdminEmail = 259;
+  const int TryAgain = 263;
+};
+
+/**
+  * \namespace IRCError
+  * This namespace includes all numeric IRC errors.
+  */
+namespace IRCError
+{
+  const int NoSuchNick = 401;
+  const int NoSuchServer = 402;
+  const int NoSuchChannel = 403;
+  const int CannotSendToChannel = 404;
+  const int TooManyChannels = 405;
+  const int WasNoSuchNick = 406;
+  const int TooManyTargets = 407;
+  const int NoSuchService = 408;
+  const int NoOrigin = 409;
+  const int NoRecipient = 411;
+  const int NoTextToSend = 412;
+  const int NoTopLevel = 413;
+  const int WildTopLevel = 414;
+  const int BasMask = 415;
+  const int UnknownCommand = 421;
+  const int NoMessageOfTheDay = 422;
+  const int NoAdminInfo = 423;
+  const int FileError = 424;
+  const int NoNickNameGiven = 431;
+  const int ErroneusNick = 432;
+  const int NicknameInUse = 433;
+  const int NickCollision = 436;
+  const int UnavailResource = 437;
+  const int UserNotInChannel = 441;
+  const int NotOnChannel = 442;
+  const int UserOnChannel = 443;
+  const int NoLogin = 444;
+  const int SummonDisabled = 445;
+  const int UsersDisabled = 446;
+  const int NotRegistered = 451;
+  const int NeedMoreParams = 461;
+  const int AlreadyRegistered = 462;
+  const int NoPermissionForHost = 463;
+  const int PasswordMismatch = 464;
+  const int YouAreBannedCreep = 465;
+  const int YouWillBeBanned = 466;
+  const int KeySet = 467;
+  const int ChannelIsFull = 471;
+  const int UnknownMode = 472;
+  const int InviteOnlyChannel = 473;
+  const int BannedFromChannel = 474;
+  const int BadChannelKey = 475;
+  const int BadChannelMask = 476;
+  const int NoChannelModes = 477;
+  const int BanListFull = 478;
+  const int NoPrivileges = 481;
+  const int ChannelOperatorPrivilegesNeeded = 482;
+  const int CannotKillServer = 483;
+  const int Restricted = 484;
+  const int UniqueOperatorPrivilegesNeeded = 485;
+  const int NoOperatorHost = 491;
+  const int YourModeListUnknownFlag = 501;
+  const int UsersDontMatch = 502;
+};
+
+/**
+  * \class IRCServerMessage
+  * The IRCServerMessage class is a wrapper for server messages.
+  * It parses the server message into its single bits and makes these
+  * available through Getter-methods.
+  */
+class IRCServerMessage
+{
+public:
+  IRCServerMessage (const QString& serverMessage);
+
+  bool isNumeric ()
+  { return m_isNumeric; }
+
+  QString nick ()
+  { return m_nick; }
+
+  QString command ()
+  { return m_command; }
+
+  int numericValue ();
+  QString parameter (int index);
+
+private:
+  int         m_codeNumber;
+  bool        m_isNumeric;
+  QString     m_nick;
+  QString     m_user;
+  QString     m_host;
+  QString     m_command;
+  QStringList m_parameters;
+};
+
+/**
+  * \class IRCChannelProxyImpl
+  * Implements a handle to an IRC channel. This is usually provided by the
+  * the IRC client class.
+  */
+class IRCChannelProxyImpl : public IRCChannelProxyInterface
+{
+  Q_OBJECT
+public:
+  IRCChannelProxyImpl (IRCClientInterface *clientInterface, const QString& channelName, QObject *parent = 0);
+  QTextDocument *conversationModel ();
+  QStringListModel *userListModel ();
+  QString channelName ();
+
+  void setNickList (const QStringList &nickList);
+  void sendMessage (const QString& message);
+  void sendJoinRequest ();
+  void leave (const QString &reason);
+public slots:
+  void handleNickChange (const QString& oldNick, const QString& newNick);
+  void handleJoin (const QString& nick);
+private:
+  QString             m_channelName;
+  QStringList         m_userList;
+  QStringListModel    m_userListModel;
+  QTextDocument       m_conversationModel;
+  IRCClientInterface *m_clientInterface;
+};
+
+/**
+  * \class IRCClientImpl
+  * Implements an IRC client. This class can maintain a connection to one server.
+  * In order to interface an IRC channel, use the ircChannelProxy-method to retrieve
+  * a handle.
+  */
+class IRCClientImpl : public IRCClientInterface
+{
+  Q_OBJECT
+public:
+  IRCClientImpl (QObject *parent = 0);
+  ~IRCClientImpl ();
+
+  const QString& nickname ();
+  bool isConnected ();
+  bool isLoggedIn ();
+  const QHostAddress& host();
+  int port();
+  IRCChannelProxyInterface *ircChannelProxy(const QString& channel);
+  void sendIRCCommand (const QString& command, const QStringList& arguments);
+
+public slots:
+  void connectToHost (const QHostAddress& host, int port, const QString& initialNick);
+  void disconnect ();
+  void reconnect ();
+
+  void sendNicknameChangeRequest (const QString &nickname);
+  void sendPrivateMessage (const QString &recipient, const QString &message);
+
+signals:
+  void debugMessage (const QString& message);
+
+private slots:
+  void handleConnected ();
+  void handleDisconnected ();
+  void handleReadyRead ();
+
+private:
+  void handleNicknameChanged (const QString& oldNick, const QString& newNick);
+  void handleUserJoined (const QString& nick, const QString& channel);
+  void handleUserQuit (const QString& nick, const QString& reason);
+  void handleIncomingLine (const QString& line);
+  void sendLine (const QString& line);
+
+  QHostAddress                              m_host;
+  int                                       m_port;
+  QString                                   m_nickname;
+  bool                                      m_connected;
+  bool                                      m_loggedIn;
+  QTcpSocket                                m_tcpSocket;
+  QMap<QString, IRCChannelProxyInterface*>  m_channels;
+};
+
+#endif // IRCCLIENTIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/irc/IRCClientInterface.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,221 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IRCCLIENTINTERFACE_H
+#define IRCCLIENTINTERFACE_H
+
+#include <QString>
+#include <QObject>
+#include <QHostAddress>
+#include <QTextDocument>
+#include <QStringListModel>
+
+class IRCClientInterface;
+/**
+  * \class IRCChannelProxyInterface
+  * Interface for a handle to an IRC channel.
+  */
+class IRCChannelProxyInterface : public QObject
+{
+  Q_OBJECT
+public:
+  IRCChannelProxyInterface (IRCClientInterface *, const QString&, QObject *parent = 0) : QObject (parent) { }
+  virtual ~IRCChannelProxyInterface () { }
+
+  /** Returns the conversation model part. */
+  virtual QTextDocument *conversationModel () = 0;
+
+  /** Returns a string list model for the user list. */
+  virtual QStringListModel *userListModel () = 0;
+
+  /** Returns the name of this channel. */
+  virtual QString channelName () = 0;
+
+  /**
+    * Overwrites the current nick list by settings a new nick list.
+    * \arg nickList The new nick list to set.
+    */
+  virtual void setNickList (const QStringList& nickList) = 0;
+
+  /**
+    * Sends a public message onto this channel.
+    * \arg message The message that should be sent.
+    */
+  virtual void sendMessage (const QString& message) = 0;
+
+  /** Requests to join this channel. */
+  virtual void sendJoinRequest () = 0;
+
+  /**
+    * Requests to leave this channel.
+    * \arg reason Reason for leaving the channel.
+    */
+  virtual void leave (const QString& reason) = 0;
+
+public slots:
+  virtual void handleNickChange (const QString& oldNick, const QString& newNick) = 0;
+  virtual void handleJoin (const QString& nick) = 0;
+};
+
+/**
+  * \class IRCClientInterface
+  * IRC Clients need to implement this interface.
+  */
+class IRCClientInterface : public QObject
+{
+  Q_OBJECT
+public:
+  IRCClientInterface (QObject *parent = 0) : QObject (parent) { }
+  virtual ~IRCClientInterface () { }
+
+  /** Returns the current nickname of this client. */
+  virtual const QString& nickname () = 0;
+
+  /** Returns true if connected to the server. */
+  virtual bool isConnected () = 0;
+
+  /**
+    * Returns true if logged in to the server.
+    * Note: There is a small difference between isConnected and isLoggedIn.
+    * isConnected returns true if there is a physical connection to the server.
+    * isLoggedIn only returns true if the server has already accepted you
+    * and you are ready to log into channels.
+    */
+  virtual bool isLoggedIn () = 0;
+
+  /** Returns the current host address. */
+  virtual const QHostAddress& host() = 0;
+
+  /** Returns the current port. */
+  virtual int port() = 0;
+
+  /**
+    * Returns a handle to an IRC channel.
+    * Note: Retrieving a handle does not mean you have joined this channel.
+    * \arg channel The channel to retrieve a handle for.
+    */
+  virtual IRCChannelProxyInterface *ircChannelProxy(const QString& channel) = 0;
+
+  /**
+    * Send an IRC command to the server.
+    * \arg command Command to send.
+    * \arg arguments Arguments to send.
+    */
+  virtual void sendIRCCommand (const QString& command, const QStringList& arguments) = 0;
+
+public slots:
+  /**
+    * Connects to a host.
+    * \arg host The host to connect tp.
+    * \arg port The port on which to connect to the host.
+    * \arg initialNick The initial nick to use when attempting to login.
+    */
+  virtual void connectToHost (const QHostAddress& host, int port, const QString& initialNick) = 0;
+
+  /** Disconnects from the host. */
+  virtual void disconnect () = 0;
+
+  /** Reconnects to the host. */
+  virtual void reconnect () = 0;
+
+  /**
+    * Sends a request to change the nickname.
+    * \arg nickname The new nickname to be requested.
+    */
+  virtual void sendNicknameChangeRequest (const QString& nickname) = 0;
+
+  /**
+    * Sends a private message.
+    * \arg recipient The nickname or channel that message should be sent to.
+    * \arg message The message that should be sent.
+    */
+  virtual void sendPrivateMessage (const QString& recipient, const QString& message) = 0;
+
+signals:
+  /**
+    * Sent upon the arrival of a new message.
+    * \arg channel The channel this message was sent from.
+    * \arg sender The nickname of the sender.
+    * \arg message The message that has been sent.
+    */
+  void newMessage (const QString& channel, const QString& sender, const QString& message);
+  void message (const QString& channel, const QString& sender, const QString& message);
+
+  /**
+    * Sent when the connection to a server has been established.
+    * \arg server The name of the server that the connection has been established to.
+    */
+  void connected (const QString& server);
+
+  /** Sent when the connection to the server has been interrupted. */
+  void disconnected ();
+
+  /**
+    * Sent when an error occurs.
+    * \arg message A descriptive message of the error that occured.
+    */
+  void error (const QString& message);
+
+  /**
+    * Sent when a notification arrives.
+    * \arg sender The source of the notification.
+    * \arg message The notification.
+    */
+  void notification (const QString& sender, const QString& message);
+
+  /**
+    * Sent when a nickname changed.
+    * \arg oldNick The previous nickname.
+    * \arg newNick The new nickname.
+    */
+  void nicknameChanged (const QString& oldNick, const QString& newNick);
+
+  /**
+    * Sent when the nickname of this client changed.
+    * \arg nick The new nickname of this client.
+    */
+  void userNicknameChanged (const QString& nick);
+
+  /**
+    * Sent when a user has joined a channel.
+    * \arg nick Nickname of the user that joined the channel.
+    * \arg channel Channel that this user joined.
+    */
+  void userJoined (const QString& nick, const QString& channel);
+
+  /**
+    * Sent when a user quits.
+    * \arg nick Nickname of the user that quit.
+    * \arg reason Reason of the user to quit.
+    */
+  void userQuit (const QString& nick, const QString& reason);
+
+  /**
+    * Sent when a user logged in.
+    * \arg nick The nickname of the user that logged in.
+    */
+  void loggedIn (const QString& nick);
+
+  /**
+    * Sent when the server provides a userlist for a channel.
+    * \arg channel The channel that userlist applies to.
+    * \arg list The actual userlist.
+    */
+  void userList (const QString& channel, const QStringList& list);
+};
+
+#endif // IRCCLIENTINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/irc/IRCCodes.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,223 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid
+ * jacob.dawid@googlemail.com
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IRCCODES_H
+#define IRCCODES_H
+#include <QString>
+
+namespace IRCCommand
+{
+  const QString Password = "PASS";
+  const QString Nick = "NICK";
+  const QString User = "USER";
+  const QString Operation = "OPER";
+  const QString Service = "SERVICE";
+  const QString Quit = "QUIT";
+  const QString ServerQuit = "SQUIT";
+
+  const QString Join = "JOIN";
+  const QString Part = "PART";
+  const QString Mode = "MODE";
+  const QString Topic = "TOPIC";
+  const QString Names = "NAMES";
+  const QString List = "LIST";
+  const QString Invite = "INVITE";
+  const QString Kick = "KICK";
+
+  const QString PrivateMessage = "PRIVMSG";
+  const QString Notice = "NOTICE";
+
+  const QString MessageOfTheDay = "MOTD";
+  const QString ListUsers = "LUSERS";
+  const QString Version = "VERSION";
+  const QString Stats = "STATS";
+  const QString Links = "LINKS";
+  const QString Time = "TIME";
+  const QString Command = "CONNECT";
+  const QString Trace = "TRACE";
+  const QString Admin = "ADMIN";
+  const QString Info = "INFO";
+
+  const QString ServerList = "SERVLIST";
+  const QString ServerQuery = "SQUERY";
+
+  const QString Who = "WHO";
+  const QString WhoIs = "WHOIS";
+  const QString WhoWas = "WHOWAS";
+
+  const QString Kill = "KILL";
+  const QString Ping = "PING";
+  const QString Pong = "PONG";
+  const QString Error = "ERROR";
+
+  const QString Away = "AWAY";
+  const QString Rehash = "REHASH";
+  const QString Die = "DIE";
+  const QString Restart = "RESTART";
+  const QString Summon = "SUMMON";
+  const QString Users = "USERS";
+  const QString OperatorWall = "OPERWALL";
+  const QString UserHost = "USERHOST";
+  const QString IsOn = "ISON";
+};
+
+namespace IRCReply
+{
+  const int Welcome = 1;
+  const int YourHost = 2;
+  const int Created = 3;
+  const int MyInfo = 4;
+  const int ReplyBounce = 5;
+  const int UserHost = 302;
+  const int IsOn = 303;
+  const int Away = 301;
+  const int UnAway = 305;
+  const int NoAway = 306;
+  const int WhoIsUser = 311;
+  const int WhoIsServer = 312;
+  const int WhoIsOperator = 313;
+  const int WhoIsIdle = 317;
+  const int EndOfWhoIs = 318;
+  const int WhoIsChannels = 319;
+  const int WhoWasUser = 314;
+  const int EndOfWhoWas = 369;
+  const int ListStart = 321;
+  const int List = 322;
+  const int ListEnd = 323;
+  const int UniqueOpIs = 325;
+  const int ChannelModeIs = 324;
+  const int NoTopic = 331;
+  const int Topic = 332;
+  const int Inviting = 341;
+  const int Summoning = 342;
+  const int InviteList = 346;
+  const int EndOfInviteList = 347;
+  const int ExceptList = 348;
+  const int EndOfExceptList = 349;
+  const int Version = 351;
+  const int WhoReply = 352;
+  const int EndOfWho = 315;
+  const int NameReply = 353;
+  const int EndOfNames = 366;
+  const int Links = 364;
+  const int EndOfLinks = 367;
+  const int BanList = 368;
+  const int Info = 371;
+  const int EndOfInfo = 374;
+  const int MessageOfTheDayStart = 375;
+  const int MessageOfTheDay = 372;
+  const int MessageOfTheDayEnd = 376;
+  const int YouAreOperator = 381;
+  const int Rehashing = 382;
+  const int YouAreService = 383;
+  const int Time = 391;
+  const int UserStart = 392;
+  const int Users = 393;
+  const int EndOfUsers = 394;
+  const int NoUsers = 395;
+  const int TraceLink = 200;
+  const int TraceConnecting = 201;
+  const int TraceHandshake = 202;
+  const int TraceUnknown = 203;
+  const int TraceOperator = 204;
+  const int TraceUser = 205;
+  const int TraceServer = 206;
+  const int TraceService = 207;
+  const int TraceNewType = 208;
+  const int TraceClass = 209;
+  const int TraceConnect = 210;
+  const int TraceLog = 261;
+  const int TraceEnd = 262;
+  const int StatsLinkInfo = 211;
+  const int StatsCommands = 212;
+  const int EndOfStats = 219;
+  const int StatsUptime = 242;
+  const int StatsOnline = 243;
+  const int UModeIs = 221;
+  const int ServerList = 234;
+  const int ServerListEnd = 235;
+  const int ListUserClient = 251;
+  const int ListUserOperator = 252;
+  const int ListUserUnknown = 253;
+  const int ListUserChannels = 254;
+  const int ListUserMe = 255;
+  const int AdminMe = 256;
+  const int AdminLoc1 = 257;
+  const int AdminLoc2 = 258;
+  const int AdminEmail = 259;
+  const int TryAgain = 263;
+};
+
+namespace IRCError
+{
+  const int NoSuchNick = 401;
+  const int NoSuchServer = 402;
+  const int NoSuchChannel = 403;
+  const int CannotSendToChannel = 404;
+  const int TooManyChannels = 405;
+  const int WasNoSuchNick = 406;
+  const int TooManyTargets = 407;
+  const int NoSuchService = 408;
+  const int NoOrigin = 409;
+  const int NoRecipient = 411;
+  const int NoTextToSend = 412;
+  const int NoTopLevel = 413;
+  const int WildTopLevel = 414;
+  const int BasMask = 415;
+  const int UnknownCommand = 421;
+  const int NoMessageOfTheDay = 422;
+  const int NoAdminInfo = 423;
+  const int FileError = 424;
+  const int NoNickNameGiven = 431;
+  const int ErroneusNick = 432;
+  const int NicknameInUse = 433;
+  const int NickCollision = 436;
+  const int UnavailResource = 437;
+  const int UserNotInChannel = 441;
+  const int NotOnChannel = 442;
+  const int UserOnChannel = 443;
+  const int NoLogin = 444;
+  const int SummonDisabled = 445;
+  const int UsersDisabled = 446;
+  const int NotRegistered = 451;
+  const int NeedMoreParams = 461;
+  const int AlreadyRegistered = 462;
+  const int NoPermissionForHost = 463;
+  const int PasswordMismatch = 464;
+  const int YouAreBannedCreep = 465;
+  const int YouWillBeBanned = 466;
+  const int KeySet = 467;
+  const int ChannelIsFull = 471;
+  const int UnknownMode = 472;
+  const int InviteOnlyChannel = 473;
+  const int BannedFromChannel = 474;
+  const int BadChannelKey = 475;
+  const int BadChannelMask = 476;
+  const int NoChannelModes = 477;
+  const int BanListFull = 478;
+  const int NoPrivileges = 481;
+  const int ChannelOperatorPrivilegesNeeded = 482;
+  const int CannotKillServer = 483;
+  const int Restricted = 484;
+  const int UniqueOperatorPrivilegesNeeded = 485;
+  const int NoOperatorHost = 491;
+  const int YourModeListUnknownFlag = 501;
+  const int UsersDontMatch = 502;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/irc/IRCWidget.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,448 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ResourceManager.h"
+#include "IRCWidget.h"
+#include <QMessageBox>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QLabel>
+#include <QSettings>
+#include <QInputDialog>
+#include <QKeyEvent>
+#include <QScrollBar>
+#include <QApplication>
+#include "IRCClientImpl.h"
+
+ChatMessageTextEdit::ChatMessageTextEdit (QWidget *parent)
+  : QPlainTextEdit (parent), m_completer (0)
+{
+  setMaximumHeight (50);
+  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+}
+
+ChatMessageTextEdit::~ChatMessageTextEdit ()
+{
+}
+
+void
+ChatMessageTextEdit::setCompleter (QCompleter *completer)
+{
+  if (m_completer)
+    QObject::disconnect (m_completer, 0, this, 0);
+
+  m_completer = completer;
+
+  if (!m_completer)
+    return;
+
+  m_completer->setWidget (this);
+  m_completer->setCompletionMode (QCompleter::PopupCompletion);
+  m_completer->setCaseSensitivity (Qt::CaseInsensitive);
+  QObject::connect (m_completer, SIGNAL (activated (QString)),
+                    this, SLOT (insertCompletion (QString)));
+}
+
+QCompleter *
+ChatMessageTextEdit::completer () const
+{
+  return m_completer;
+}
+
+void
+ChatMessageTextEdit::insertCompletion(const QString& completion)
+{
+
+  if (m_completer->widget() != this)
+    return;
+  QTextCursor tc = textCursor();
+  int extra = completion.length() - m_completer->completionPrefix().length();
+  tc.movePosition(QTextCursor::Left);
+  tc.movePosition(QTextCursor::EndOfWord);
+  tc.insertText(completion.right(extra));
+  setTextCursor(tc);
+}
+
+QString
+ChatMessageTextEdit::textUnderCursor () const
+{
+  QTextCursor tc = textCursor ();
+  tc.select (QTextCursor::WordUnderCursor);
+  return tc.selectedText ();
+}
+
+void
+ChatMessageTextEdit::focusInEvent (QFocusEvent *e)
+{
+  if (m_completer)
+    m_completer->setWidget (this);
+  QPlainTextEdit::focusInEvent (e);
+}
+
+void
+ChatMessageTextEdit::keyPressEvent (QKeyEvent *keyPressEvent)
+{
+  if (m_completer) {
+    switch (keyPressEvent->key ()) {
+    case Qt::Key_Enter:
+    case Qt::Key_Return:
+      if (! (keyPressEvent->modifiers () & Qt::ShiftModifier))
+        {
+          emit sendMessage (document ()->toPlainText ());
+          document ()->setPlainText ("");
+        }
+      else
+        {
+          QPlainTextEdit::keyPressEvent (keyPressEvent);
+        }
+      break;
+    case Qt::Key_Escape:
+    case Qt::Key_Tab:
+    case Qt::Key_Backtab:
+      keyPressEvent->ignore ();
+      return;
+    default:
+      QPlainTextEdit::keyPressEvent(keyPressEvent);
+      break;
+      }
+
+    QString completionPrefix = textUnderCursor ();
+    if (completionPrefix != m_completer->completionPrefix ())
+      {
+        m_completer->setCompletionPrefix(completionPrefix);
+      }
+
+    if (completionPrefix.length() > 2)
+      {
+        m_completer->popup ()->setCurrentIndex (m_completer->completionModel ()->index (0, 0));
+        m_completer->complete ();
+      }
+    else
+      {
+        m_completer->popup ()->hide ();
+      }
+  }
+}
+
+IRCWidget::IRCWidget (QWidget * parent):
+QWidget (parent)
+{
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  bool connectOnStartup = settings->value ("connectOnStartup").toBool ();
+  m_autoIdentification = settings->value ("autoIdentification").toBool ();
+  m_nickServPassword = settings->value ("nickServPassword").toString ();
+
+  m_initialNick = settings->value ("IRCNick").toString ();
+
+  if (m_initialNick.isEmpty ())
+    m_initialNick = "OctaveGUI-User";
+
+  QVBoxLayout *layout = new QVBoxLayout ();
+
+  m_chatWindow = new QTextEdit (this);
+  m_chatWindow->setReadOnly (true);
+  m_chatWindow->setEnabled (false);
+  QWidget *bottomWidget = new QWidget (this);
+
+  layout->addWidget (m_chatWindow);
+  layout->addWidget (bottomWidget);
+  layout->setMargin (0);
+  setLayout (layout);
+
+  QHBoxLayout *bottomLayout = new QHBoxLayout ();
+  m_nickButton = new QPushButton (bottomWidget);
+  m_nickButton->setStatusTip (tr ((char *) "Click here to change your nick."));
+  m_nickButton->setText (m_initialNick);
+  m_chatMessageTextEdit = new ChatMessageTextEdit (bottomWidget);
+  m_chatMessageTextEdit->setStatusTip (tr ((char *) "Enter your message here."));
+
+  bottomLayout->addWidget (m_nickButton);
+  bottomLayout->addWidget (new QLabel (":", this));
+  bottomLayout->addWidget (m_chatMessageTextEdit);
+  bottomLayout->setMargin (0);
+  bottomWidget->setLayout (bottomLayout);
+
+  m_nickButton->setEnabled (false);
+  m_chatMessageTextEdit->setEnabled (false);
+
+  //setFocusProxy (m_chatMessageTextEdit);
+  m_nickButton->setFocusProxy (m_chatMessageTextEdit);
+
+  QFont font;
+  font.setFamily ("Courier");
+  font.setPointSize (11);
+  m_chatWindow->setFont (font);
+  m_ircClientInterface = new IRCClientImpl (this);
+  m_octaveChannel = m_ircClientInterface->ircChannelProxy ("#octave");
+
+  connect (m_ircClientInterface, SIGNAL (connected (QString)),
+           this, SLOT (handleConnected (QString)));
+  connect (m_ircClientInterface, SIGNAL(loggedIn(QString)),
+           this, SLOT (joinOctaveChannel (QString)));
+  connect (m_ircClientInterface, SIGNAL (error (QString)),
+           this, SLOT (showErrorMessage (QString)));
+  connect (m_ircClientInterface, SIGNAL (debugMessage (QString)),
+           this, SLOT (showStatusMessage (QString)));
+  connect (m_ircClientInterface, SIGNAL (message (QString, QString, QString)),
+           this, SLOT (showMessage (QString, QString, QString )));
+  connect (m_ircClientInterface, SIGNAL (nicknameChanged (QString,QString)),
+           this, SLOT (handleNickChange (QString,QString)));
+  connect (m_ircClientInterface, SIGNAL (notification (QString,QString)),
+           this, SLOT (showNotification (QString,QString)));
+  connect (m_ircClientInterface, SIGNAL (loggedIn (QString)),
+           this, SLOT (handleLoggedIn(QString)));
+  connect (m_ircClientInterface, SIGNAL (userNicknameChanged (QString)),
+           this, SLOT (handleUserNicknameChanged (QString)));
+
+  connect (m_nickButton, SIGNAL (clicked ()), this, SLOT (showChangeUserNickPopup ()));
+  connect (m_chatMessageTextEdit, SIGNAL (sendMessage (QString)),
+           this, SLOT (sendMessage (QString)));
+
+  m_chatMessageTextEdit->setCompleter
+      (new QCompleter (m_ircClientInterface->ircChannelProxy ("#octave")->userListModel (), this));
+  m_chatWindow->setDocument (m_octaveChannel->conversationModel ());
+
+  if (connectOnStartup)
+    connectToServer ();
+}
+
+void
+IRCWidget::connectToServer ()
+{
+  showStatusMessage ("Looking up irc.freenode.net.");
+  QHostInfo hostInfo = QHostInfo::fromName ("irc.freenode.net");
+  QList<QHostAddress> hostAddresses = hostInfo.addresses();
+  if (hostAddresses.isEmpty ())
+    {
+      showStatusMessage ("Failed to lookup irc.freenode.net.");
+    }
+  else
+    {
+      showStatusMessage (QString ("Attempting to connect to %1.")
+                         .arg (hostAddresses.at (0).toString ()));
+      m_ircClientInterface->connectToHost(hostAddresses.at (0), 6667, m_initialNick);
+    }
+}
+
+void
+IRCWidget::showStatusMessage (const QString& message)
+{
+  m_chatWindow->append (QString ("<i>%1</i>").arg (message));
+}
+
+void
+IRCWidget::showErrorMessage (const QString& message)
+{
+  m_chatWindow->append (QString ("<i>Error: %1</i>").arg (message));
+}
+
+void
+IRCWidget::handleConnected (const QString &host)
+{
+  showStatusMessage (QString ("Connected to server %1.").arg (host));
+}
+
+void
+IRCWidget::joinOctaveChannel (const QString& nick)
+{
+  Q_UNUSED (nick);
+  showStatusMessage (QString ("Joining channel #octave."));
+  m_octaveChannel->sendJoinRequest ();
+}
+
+void
+IRCWidget::showMessage (const QString& channel, const QString& sender, const QString& message)
+{
+  Q_UNUSED (channel);
+
+  // TODO: This doesn't work properly!
+  // Every message makes it emit unreadMessage (true),
+  // though it should inly be emitted when this window
+  // does not have focus, ie. is not the active window.
+  if (!(hasFocus()
+      || m_chatMessageTextEdit->hasFocus ()
+      || m_nickButton->hasFocus ()
+      || m_chatWindow->hasFocus () ))
+    {
+      emit unreadMessages (true);
+    }
+
+  QString output;
+  QString htmlMessage = message;
+  htmlMessage.replace ("<", "&lt;");
+  htmlMessage.replace (">", "&gt;");
+  htmlMessage.replace ("\n", "<br>");
+  if (message.contains (m_ircClientInterface->nickname ()))
+    {
+      output =
+        QString ("<font color=\"#990000\"><b>%1:</b> %2</font>").arg (sender).
+        arg (htmlMessage);
+
+      QApplication::alert (this);
+    }
+  else
+    {
+      output =
+        QString ("<b>%1:</b> %2").arg (sender).
+        arg (htmlMessage);
+    }
+  m_chatWindow->append (output);
+  scrollToBottom ();
+}
+
+void
+IRCWidget::showNotification (const QString& sender, const QString& message)
+{
+  Q_UNUSED (sender);
+  m_chatWindow->append (QString ("<font color=\"#007700\">%1</font>").arg (message));
+  scrollToBottom ();
+}
+
+void
+IRCWidget::showChangeUserNickPopup ()
+{
+  bool ok;
+  QString newNick =
+    QInputDialog::getText (this, QString ("Nickname"),
+			   QString ("Type in your nickname:"),
+                           QLineEdit::Normal, m_ircClientInterface->nickname (), &ok);
+  if (ok)
+    {
+      m_ircClientInterface->sendNicknameChangeRequest (newNick);
+    }
+}
+
+void
+IRCWidget::sendMessage (QString message)
+{
+  // Do not send empty messages.
+  if (message.isEmpty ())
+    return;
+
+  // Remove trailing spaces.
+  while (message.at (0).isSpace ())
+    message.remove (0, 1);
+  if (message.startsWith ("/"))
+    {
+      QStringList line =
+	message.split (QRegExp ("\\s+"), QString::SkipEmptyParts);
+      if (line.at (0) == "/join")
+	{
+          IRCChannelProxyInterface *ircChannel = m_ircClientInterface->ircChannelProxy (line.at (1));
+          ircChannel->sendJoinRequest ();
+	}
+      else if (line.at (0) == "/nick")
+	{
+          m_ircClientInterface->sendNicknameChangeRequest (line.at (1));
+	}
+      else if (line.at (0) == "/msg")
+	{
+	  QString recipient = line.at (1);
+	  // Since we splitted the message before, we have to glue it together again.
+	  QString pmsg = "";
+	  for (int i = 2; i < line.length (); i++)
+	    {
+	      pmsg += line.at (i);
+	      pmsg += " ";
+	    }
+          m_ircClientInterface->sendPrivateMessage(recipient, pmsg);
+	}
+    }
+  else
+    {
+      m_octaveChannel->sendMessage (message);
+      message.replace ("<", "&lt;");
+      message.replace (">", "&gt;");
+      message.replace ("\n", "<br>");
+      m_chatWindow->append (QString ("<b>%1:</b> %2").
+                            arg (m_ircClientInterface->nickname ()).arg (message));
+    }
+
+  scrollToBottom ();
+}
+
+void
+IRCWidget::maybeIdentifyOnNickServ ()
+{
+  if (m_autoIdentification)
+    {
+      m_ircClientInterface->sendPrivateMessage("NickServ", QString ("identify %1").
+                                          arg (m_nickServPassword));
+    }
+}
+
+void
+IRCWidget::scrollToBottom ()
+{
+  if (m_chatWindow->verticalScrollBar ())
+    {
+      m_chatWindow->verticalScrollBar ()->setValue (m_chatWindow->verticalScrollBar ()->maximum ());
+    }
+}
+
+void
+IRCWidget::focusInEvent (QFocusEvent *focusEvent)
+{
+  Q_UNUSED (focusEvent);
+  emit unreadMessages (false);
+  QWidget::focusInEvent (focusEvent);
+
+  m_chatMessageTextEdit->setFocus ();
+}
+
+void
+IRCWidget::handleLoggedIn (const QString &nick)
+{
+  m_chatWindow->
+    append (QString
+            ("<i><font color=\"#00AA00\"><b>Successfully logged in as %1.</b></font></i>").
+            arg (nick));
+  m_nickButton->setEnabled (true);
+  m_chatMessageTextEdit->setEnabled (true);
+  m_chatWindow->setEnabled (true);
+  m_chatMessageTextEdit->setFocus ();
+}
+
+void
+IRCWidget::handleNickChange (const QString &oldNick, const QString &newNick)
+{
+  m_chatWindow->append (QString ("%1 is now known as %2.").arg (oldNick).arg (newNick));
+  scrollToBottom ();
+}
+
+void
+IRCWidget::handleUserJoined (const QString &nick, const QString &channel)
+{
+  m_chatWindow->append (QString ("<i>%1 has joined %2.</i>").arg (nick).arg (channel));
+  scrollToBottom ();
+}
+
+void
+IRCWidget::handleUserQuit (const QString &nick, const QString &reason)
+{
+  m_chatWindow->append (QString ("<i>%1 has quit.(%2).</i>").arg (nick).arg (reason));
+  scrollToBottom ();
+}
+
+void
+IRCWidget::handleUserNicknameChanged (const QString &nick)
+{
+  m_nickButton->setText (nick);
+  QSettings *settings = ResourceManager::instance ()->settings ();
+  settings->setValue ("IRCNick", nick);
+  maybeIdentifyOnNickServ ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/irc/IRCWidget.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,101 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IRCWIDGET_H
+#define IRCWIDGET_H
+
+#include <QWidget>
+#include <QPlainTextEdit>
+#include <QPushButton>
+#include <QLineEdit>
+#include <QCompleter>
+#include "IRCClientInterface.h"
+
+class ChatMessageTextEdit : public QPlainTextEdit
+{
+  Q_OBJECT
+public:
+  explicit ChatMessageTextEdit(QWidget *parent = 0);
+  ~ChatMessageTextEdit();
+
+  void setCompleter(QCompleter *m_completer);
+  QCompleter *completer() const;
+
+signals:
+  void sendMessage (const QString& message);
+
+protected:
+  void keyPressEvent(QKeyEvent *e);
+  void focusInEvent(QFocusEvent *e);
+
+private slots:
+  void insertCompletion(const QString &completion);
+
+private:
+  QString textUnderCursor() const;
+
+private:
+  QCompleter *m_completer;
+};
+
+class IRCWidget : public QWidget
+{
+Q_OBJECT public:
+  explicit IRCWidget (QWidget * parent);
+  void connectToServer ();
+
+public slots:
+  void showStatusMessage (const QString&);
+  void showErrorMessage (const QString&);
+  void showMessage (const QString& channel, const QString& sender, const QString& message);
+  void showNotification (const QString& sender, const QString& message);
+
+  void handleConnected (const QString& host);
+  void joinOctaveChannel (const QString& nick);
+
+  void handleLoggedIn (const QString& nick);
+  void handleNickChange (const QString& oldNick, const QString& newNick);
+  void handleUserJoined (const QString& nick, const QString& channel);
+  void handleUserQuit (const QString& nick, const QString& reason);
+  void handleUserNicknameChanged (const QString& nick);
+
+  void showChangeUserNickPopup ();
+  void sendMessage (QString);
+
+  void maybeIdentifyOnNickServ ();
+  void scrollToBottom ();
+
+signals:
+  void unreadMessages (bool yes);
+
+protected:
+  void focusInEvent (QFocusEvent *focusEvent);
+
+private:
+  IRCClientInterface *m_ircClientInterface;
+  IRCChannelProxyInterface *m_octaveChannel;
+  QTextEdit *m_chatWindow;
+  QPushButton *m_nickButton;
+  ChatMessageTextEdit *m_chatMessageTextEdit;
+
+  QString m_initialNick;
+  bool m_autoIdentification;
+  QString m_nickServPassword;
+  QString m_settingsFile;
+};
+
+#endif // IRCWIDGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/irc/Makefile.am	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,34 @@
+####### kdevelop will overwrite this part!!! (begin)##########
+bin_PROGRAMS = qirc
+  qirc_SOURCES =
+  programcommand.cpp newtab.cpp MainTab.cpp notifyshowcase.cpp channellist.
+  cpp dccget.cpp dccsend.cpp IServerSocket.cpp general.cpp listanicks.
+  cpp qirc.cpp ventanas.cpp inputBox.cpp cuadroListaNicks.
+  cpp cuadroConfiguracion.cpp cuadroConectarCon.cpp colamensajes.
+  cpp IRCClient.cpp IClientSocket.cpp Config.cpp ChatView.cpp main.
+  cpp qirc_LDADD = -lqt - lXext - lX11 $ (LIBSOCKET) SUBDIRS =
+  docs EXTRA_DIST =
+  main.cpp qirc.h ChatView.cpp ChatView.h Config.cpp Config.h IClientSocket.
+  cpp IClientSocket.h IRCClient.cpp IRCClient.h IRCCodes.h colamensajes.
+  cpp colamensajes.h cuadroConectarCon.cpp cuadroConectarCon.
+  h cuadroConfiguracion.cpp cuadroConfiguracion.h cuadroListaNicks.
+  cpp cuadroListaNicks.h inputBox.cpp inputBox.h ventanas.cpp ventanas.h qirc.
+  cpp resource.h qirc16x16.xpm qirc32x32.xpm qirc64x64.xpm listanicks.
+  cpp listanicks.h general.h general.cpp IServerSocket.cpp IServerSocket.
+  h dccsend.cpp dccsend.h dccget.cpp dccget.h connect.xpm dccsend.xpm help.
+  xpm connectto.xpm disconnect.xpm join.xpm part.xpm list.xpm channellist.
+  cpp channellist.h notifyshowcase.cpp notifyshowcase.h offline.xpm online.
+  xpm operator.xpm justconn.xpm MainTab.cpp MainTab.h newtab.cpp newtab.
+  h leftArrowDisabled.xpm leftArrowEnabled.xpm rightArrowDisabled.
+  xpm rightArrowEnabled.xpm tabLeft.xpm tabMiddle.xpm tabRight.xpm tabClose.
+  xpm programcommand.cpp programcommand.h
+####### kdevelop will overwrite this part!!! (end)############
+#set the include path for X, qt and KDE
+  INCLUDES = $ (all_includes)
+#claim, which subdirectories you want to install
+#you can add here more. This one gets installed
+  bin_PROGRAMS = qirc qirc_METASOURCES = USE_AUTOMOC
+#the library search path.
+  qirc_LDFLAGS = $ (all_libraries)
+#them while "make clean", use CLEANFILES
+  DISTCLEANFILES = $ (qirc_METASOURCES)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/lexer/lexeroctavegui.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,141 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "lexeroctavegui.h"
+#include <qcolor.h>
+#include <qfont.h>
+
+// -----------------------------------------------------
+// Some basic functions
+// -----------------------------------------------------
+LexerOctaveGui::LexerOctaveGui(QObject *parent)
+    : QsciLexer(parent)  // inherit from base lexer
+{
+}
+
+LexerOctaveGui::~LexerOctaveGui()
+{
+}
+
+const char *LexerOctaveGui::language() const
+{
+  return "Octave";  // return the name of the language
+}
+
+const char *LexerOctaveGui::lexer() const
+{
+  return "octave";  // return the name of the lexer
+}
+
+// -----------------------------------------------------
+// The colors for syntax highlighting
+// -----------------------------------------------------
+QColor LexerOctaveGui::defaultColor(int style) const
+{
+    switch (style)
+      {
+        case Default:  // black
+          return QColor(0x00,0x00,0x00);
+        case Operator: // red
+          return QColor(0xef,0x00,0x00);
+        case Comment:  // gray
+          return QColor(0x7f,0x7f,0x7f);
+        case Command:  // blue-green
+          return QColor(0x00,0x7f,0x7f);
+        case Number:   // orange
+          return QColor(0x7f,0x7f,0x00);
+        case Keyword:  // blue
+          return QColor(0x00,0x00,0xbf);
+        case SingleQuotedString: // green
+          return QColor(0x00,0x7f,0x00);
+        case DoubleQuotedString: // green-yellow
+          return QColor(0x4f,0x7f,0x00);
+      }
+    return QsciLexer::defaultColor(style);
+}
+
+
+// -----------------------------------------------------
+// The font decorations for highlighting
+// -----------------------------------------------------
+QFont LexerOctaveGui::defaultFont(int style) const
+{
+    QFont f;
+
+    switch (style)
+      {
+        case Comment: // default but italic
+          f = QsciLexer::defaultFont(style);
+          f.setItalic(true);
+          break;
+        case Keyword: // default
+          f = QsciLexer::defaultFont(style);
+          break;
+        case Operator:  // default
+          f = QsciLexer::defaultFont(style);
+          break;
+        default:        // default
+          f = QsciLexer::defaultFont(style);
+          break;
+      }
+    return f;   // return the selected font
+}
+
+
+// -----------------------------------------------------
+// Style names
+// -----------------------------------------------------
+QString LexerOctaveGui::description(int style) const
+{
+    switch (style)
+      {
+        case Default:
+          return tr("Default");
+        case Comment:
+          return tr("Comment");
+        case Command:
+          return tr("Command");
+        case Number:
+          return tr("Number");
+        case Keyword:
+          return tr("Keyword");
+        case SingleQuotedString:
+          return tr("Single-quoted string");
+        case Operator:
+          return tr("Operator");
+        case Identifier:
+          return tr("Identifier");
+        case DoubleQuotedString:
+          return tr("Double-quoted string");
+      }
+    return QString();
+}
+
+
+// -----------------------------------------------------
+// The set of keywords for highlighting
+// TODO: How to define a second set?
+// -----------------------------------------------------
+const char *LexerOctaveGui::keywords(int set) const
+{
+    if (set == 1)
+      {
+        return ResourceManager::instance ()->octaveKeywords ();
+      }
+    return 0;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/lexer/lexeroctavegui.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,61 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LEXEROCTAVE_H
+#define LEXEROCTAVE_H
+
+#include "ResourceManager.h"
+#include <QObject>
+
+#include <Qsci/qsciglobal.h>
+#include <Qsci/qscilexer.h>
+
+
+class LexerOctaveGui : public QsciLexer
+{
+    Q_OBJECT
+
+public:
+    // the used styles
+    enum
+      {
+        Default = 0,
+        Comment = 1,
+        Command = 2,
+        Number = 3,
+        Keyword = 4,
+        SingleQuotedString = 5,
+        Operator = 6,
+        Identifier = 7,
+        DoubleQuotedString = 8
+      };
+
+    LexerOctaveGui(QObject *parent = 0);
+    virtual ~LexerOctaveGui();
+    const char *language() const;
+    const char *lexer() const;
+    QColor defaultColor(int style) const;
+    QFont defaultFont(int style) const;
+    const char *keywords(int set) const;
+    QString description(int style) const;
+
+private:
+    LexerOctaveGui(const LexerOctaveGui &);
+    LexerOctaveGui &operator=(const LexerOctaveGui &);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/KPty.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,657 @@
+/*
+
+   This file is part of the KDE libraries
+   Copyright (C) 2002 Waldo Bastian <bastian@kde.org>
+   Copyright (C) 2002-2003,2007-2008 Oswald Buddenhagen <ossi@kde.org>
+   Copyright (C) 2010 KDE e.V. <kde-ev-board@kde.org>
+     Author Adriaan de Groot <groot@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+
+#include "KPty.h"
+
+#include <QtCore/Q_PID>
+
+#define TTY_GROUP "tty"
+
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+
+///////////////////////
+// private functions //
+///////////////////////
+
+//////////////////
+// private data //
+//////////////////
+
+KPtyPrivate::KPtyPrivate (KPty * parent):
+masterFd (-1),
+slaveFd (-1),
+ownMaster (true),
+q_ptr (parent)
+{
+}
+
+KPtyPrivate::~KPtyPrivate ()
+{
+}
+
+#ifndef HAVE_OPENPTY
+bool
+KPtyPrivate::chownpty (bool grant)
+{
+  return !QProcess::execute (KStandardDirs::findExe ("kgrantpty"),
+                             QStringList () << (grant ? "--grant" :
+                                                "--revoke") << QString::
+                             number (masterFd));
+}
+#endif
+
+/////////////////////////////
+// public member functions //
+/////////////////////////////
+
+KPty::KPty ():
+d_ptr (new KPtyPrivate (this))
+{
+}
+
+KPty::KPty (KPtyPrivate * d):
+d_ptr (d)
+{
+  d_ptr->q_ptr = this;
+}
+
+KPty::~KPty ()
+{
+  close ();
+  delete d_ptr;
+}
+
+bool
+KPty::open ()
+{
+  Q_D (KPty);
+
+  if (d->masterFd >= 0)
+    return true;
+
+  d->ownMaster = true;
+
+  QByteArray ptyName;
+
+  // Find a master pty that we can open ////////////////////////////////
+
+  // Because not all the pty animals are created equal, they want to
+  // be opened by several different methods.
+
+  // We try, as we know them, one by one.
+
+#ifdef HAVE_OPENPTY
+
+  char ptsn[PATH_MAX];
+  if (::openpty (&d->masterFd, &d->slaveFd, ptsn, 0, 0))
+    {
+      d->masterFd = -1;
+      d->slaveFd = -1;
+      //kWarning(175) << "Can't open a pseudo teletype";
+      return false;
+    }
+  d->ttyName = ptsn;
+
+#else
+
+#ifdef HAVE__GETPTY		// irix
+
+  char *ptsn =
+    _getpty (&d->masterFd, O_RDWR | O_NOCTTY, S_IRUSR | S_IWUSR, 0);
+  if (ptsn)
+    {
+      d->ttyName = ptsn;
+      goto grantedpt;
+    }
+
+#elif defined(HAVE_PTSNAME) || defined(TIOCGPTN)
+
+#ifdef HAVE_POSIX_OPENPT
+  d->masterFd =::posix_openpt (O_RDWR | O_NOCTTY);
+#elif defined(HAVE_GETPT)
+  d->masterFd =::getpt ();
+#elif defined(PTM_DEVICE)
+  //d->masterFd = KDE_open(PTM_DEVICE, O_RDWR|O_NOCTTY);
+  d->masterFd =::open (PTM_DEVICE, O_RDWR | O_NOCTTY);
+#else
+#error No method to open a PTY master detected.
+#endif
+  if (d->masterFd >= 0)
+    {
+#ifdef HAVE_PTSNAME
+      char *ptsn = ptsname (d->masterFd);
+      if (ptsn)
+        {
+          d->ttyName = ptsn;
+#else
+      int ptyno;
+      if (!ioctl (d->masterFd, TIOCGPTN, &ptyno))
+        {
+          char buf[32];
+          sprintf (buf, "/dev/pts/%d", ptyno);
+          d->ttyName = buf;
+#endif
+#ifdef HAVE_GRANTPT
+          if (!grantpt (d->masterFd))
+            goto grantedpt;
+#else
+          goto gotpty;
+#endif
+        }
+      ::close (d->masterFd);
+      d->masterFd = -1;
+    }
+#endif // HAVE_PTSNAME || TIOCGPTN
+
+  // Linux device names, FIXME: Trouble on other systems?
+  for (const char *s3 = "pqrstuvwxyzabcde"; *s3; s3++)
+    {
+      for (const char *s4 = "0123456789abcdef"; *s4; s4++)
+        {
+          ptyName = QString ().sprintf ("/dev/pty%c%c", *s3, *s4).toAscii ();
+          d->ttyName =
+            QString ().sprintf ("/dev/tty%c%c", *s3, *s4).toAscii ();
+
+          d->masterFd =::open (ptyName.data (), O_RDWR);
+          if (d->masterFd >= 0)
+            {
+#ifdef Q_OS_SOLARIS
+              /* Need to check the process group of the pty.
+               * If it exists, then the slave pty is in use,
+               * and we need to get another one.
+               */
+              int pgrp_rtn;
+              if (ioctl (d->masterFd, TIOCGPGRP, &pgrp_rtn) == 0
+                  || errno != EIO)
+                {
+                  ::close (d->masterFd);
+                  d->masterFd = -1;
+                  continue;
+                }
+#endif /* Q_OS_SOLARIS */
+              if (!access (d->ttyName.data (), R_OK | W_OK))	// checks availability based on permission bits
+                {
+                  if (!geteuid ())
+                    {
+                      struct group *p = getgrnam (TTY_GROUP);
+                      if (!p)
+                        p = getgrnam ("wheel");
+                      gid_t gid = p ? p->gr_gid : getgid ();
+
+                      chown (d->ttyName.data (), getuid (), gid);
+                      chmod (d->ttyName.data (), S_IRUSR | S_IWUSR | S_IWGRP);
+                    }
+                  goto gotpty;
+                }
+              ::close (d->masterFd);
+              d->masterFd = -1;
+            }
+        }
+    }
+
+  //kWarning(175) << "Can't open a pseudo teletype";
+  return false;
+
+gotpty:
+  KDE_struct_stat st;
+  if (KDE_stat (d->ttyName.data (), &st))
+    return false;		// this just cannot happen ... *cough*  Yeah right, I just
+  // had it happen when pty #349 was allocated.  I guess
+  // there was some sort of leak?  I only had a few open.
+  if (((st.st_uid != getuid ()) ||
+       (st.st_mode & (S_IRGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH))) &&
+      !d->chownpty (true))
+    {
+
+      /*kWarning(175)
+         << "chownpty failed for device " << ptyName << "::" << d->ttyName
+         << "\nThis means the communication can be eavesdropped." << endl;
+       */
+    }
+
+grantedpt:
+
+#ifdef HAVE_REVOKE
+  revoke (d->ttyName.data ());
+#endif
+
+#ifdef HAVE_UNLOCKPT
+  unlockpt (d->masterFd);
+#elif defined(TIOCSPTLCK)
+  int flag = 0;
+  ioctl (d->masterFd, TIOCSPTLCK, &flag);
+#endif
+
+  d->slaveFd =::open (d->ttyName.data (), O_RDWR | O_NOCTTY);
+  if (d->slaveFd < 0)
+    {
+      //kWarning(175) << "Can't open slave pseudo teletype";
+      ::close (d->masterFd);
+      d->masterFd = -1;
+      return false;
+    }
+
+#if (defined(__svr4__) || defined(__sgi__) || defined(Q_OS_SOLARIS))
+  // Solaris uses STREAMS for terminal handling. It is possible
+  // for the pty handling modules to be left off the stream; in that
+  // case push them on. ioctl(fd, I_FIND, ...) is documented to return
+  // 1 if the module is on the stream already.
+  {
+    static const char *pt = "ptem";
+    static const char *ld = "ldterm";
+    if (ioctl (d->slaveFd, I_FIND, pt) == 0)
+      ioctl (d->slaveFd, I_PUSH, pt);
+    if (ioctl (d->slaveFd, I_FIND, ld) == 0)
+      ioctl (d->slaveFd, I_PUSH, ld);
+  }
+#endif
+
+#endif /* HAVE_OPENPTY */
+
+  fcntl (d->masterFd, F_SETFD, FD_CLOEXEC);
+  fcntl (d->slaveFd, F_SETFD, FD_CLOEXEC);
+
+  return true;
+}
+
+bool
+KPty::open (int fd)
+{
+#if !defined(HAVE_PTSNAME) && !defined(TIOCGPTN)
+  //kWarning(175) << "Unsupported attempt to open pty with fd" << fd;
+  return false;
+#else
+  Q_D (KPty);
+
+  if (d->masterFd >= 0)
+    {
+      //kWarning(175) << "Attempting to open an already open pty";
+      return false;
+    }
+
+  d->ownMaster = false;
+
+#ifdef HAVE_PTSNAME
+  char *ptsn = ptsname (fd);
+  if (ptsn)
+    {
+      d->ttyName = ptsn;
+#else
+  int ptyno;
+  if (!ioctl (fd, TIOCGPTN, &ptyno))
+    {
+      char buf[32];
+      sprintf (buf, "/dev/pts/%d", ptyno);
+      d->ttyName = buf;
+#endif
+    }
+  else
+    {
+      //kWarning(175) << "Failed to determine pty slave device for fd" << fd;
+      return false;
+    }
+
+  d->masterFd = fd;
+  if (!openSlave ())
+    {
+      d->masterFd = -1;
+      return false;
+    }
+
+  return true;
+#endif
+}
+
+void
+KPty::closeSlave ()
+{
+  Q_D (KPty);
+
+  if (d->slaveFd < 0)
+    return;
+  ::close (d->slaveFd);
+  d->slaveFd = -1;
+}
+
+bool
+KPty::openSlave ()
+{
+  Q_D (KPty);
+
+  if (d->slaveFd >= 0)
+    return true;
+  if (d->masterFd < 0)
+    {
+      //kWarning(175) << "Attempting to open pty slave while master is closed";
+      return false;
+    }
+  d->slaveFd =::open (d->ttyName.data (), O_RDWR | O_NOCTTY);
+  if (d->slaveFd < 0)
+    {
+      //kWarning(175) << "Can't open slave pseudo teletype";
+      return false;
+    }
+  fcntl (d->slaveFd, F_SETFD, FD_CLOEXEC);
+  return true;
+}
+
+void
+KPty::close ()
+{
+  Q_D (KPty);
+
+  if (d->masterFd < 0)
+    return;
+  closeSlave ();
+  if (d->ownMaster)
+    {
+#ifndef HAVE_OPENPTY
+      // don't bother resetting unix98 pty, it will go away after closing master anyway.
+      if (memcmp (d->ttyName.data (), "/dev/pts/", 9))
+        {
+          if (!geteuid ())
+            {
+              struct stat st;
+              if (!stat (d->ttyName.data (), &st))
+                {
+                  chown (d->ttyName.data (), 0,
+                         st.st_gid == getgid ()? 0 : -1);
+                  chmod (d->ttyName.data (),
+                         S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
+                         S_IWOTH);
+                }
+            }
+          else
+            {
+              fcntl (d->masterFd, F_SETFD, 0);
+              d->chownpty (false);
+            }
+        }
+#endif
+      ::close (d->masterFd);
+    }
+  d->masterFd = -1;
+}
+
+void
+KPty::setCTty ()
+{
+  Q_D (KPty);
+
+  // Setup job control //////////////////////////////////
+
+  // Become session leader, process group leader,
+  // and get rid of the old controlling terminal.
+  setsid ();
+
+  // make our slave pty the new controlling terminal.
+#ifdef TIOCSCTTY
+  ioctl (d->slaveFd, TIOCSCTTY, 0);
+#else
+  // __svr4__ hack: the first tty opened after setsid() becomes controlling tty
+  ::close (open (d->ttyName, O_WRONLY, 0));
+#endif
+
+  // make our new process group the foreground group on the pty
+  int pgrp = getpid ();
+#if defined(_POSIX_VERSION) || defined(__svr4__)
+  tcsetpgrp (d->slaveFd, pgrp);
+#elif defined(TIOCSPGRP)
+  ioctl (d->slaveFd, TIOCSPGRP, (char *) &pgrp);
+#endif
+}
+
+void
+KPty::login (const char *user, const char *remotehost)
+{
+#ifdef HAVE_UTEMPTER
+  Q_D (KPty);
+
+  addToUtmp (d->ttyName, remotehost, d->masterFd);
+  Q_UNUSED (user);
+#else
+#ifdef HAVE_UTMPX
+  struct utmpx l_struct;
+#else
+  struct utmp l_struct;
+#endif
+  memset (&l_struct, 0, sizeof (l_struct));
+  // note: strncpy without terminators _is_ correct here. man 4 utmp
+
+  if (user)
+    strncpy (l_struct.ut_name, user, sizeof (l_struct.ut_name));
+
+  if (remotehost)
+    {
+      strncpy (l_struct.ut_host, remotehost, sizeof (l_struct.ut_host));
+#ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
+      l_struct.ut_syslen =
+        qMin (strlen (remotehost), sizeof (l_struct.ut_host));
+#endif
+    }
+
+#ifndef __GLIBC__
+  Q_D (KPty);
+  const char *str_ptr = d->ttyName.data ();
+  if (!memcmp (str_ptr, "/dev/", 5))
+    str_ptr += 5;
+  strncpy (l_struct.ut_line, str_ptr, sizeof (l_struct.ut_line));
+#ifdef HAVE_STRUCT_UTMP_UT_ID
+  strncpy (l_struct.ut_id,
+           str_ptr + strlen (str_ptr) - sizeof (l_struct.ut_id),
+           sizeof (l_struct.ut_id));
+#endif
+#endif
+
+#ifdef HAVE_UTMPX
+  //gettimeofday(&l_struct.ut_tv, 0);
+  gettimeofday ((struct timeval *) &l_struct.ut_tv, 0);
+#else
+  l_struct.ut_time = time (0);
+#endif
+
+#ifdef HAVE_LOGIN
+#ifdef HAVE_LOGINX
+  ::loginx (&l_struct);
+#else
+  ::login (&l_struct);
+#endif
+#else
+#ifdef HAVE_STRUCT_UTMP_UT_TYPE
+  l_struct.ut_type = USER_PROCESS;
+#endif
+#ifdef HAVE_STRUCT_UTMP_UT_PID
+  l_struct.ut_pid = getpid ();
+#ifdef HAVE_STRUCT_UTMP_UT_SESSION
+  l_struct.ut_session = getsid (0);
+#endif
+#endif
+#ifdef HAVE_UTMPX
+  utmpxname (_PATH_UTMPX);
+  setutxent ();
+  pututxline (&l_struct);
+  endutxent ();
+  //updwtmpx(_PATH_WTMPX, &l_struct);
+#else
+  utmpname (_PATH_UTMP);
+  setutent ();
+  pututline (&l_struct);
+  endutent ();
+  updwtmp (_PATH_WTMP, &l_struct);
+#endif
+#endif
+#endif
+}
+
+void
+KPty::logout ()
+{
+#ifdef HAVE_UTEMPTER
+  Q_D (KPty);
+
+  removeLineFromUtmp (d->ttyName, d->masterFd);
+#else
+  Q_D (KPty);
+
+  const char *str_ptr = d->ttyName.data ();
+  if (!memcmp (str_ptr, "/dev/", 5))
+    str_ptr += 5;
+#ifdef __GLIBC__
+  else
+    {
+      const char *sl_ptr = strrchr (str_ptr, '/');
+      if (sl_ptr)
+        str_ptr = sl_ptr + 1;
+    }
+#endif
+#ifdef HAVE_LOGIN
+#ifdef HAVE_LOGINX
+  ::logoutx (str_ptr, 0, DEAD_PROCESS);
+#else
+  ::logout (str_ptr);
+#endif
+#else
+#ifdef HAVE_UTMPX
+  struct utmpx l_struct, *ut;
+#else
+  struct utmp l_struct, *ut;
+#endif
+  memset (&l_struct, 0, sizeof (l_struct));
+
+  strncpy (l_struct.ut_line, str_ptr, sizeof (l_struct.ut_line));
+
+#ifdef HAVE_UTMPX
+  utmpxname (_PATH_UTMPX);
+  setutxent ();
+  if ((ut = getutxline (&l_struct)))
+    {
+#else
+  utmpname (_PATH_UTMP);
+  setutent ();
+  if ((ut = getutline (&l_struct)))
+    {
+#endif
+      memset (ut->ut_name, 0, sizeof (*ut->ut_name));
+      memset (ut->ut_host, 0, sizeof (*ut->ut_host));
+#ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
+      ut->ut_syslen = 0;
+#endif
+#ifdef HAVE_STRUCT_UTMP_UT_TYPE
+      ut->ut_type = DEAD_PROCESS;
+#endif
+#ifdef HAVE_UTMPX
+      //gettimeofday(&(ut->ut_tv), 0);
+      gettimeofday ((struct timeval *) &(ut->ut_tv), 0);
+      pututxline (ut);
+    }
+  endutxent ();
+#else
+      ut->ut_time = time (0);
+      pututline (ut);
+    }
+  endutent ();
+#endif
+#endif
+#endif
+}
+
+bool
+KPty::tcGetAttr (struct::termios * ttmode) const
+{
+  Q_D (const KPty);
+
+#ifdef Q_OS_SOLARIS
+  if (_tcgetattr (d->slaveFd, ttmode) == 0)
+    return true;
+#endif
+  return _tcgetattr (d->masterFd, ttmode) == 0;
+}
+
+bool
+KPty::tcSetAttr (struct::termios * ttmode)
+{
+  Q_D (KPty);
+
+#ifdef Q_OS_SOLARIS
+  if (_tcsetattr (d->slaveFd, ttmode) == 0)
+    return true;
+#endif
+  return _tcsetattr (d->masterFd, ttmode) == 0;
+}
+
+bool
+KPty::setWinSize (int lines, int columns)
+{
+  Q_D (KPty);
+
+  struct winsize winSize;
+  memset (&winSize, 0, sizeof (winSize));
+  winSize.ws_row = (unsigned short) lines;
+  winSize.ws_col = (unsigned short) columns;
+  return ioctl (d->masterFd, TIOCSWINSZ, (char *) &winSize) == 0;
+}
+
+bool
+KPty::setEcho (bool echo)
+{
+  struct::termios ttmode;
+  if (!tcGetAttr (&ttmode))
+    return false;
+  if (!echo)
+    ttmode.c_lflag &= ~ECHO;
+  else
+    ttmode.c_lflag |= ECHO;
+  return tcSetAttr (&ttmode);
+}
+
+const char *
+KPty::ttyName () const
+{
+  Q_D (const KPty);
+
+  return d->ttyName.data ();
+}
+
+int
+KPty::masterFd () const
+{
+  Q_D (const KPty);
+
+  return d->masterFd;
+}
+
+int
+KPty::slaveFd () const
+{
+  Q_D (const KPty);
+
+  return d->slaveFd;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/KPty.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,347 @@
+/* This file is part of the KDE libraries
+
+    Copyright (C) 2003,2007 Oswald Buddenhagen <ossi@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef kpty_h
+#define kpty_h
+
+#ifdef __APPLE__
+#ifndef Q_OS_MAC
+#define Q_OS_MAC
+#endif
+#endif
+
+#if defined(Q_OS_MAC)
+#define HAVE_UTIL_H
+#define HAVE_UTMPX
+#define _UTMPX_COMPAT
+#define HAVE_PTSNAME
+#define HAVE_SYS_TIME_H
+#else
+#define HAVE_PTY_H
+#endif
+
+#define HAVE_OPENPTY
+
+#include <QtCore/QByteArray>
+
+#ifdef __sgi
+#define __svr4__
+#endif
+
+#ifdef __osf__
+#define _OSF_SOURCE
+#include <float.h>
+#endif
+
+#ifdef _AIX
+#define _ALL_SOURCE
+#endif
+
+// __USE_XOPEN isn't defined by default in ICC
+// (needed for ptsname(), grantpt() and unlockpt())
+#ifdef __INTEL_COMPILER
+#ifndef __USE_XOPEN
+#define __USE_XOPEN
+#endif
+#endif
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <grp.h>
+
+#if defined(HAVE_PTY_H)
+#include <pty.h>
+#endif
+
+#ifdef HAVE_LIBUTIL_H
+#include <libutil.h>
+#elif defined(HAVE_UTIL_H)
+#include <util.h>
+#endif
+
+#define HAVE_UTMPX
+#define _UTMPX_COMPAT
+
+#ifdef HAVE_UTEMPTER
+extern "C"
+{
+#include <utempter.h>
+}
+#else
+#include <utmp.h>
+#ifdef HAVE_UTMPX
+#include <utmpx.h>
+#endif
+#if !defined(_PATH_UTMPX) && defined(_UTMPX_FILE)
+#define _PATH_UTMPX _UTMPX_FILE
+#endif
+#if !defined(_PATH_WTMPX) && defined(_WTMPX_FILE)
+#define _PATH_WTMPX _WTMPX_FILE
+#endif
+#endif
+
+/* for HP-UX (some versions) the extern C is needed, and for other
+   platforms it doesn't hurt */
+extern "C"
+{
+#include <termios.h>
+#if defined(HAVE_TERMIO_H)
+#include <termio.h>		// struct winsize on some systems
+#endif
+}
+
+#if defined (_HPUX_SOURCE)
+#define _TERMIOS_INCLUDED
+#include <bsdtty.h>
+#endif
+
+#ifdef HAVE_SYS_STROPTS_H
+#include <sys/stropts.h>	// Defines I_PUSH
+#define _NEW_TTY_CTRL
+#endif
+
+#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
+#define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode)
+#else
+#if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) || defined(__sun)
+#define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode)
+#else
+#define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode)
+#endif
+#endif
+
+#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
+#define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode)
+#else
+#if defined(_HPUX_SOURCE) || defined(__CYGWIN__) || defined(__sun)
+#define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode)
+#else
+#define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode)
+#endif
+#endif
+
+#include <QtCore/qglobal.h>
+#include <QByteArray>
+
+class KPty;
+struct KPtyPrivate
+{
+  Q_DECLARE_PUBLIC (KPty) KPtyPrivate (KPty * parent);
+  virtual ~ KPtyPrivate ();
+  bool chownpty (bool grant);
+
+  int masterFd;
+  int slaveFd;
+  bool ownMaster:1;
+
+  QByteArray ttyName;
+
+  KPty *q_ptr;
+};
+
+struct termios;
+
+/**
+ * Provides primitives for opening & closing a pseudo TTY pair, assigning the
+ * controlling TTY, utmp registration and setting various terminal attributes.
+ */
+class KPty
+{
+Q_DECLARE_PRIVATE (KPty) public:
+
+  /**
+   * Constructor
+   */
+  KPty ();
+
+  /**
+   * Destructor:
+   *
+   *  If the pty is still open, it will be closed. Note, however, that
+   *  an utmp registration is @em not undone.
+  */
+  ~KPty ();
+
+  /**
+   * Create a pty master/slave pair.
+   *
+   * @return true if a pty pair was successfully opened
+   */
+  bool open ();
+
+  /**
+   * Open using an existing pty master.
+   *
+   * @param fd an open pty master file descriptor.
+   *   The ownership of the fd remains with the caller;
+   *   it will not be automatically closed at any point.
+   * @return true if a pty pair was successfully opened
+   */
+  bool open (int fd);
+
+  /**
+   * Close the pty master/slave pair.
+   */
+  void close ();
+
+  /**
+   * Close the pty slave descriptor.
+   *
+   * When creating the pty, KPty also opens the slave and keeps it open.
+   * Consequently the master will never receive an EOF notification.
+   * Usually this is the desired behavior, as a closed pty slave can be
+   * reopened any time - unlike a pipe or socket. However, in some cases
+   * pipe-alike behavior might be desired.
+   *
+   * After this function was called, slaveFd() and setCTty() cannot be
+   * used.
+   */
+  void closeSlave ();
+
+  /**
+   * Open the pty slave descriptor.
+   *
+   * This undoes the effect of closeSlave().
+   *
+   * @return true if the pty slave was successfully opened
+   */
+  bool openSlave ();
+
+  /**
+   * Creates a new session and process group and makes this pty the
+   * controlling tty.
+   */
+  void setCTty ();
+
+  /**
+   * Creates an utmp entry for the tty.
+   * This function must be called after calling setCTty and
+   * making this pty the stdin.
+   * @param user the user to be logged on
+   * @param remotehost the host from which the login is coming. This is
+   *  @em not the local host. For remote logins it should be the hostname
+   *  of the client. For local logins from inside an X session it should
+   *  be the name of the X display. Otherwise it should be empty.
+   */
+  void login (const char *user = 0, const char *remotehost = 0);
+
+  /**
+   * Removes the utmp entry for this tty.
+   */
+  void logout ();
+
+  /**
+   * Wrapper around tcgetattr(3).
+   *
+   * This function can be used only while the PTY is open.
+   * You will need an #include &lt;termios.h&gt; to do anything useful
+   * with it.
+   *
+   * @param ttmode a pointer to a termios structure.
+   *  Note: when declaring ttmode, @c struct @c ::termios must be used -
+   *  without the '::' some version of HP-UX thinks, this declares
+   *  the struct in your class, in your method.
+   * @return @c true on success, false otherwise
+   */
+  bool tcGetAttr (struct::termios * ttmode) const;
+
+  /**
+   * Wrapper around tcsetattr(3) with mode TCSANOW.
+   *
+   * This function can be used only while the PTY is open.
+   *
+   * @param ttmode a pointer to a termios structure.
+   * @return @c true on success, false otherwise. Note that success means
+   *  that @em at @em least @em one attribute could be set.
+   */
+  bool tcSetAttr (struct::termios * ttmode);
+
+  /**
+   * Change the logical (screen) size of the pty.
+   * The default is 24 lines by 80 columns.
+   *
+   * This function can be used only while the PTY is open.
+   *
+   * @param lines the number of rows
+   * @param columns the number of columns
+   * @return @c true on success, false otherwise
+   */
+  bool setWinSize (int lines, int columns);
+
+  /**
+   * Set whether the pty should echo input.
+   *
+   * Echo is on by default.
+   * If the output of automatically fed (non-interactive) PTY clients
+   * needs to be parsed, disabling echo often makes it much simpler.
+   *
+   * This function can be used only while the PTY is open.
+   *
+   * @param echo true if input should be echoed.
+   * @return @c true on success, false otherwise
+   */
+  bool setEcho (bool echo);
+
+  /**
+   * @return the name of the slave pty device.
+   *
+   * This function should be called only while the pty is open.
+   */
+  const char *ttyName () const;
+
+  /**
+   * @return the file descriptor of the master pty
+   *
+   * This function should be called only while the pty is open.
+   */
+  int masterFd () const;
+
+  /**
+   * @return the file descriptor of the slave pty
+   *
+   * This function should be called only while the pty slave is open.
+   */
+  int slaveFd () const;
+
+protected:
+  /**
+   * @internal
+   */
+    KPty (KPtyPrivate * d);
+
+  /**
+   * @internal
+   */
+  KPtyPrivate *const d_ptr;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/KPtyDevice.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,456 @@
+/*
+
+   This file is part of the KDE libraries
+   Copyright (C) 2007 Oswald Buddenhagen <ossi@kde.org>
+   Copyright (C) 2010 KDE e.V. <kde-ev-board@kde.org>
+     Author Adriaan de Groot <groot@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+
+#include "KPtyDevice.h"
+#define i18n
+
+#include <QtCore/QSocketNotifier>
+
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#if defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
+  // "the other end's output queue size" - kinda braindead, huh?
+#define PTY_BYTES_AVAILABLE TIOCOUTQ
+#elif defined(TIOCINQ)
+  // "our end's input queue size"
+#define PTY_BYTES_AVAILABLE TIOCINQ
+#else
+  // likewise. more generic ioctl (theoretically)
+#define PTY_BYTES_AVAILABLE FIONREAD
+#endif
+
+//////////////////
+// private data //
+//////////////////
+
+// Lifted from Qt. I don't think they would mind. ;)
+// Re-lift again from Qt whenever a proper replacement for pthread_once appears
+static void
+qt_ignore_sigpipe ()
+{
+  static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER (0);
+  if (atom.testAndSetRelaxed (0, 1))
+    {
+      struct sigaction noaction;
+      memset (&noaction, 0, sizeof (noaction));
+      noaction.sa_handler = SIG_IGN;
+      sigaction (SIGPIPE, &noaction, 0);
+    }
+}
+
+#define NO_INTR(ret,func) do { ret = func; } while (ret < 0 && errno == EINTR)
+
+bool
+KPtyDevicePrivate::_k_canRead ()
+{
+  Q_Q (KPtyDevice);
+  qint64 readBytes = 0;
+
+#ifdef Q_OS_IRIX		// this should use a config define, but how to check it?
+  size_t available;
+#else
+  int available;
+#endif
+  if (!::ioctl (q->masterFd (), PTY_BYTES_AVAILABLE, (char *) &available))
+    {
+#ifdef Q_OS_SOLARIS
+      // A Pty is a STREAMS module, and those can be activated
+      // with 0 bytes available. This happens either when ^C is
+      // pressed, or when an application does an explicit write(a,b,0)
+      // which happens in experiments fairly often. When 0 bytes are
+      // available, you must read those 0 bytes to clear the STREAMS
+      // module, but we don't want to hit the !readBytes case further down.
+      if (!available)
+        {
+          char c;
+          // Read the 0-byte STREAMS message
+          NO_INTR (readBytes, read (q->masterFd (), &c, 0));
+          // Should return 0 bytes read; -1 is error
+          if (readBytes < 0)
+            {
+              readNotifier->setEnabled (false);
+              emit q->readEof ();
+              return false;
+            }
+          return true;
+        }
+#endif
+
+      char *ptr = readBuffer.reserve (available);
+#ifdef Q_OS_SOLARIS
+      // Even if available > 0, it is possible for read()
+      // to return 0 on Solaris, due to 0-byte writes in the stream.
+      // Ignore them and keep reading until we hit *some* data.
+      // In Solaris it is possible to have 15 bytes available
+      // and to (say) get 0, 0, 6, 0 and 9 bytes in subsequent reads.
+      // Because the stream is set to O_NONBLOCK in finishOpen(),
+      // an EOF read will return -1.
+      readBytes = 0;
+      while (!readBytes)
+#endif
+        // Useless block braces except in Solaris
+        {
+          NO_INTR (readBytes, read (q->masterFd (), ptr, available));
+        }
+      if (readBytes < 0)
+        {
+          readBuffer.unreserve (available);
+          q->setErrorString (i18n ("Error reading from PTY"));
+          return false;
+        }
+      readBuffer.unreserve (available - readBytes);	// *should* be a no-op
+    }
+
+  if (!readBytes)
+    {
+      readNotifier->setEnabled (false);
+      emit q->readEof ();
+      return false;
+    }
+  else
+    {
+      if (!emittedReadyRead)
+        {
+          emittedReadyRead = true;
+          emit q->readyRead ();
+          emittedReadyRead = false;
+        }
+      return true;
+    }
+}
+
+bool
+KPtyDevicePrivate::_k_canWrite ()
+{
+  Q_Q (KPtyDevice);
+
+  writeNotifier->setEnabled (false);
+  if (writeBuffer.isEmpty ())
+    return false;
+
+  qt_ignore_sigpipe ();
+  int wroteBytes;
+  NO_INTR (wroteBytes,
+           write (q->masterFd (),
+                  writeBuffer.readPointer (), writeBuffer.readSize ()));
+  if (wroteBytes < 0)
+    {
+      q->setErrorString (i18n ("Error writing to PTY"));
+      return false;
+    }
+  writeBuffer.free (wroteBytes);
+
+  if (!emittedBytesWritten)
+    {
+      emittedBytesWritten = true;
+      emit q->bytesWritten (wroteBytes);
+      emittedBytesWritten = false;
+    }
+
+  if (!writeBuffer.isEmpty ())
+    writeNotifier->setEnabled (true);
+  return true;
+}
+
+#ifndef timeradd
+// Lifted from GLIBC
+#define timeradd(a, b, result) \
+    do { \
+        (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
+        (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
+        if ((result)->tv_usec >= 1000000) { \
+            ++(result)->tv_sec; \
+            (result)->tv_usec -= 1000000; \
+        } \
+    } while (0)
+#define timersub(a, b, result) \
+    do { \
+        (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+        (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+        if ((result)->tv_usec < 0) { \
+            --(result)->tv_sec; \
+            (result)->tv_usec += 1000000; \
+        } \
+    } while (0)
+#endif
+
+bool
+KPtyDevicePrivate::doWait (int msecs, bool reading)
+{
+  Q_Q (KPtyDevice);
+#ifndef __linux__
+  struct timeval etv;
+#endif
+  struct timeval tv, *tvp;
+
+  if (msecs < 0)
+    tvp = 0;
+  else
+    {
+      tv.tv_sec = msecs / 1000;
+      tv.tv_usec = (msecs % 1000) * 1000;
+#ifndef __linux__
+      gettimeofday (&etv, 0);
+      timeradd (&tv, &etv, &etv);
+#endif
+      tvp = &tv;
+    }
+
+  while (reading ? readNotifier->isEnabled () : !writeBuffer.isEmpty ())
+    {
+      fd_set rfds;
+      fd_set wfds;
+
+      FD_ZERO (&rfds);
+      FD_ZERO (&wfds);
+
+      if (readNotifier->isEnabled ())
+        FD_SET (q->masterFd (), &rfds);
+      if (!writeBuffer.isEmpty ())
+        FD_SET (q->masterFd (), &wfds);
+
+#ifndef __linux__
+      if (tvp)
+        {
+          gettimeofday (&tv, 0);
+          timersub (&etv, &tv, &tv);
+          if (tv.tv_sec < 0)
+            tv.tv_sec = tv.tv_usec = 0;
+        }
+#endif
+
+      switch (select (q->masterFd () + 1, &rfds, &wfds, 0, tvp))
+        {
+        case -1:
+          if (errno == EINTR)
+            break;
+          return false;
+        case 0:
+          q->setErrorString (i18n ("PTY operation timed out"));
+          return false;
+        default:
+          if (FD_ISSET (q->masterFd (), &rfds))
+            {
+              bool canRead = _k_canRead ();
+              if (reading && canRead)
+                return true;
+            }
+          if (FD_ISSET (q->masterFd (), &wfds))
+            {
+              bool canWrite = _k_canWrite ();
+              if (!reading)
+                return canWrite;
+            }
+          break;
+        }
+    }
+  return false;
+}
+
+void
+KPtyDevicePrivate::finishOpen (QIODevice::OpenMode mode)
+{
+  Q_Q (KPtyDevice);
+
+  q->QIODevice::open (mode);
+  fcntl (q->masterFd (), F_SETFL, O_NONBLOCK);
+  readBuffer.clear ();
+  readNotifier =
+    new QSocketNotifier (q->masterFd (), QSocketNotifier::Read, q);
+  writeNotifier =
+    new QSocketNotifier (q->masterFd (), QSocketNotifier::Write, q);
+  QObject::connect (readNotifier, SIGNAL (activated (int)), q,
+                    SLOT (_k_canRead ()));
+  QObject::connect (writeNotifier, SIGNAL (activated (int)), q,
+                    SLOT (_k_canWrite ()));
+  readNotifier->setEnabled (true);
+}
+
+/////////////////////////////
+// public member functions //
+/////////////////////////////
+
+KPtyDevice::KPtyDevice (QObject * parent):
+QIODevice (parent), KPty (new KPtyDevicePrivate (this))
+{
+}
+
+KPtyDevice::~KPtyDevice ()
+{
+  close ();
+}
+
+bool
+KPtyDevice::open (OpenMode mode)
+{
+  Q_D (KPtyDevice);
+
+  if (masterFd () >= 0)
+    return true;
+
+  if (!KPty::open ())
+    {
+      setErrorString (i18n ("Error opening PTY"));
+      return false;
+    }
+
+  d->finishOpen (mode);
+
+  return true;
+}
+
+bool
+KPtyDevice::open (int fd, OpenMode mode)
+{
+  Q_D (KPtyDevice);
+
+  if (!KPty::open (fd))
+    {
+      setErrorString (i18n ("Error opening PTY"));
+      return false;
+    }
+
+  d->finishOpen (mode);
+
+  return true;
+}
+
+void
+KPtyDevice::close ()
+{
+  Q_D (KPtyDevice);
+
+  if (masterFd () < 0)
+    return;
+
+  delete d->readNotifier;
+  delete d->writeNotifier;
+
+  QIODevice::close ();
+
+  KPty::close ();
+}
+
+bool
+KPtyDevice::isSequential () const
+{
+  return true;
+}
+
+bool
+KPtyDevice::canReadLine () const
+{
+  Q_D (const KPtyDevice);
+  return QIODevice::canReadLine () || d->readBuffer.canReadLine ();
+}
+
+bool
+KPtyDevice::atEnd () const
+{
+  Q_D (const KPtyDevice);
+  return QIODevice::atEnd () && d->readBuffer.isEmpty ();
+}
+
+qint64
+KPtyDevice::bytesAvailable () const
+{
+  Q_D (const KPtyDevice);
+  return QIODevice::bytesAvailable () + d->readBuffer.size ();
+}
+
+qint64
+KPtyDevice::bytesToWrite () const
+{
+  Q_D (const KPtyDevice);
+  return d->writeBuffer.size ();
+}
+
+bool
+KPtyDevice::waitForReadyRead (int msecs)
+{
+  Q_D (KPtyDevice);
+  return d->doWait (msecs, true);
+}
+
+bool
+KPtyDevice::waitForBytesWritten (int msecs)
+{
+  Q_D (KPtyDevice);
+  return d->doWait (msecs, false);
+}
+
+void
+KPtyDevice::setSuspended (bool suspended)
+{
+  Q_D (KPtyDevice);
+  d->readNotifier->setEnabled (!suspended);
+}
+
+bool
+KPtyDevice::isSuspended () const
+{
+  Q_D (const KPtyDevice);
+  return !d->readNotifier->isEnabled ();
+}
+
+// protected
+qint64
+KPtyDevice::readData (char *data, qint64 maxlen)
+{
+  Q_D (KPtyDevice);
+  return d->readBuffer.read (data, (int) qMin < qint64 > (maxlen, KMAXINT));
+}
+
+// protected
+qint64
+KPtyDevice::readLineData (char *data, qint64 maxlen)
+{
+  Q_D (KPtyDevice);
+  return d->readBuffer.readLine (data,
+                                 (int) qMin < qint64 > (maxlen, KMAXINT));
+}
+
+// protected
+qint64
+KPtyDevice::writeData (const char *data, qint64 len)
+{
+  Q_D (KPtyDevice);
+  Q_ASSERT (len <= KMAXINT);
+
+  d->writeBuffer.write (data, len);
+  d->writeNotifier->setEnabled (true);
+  return len;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/KPtyDevice.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,356 @@
+/* This file is part of the KDE libraries
+
+    Copyright (C) 2007 Oswald Buddenhagen <ossi@kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef kptydev_h
+#define kptydev_h
+
+struct KPtyPrivate;
+struct KPtyDevicePrivate;
+
+#include "KPty.h"
+#include <QtCore/QIODevice>
+#include <QSocketNotifier>
+
+#define Q_DECLARE_PRIVATE_MI(Class, SuperClass) \
+    inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(SuperClass::d_ptr); } \
+    inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(SuperClass::d_ptr); } \
+    friend class Class##Private;
+
+/**
+ * Encapsulates KPty into a QIODevice, so it can be used with Q*Stream, etc.
+ */
+class KPtyDevice:public QIODevice, public KPty
+{				//krazy:exclude=dpointer (via macro)
+Q_OBJECT Q_DECLARE_PRIVATE_MI (KPtyDevice, KPty) public:
+
+    /**
+     * Constructor
+     */
+  KPtyDevice (QObject * parent = 0);
+
+    /**
+     * Destructor:
+     *
+     *  If the pty is still open, it will be closed. Note, however, that
+     *  an utmp registration is @em not undone.
+     */
+  virtual ~ KPtyDevice ();
+
+    /**
+     * Create a pty master/slave pair.
+     *
+     * @return true if a pty pair was successfully opened
+     */
+  virtual bool open (OpenMode mode = ReadWrite | Unbuffered);
+
+    /**
+     * Open using an existing pty master. The ownership of the fd
+     * remains with the caller, i.e., close() will not close the fd.
+     *
+     * This is useful if you wish to attach a secondary "controller" to an
+     * existing pty device such as a terminal widget.
+     * Note that you will need to use setSuspended() on both devices to
+     * control which one gets the incoming data from the pty.
+     *
+     * @param fd an open pty master file descriptor.
+     * @param mode the device mode to open the pty with.
+     * @return true if a pty pair was successfully opened
+     */
+  bool open (int fd, OpenMode mode = ReadWrite | Unbuffered);
+
+    /**
+     * Close the pty master/slave pair.
+     */
+  virtual void close ();
+
+    /**
+     * Sets whether the KPtyDevice monitors the pty for incoming data.
+     *
+     * When the KPtyDevice is suspended, it will no longer attempt to buffer
+     * data that becomes available from the pty and it will not emit any
+     * signals.
+     *
+     * Do not use on closed ptys.
+     * After a call to open(), the pty is not suspended. If you need to
+     * ensure that no data is read, call this function before the main loop
+     * is entered again (i.e., immediately after opening the pty).
+     */
+  void setSuspended (bool suspended);
+
+    /**
+     * Returns true if the KPtyDevice is not monitoring the pty for incoming
+     * data.
+     *
+     * Do not use on closed ptys.
+     *
+     * See setSuspended()
+     */
+  bool isSuspended () const;
+
+    /**
+     * @return always true
+     */
+  virtual bool isSequential () const;
+
+    /**
+     * @reimp
+     */
+  bool canReadLine () const;
+
+    /**
+     * @reimp
+     */
+  bool atEnd () const;
+
+    /**
+     * @reimp
+     */
+  qint64 bytesAvailable () const;
+
+    /**
+     * @reimp
+     */
+  qint64 bytesToWrite () const;
+
+  bool waitForBytesWritten (int msecs = -1);
+  bool waitForReadyRead (int msecs = -1);
+
+
+    Q_SIGNALS:
+    /**
+     * Emitted when EOF is read from the PTY.
+     *
+     * Data may still remain in the buffers.
+     */
+  void readEof ();
+
+protected:
+    virtual qint64 readData (char *data, qint64 maxSize);
+  virtual qint64 readLineData (char *data, qint64 maxSize);
+  virtual qint64 writeData (const char *data, qint64 maxSize);
+
+private:
+  Q_PRIVATE_SLOT (d_func (), bool _k_canRead ())
+    Q_PRIVATE_SLOT (d_func (), bool _k_canWrite ())};
+
+#define KMAXINT ((int)(~0U >> 1))
+
+/////////////////////////////////////////////////////
+// Helper. Remove when QRingBuffer becomes public. //
+/////////////////////////////////////////////////////
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qlinkedlist.h>
+
+#define CHUNKSIZE 4096
+
+class KRingBuffer
+{
+public:
+  KRingBuffer ()
+  {
+    clear ();
+  }
+
+  void clear ()
+  {
+    buffers.clear ();
+    QByteArray tmp;
+    tmp.resize (CHUNKSIZE);
+    buffers << tmp;
+    head = tail = 0;
+    totalSize = 0;
+  }
+
+  inline bool isEmpty () const
+  {
+    return buffers.count () == 1 && !tail;
+  }
+
+  inline int size () const
+  {
+    return totalSize;
+  }
+
+  inline int readSize () const
+  {
+    return (buffers.count () == 1 ? tail : buffers.first ().size ()) - head;
+  }
+
+  inline const char *readPointer () const
+  {
+    Q_ASSERT (totalSize > 0);
+    return buffers.first ().constData () + head;
+  }
+
+  void free (int bytes)
+  {
+    totalSize -= bytes;
+    Q_ASSERT (totalSize >= 0);
+
+    forever
+    {
+      int nbs = readSize ();
+
+      if (bytes < nbs)
+        {
+          head += bytes;
+          if (head == tail && buffers.count () == 1)
+            {
+              buffers.first ().resize (CHUNKSIZE);
+              head = tail = 0;
+            }
+          break;
+        }
+
+      bytes -= nbs;
+      if (buffers.count () == 1)
+        {
+          buffers.first ().resize (CHUNKSIZE);
+          head = tail = 0;
+          break;
+        }
+
+      buffers.removeFirst ();
+      head = 0;
+    }
+  }
+
+  char *reserve (int bytes)
+  {
+    totalSize += bytes;
+
+    char *ptr;
+    if (tail + bytes <= buffers.last ().size ())
+      {
+        ptr = buffers.last ().data () + tail;
+        tail += bytes;
+      }
+    else
+      {
+        buffers.last ().resize (tail);
+        QByteArray tmp;
+        tmp.resize (qMax (CHUNKSIZE, bytes));
+        ptr = tmp.data ();
+        buffers << tmp;
+        tail = bytes;
+      }
+    return ptr;
+  }
+
+  // release a trailing part of the last reservation
+  inline void unreserve (int bytes)
+  {
+    totalSize -= bytes;
+    tail -= bytes;
+  }
+
+  inline void write (const char *data, int len)
+  {
+    memcpy (reserve (len), data, len);
+  }
+
+  // Find the first occurrence of c and return the index after it.
+  // If c is not found until maxLength, maxLength is returned, provided
+  // it is smaller than the buffer size. Otherwise -1 is returned.
+  int indexAfter (char c, int maxLength = KMAXINT) const
+  {
+    int index = 0;
+    int start = head;
+      QLinkedList < QByteArray >::ConstIterator it = buffers.begin ();
+      forever
+    {
+      if (!maxLength)
+        return index;
+      if (index == size ())
+        return -1;
+      const QByteArray & buf = *it;
+      ++it;
+      int len = qMin ((it == buffers.end ()? tail : buf.size ()) - start,
+                      maxLength);
+      const char *ptr = buf.data () + start;
+      if (const char *rptr = (const char *)memchr (ptr, c, len))
+        return index + (rptr - ptr) + 1;
+        index += len;
+        maxLength -= len;
+        start = 0;
+    }
+  }
+
+  inline int lineSize (int maxLength = KMAXINT) const
+  {
+    return indexAfter ('\n', maxLength);
+  }
+
+  inline bool canReadLine () const
+  {
+    return lineSize () != -1;
+  }
+
+  int read (char *data, int maxLength)
+  {
+    int bytesToRead = qMin (size (), maxLength);
+    int readSoFar = 0;
+    while (readSoFar < bytesToRead)
+      {
+        const char *ptr = readPointer ();
+        int bs = qMin (bytesToRead - readSoFar, readSize ());
+        memcpy (data + readSoFar, ptr, bs);
+        readSoFar += bs;
+        free (bs);
+      }
+    return readSoFar;
+  }
+
+  int readLine (char *data, int maxLength)
+  {
+    return read (data, lineSize (qMin (maxLength, size ())));
+  }
+
+private:
+  QLinkedList < QByteArray > buffers;
+  int head, tail;
+  int totalSize;
+};
+
+struct KPtyDevicePrivate:public KPtyPrivate
+{
+  Q_DECLARE_PUBLIC (KPtyDevice)
+    KPtyDevicePrivate (KPty * parent):KPtyPrivate (parent),
+    emittedReadyRead (false), emittedBytesWritten (false),
+    readNotifier (0), writeNotifier (0)
+  {
+  }
+
+  bool _k_canRead ();
+  bool _k_canWrite ();
+
+  bool doWait (int msecs, bool reading);
+  void finishOpen (QIODevice::OpenMode mode);
+
+  bool emittedReadyRead;
+  bool emittedBytesWritten;
+  QSocketNotifier *readNotifier;
+  QSocketNotifier *writeNotifier;
+  KRingBuffer readBuffer;
+  KRingBuffer writeBuffer;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/LinuxTerminalEmulation.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,253 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "LinuxTerminalEmulation.h"
+
+LinuxTerminalEmulation::LinuxTerminalEmulation ()
+  : TerminalEmulation ()
+{
+  int fdm, fds;
+  openpty (&fdm, &fds, 0, 0, 0);
+
+  dup2 (fds, STDIN_FILENO);
+  dup2 (fds, STDOUT_FILENO);
+  dup2 (fds, STDERR_FILENO);
+
+  m_pty = new KPtyDevice ();
+  m_pty->open (fdm);
+  connect (m_pty, SIGNAL(readyRead ()),
+           this, SLOT (handleReadyRead ()));
+}
+
+LinuxTerminalEmulation::~LinuxTerminalEmulation ()
+{
+  m_pty->close ();
+}
+
+void LinuxTerminalEmulation::processKeyEvent (QKeyEvent *keyEvent)
+{
+  switch (keyEvent->key ())
+    {
+      case Qt::Key_PageUp:
+      //if (verticalScrollBar ())
+      //  verticalScrollBar ()->setValue (verticalScrollBar ()->value () - 10);
+      return;
+      case Qt::Key_PageDown:
+      //if (verticalScrollBar ())
+      //  verticalScrollBar ()->setValue (verticalScrollBar ()->value () + 10);
+      return;
+
+      case Qt::Key_Up:
+      m_pty->write ("\033OA");
+      break;
+
+      case Qt::Key_Down:
+      m_pty->write ("\033OB");
+      break;
+
+      case Qt::Key_Right:
+      m_pty->write ("\033OC");
+      break;
+
+      case Qt::Key_Left:
+      m_pty->write ("\033OF");
+      break;
+
+      case Qt::Key_C:
+      if (keyEvent->modifiers() & Qt::ControlModifier)
+        {
+          // TODO: Lookup and implement Control + C.
+        }
+      else
+        {
+          m_pty->write (keyEvent->text ().toAscii ());
+        }
+      break;
+
+      case Qt::Key_V:
+      if (keyEvent->modifiers() & Qt::ControlModifier)
+        {
+          // TODO: Lookup and implement Control + V.
+        }
+      else
+        {
+          m_pty->write (keyEvent->text ().toAscii ());
+        }
+      break;
+
+      case Qt::Key_D:
+      if (keyEvent->modifiers() & Qt::ControlModifier)
+        {
+          // Do not send EOT, because this will crash
+          // the program.
+        }
+      else
+        {
+          m_pty->write (keyEvent->text ().toAscii ());
+        }
+      break;
+
+      default:
+      m_pty->write (keyEvent->text ().toAscii ());
+      break;
+    }
+  keyEvent->accept ();
+}
+
+void
+LinuxTerminalEmulation::transmitText (const QString &text)
+{
+  m_pty->write (text.toLocal8Bit ());
+}
+
+void
+LinuxTerminalEmulation::handleReadyRead ()
+{
+  QByteArray data = m_pty->readAll ();
+
+  data.replace("\033[K", "");
+  data.replace("\033[9", "");
+  data.replace("\033[A", "");
+  data.replace("\033[B", "");
+  data.replace("\033[C", "");
+  data.replace("\033[D", "");
+  data.replace("\033[1", "");
+  data.replace("\033[H", "");
+  data.replace("\033[2J", "");
+  int position;
+  QTextCursor tc = m_terminal->textCursor ();
+  tc.beginEditBlock ();
+
+  // Decode data into cursor actions.
+  foreach(QChar character, data)
+    {
+      unsigned short unicode = character.unicode ();
+      switch (unicode)
+        {
+        case 0: // Null (NUL)
+          qDebug ("NUL");
+          break;
+        case 1: // Start Of Heading (SOH)
+          qDebug ("SOH");
+          break;
+        case 2: // Start Of Text (STX)
+          qDebug ("STX");
+          break;
+        case 3: // End Of Text (ETX)
+          qDebug ("ETX");
+          break;
+        case 4: // End Of Transmission (EOT)
+          qDebug ("EOT");
+          break;
+        case 5: // Enquiry (ENQ)
+          qDebug ("ENQ");
+          break;
+        case 6: // Acknowledgement (ACK)
+          qDebug ("ACK");
+          break;
+        case 7: // Bell (BEL)
+          m_terminal->bell ();
+          break;
+        case 8: // Backspace (BS)
+          tc.deletePreviousChar ();
+          break;
+        case 9: // Horizontal Tab (HT)
+          qDebug ("HT");
+          break;
+        case 10: // Line Feed (LF)
+          position = tc.position ();
+          tc.movePosition (QTextCursor::EndOfLine);
+          tc.insertText ("\n");
+          tc.setPosition (position);
+          tc.movePosition (QTextCursor::Down);
+          break;
+        case 11: // Vertical Tab (VT)
+          qDebug ("VT");
+          break;
+        case 12: // Form Feed (FF)
+          qDebug ("FF");
+          break;
+        case 13: // Carriage Return (CR)
+          tc.movePosition (QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
+          break;
+        case 14: // Shift Out (SO)
+          qDebug ("SO");
+          break;
+        case 15: // Shift In (SI)
+          qDebug ("SI");
+          break;
+        case 16: // Data Link Escape (DLE)
+          qDebug ("DLE");
+          break;
+        case 17: // Device Control 1 (DC1, XON)
+          qDebug ("DC1");
+          break;
+        case 18: // Device Control 2 (DC2)
+          qDebug ("DC2");
+          break;
+        case 19: // Device Control 3 (DC3, XOFF)
+          qDebug ("DC3");
+          break;
+        case 20: // Device Control 4 (DC4)
+          qDebug ("DC4");
+          break;
+        case 21: // Negative Acknowledgement (NAK)
+          qDebug ("NAK");
+          break;
+        case 22: // Synchronous Idle (SYN)
+          qDebug ("SYN");
+          break;
+        case 23: // End Of Transmission Block (ETB)
+          qDebug ("ETB");
+          break;
+        case 24: // Cancel (CAN)
+          qDebug ("CAN");
+          break;
+        case 25: // End of Medium (EM)
+          qDebug ("EM");
+          break;
+        case 26: // Substitute (SUB)
+          qDebug ("SUB");
+          break;
+        case 27: // Escape (ESC)
+          qDebug ("ESC");
+          break;
+        case 28: // File Separator (FS)
+          qDebug ("FS");
+          break;
+        case 29: // Group Separator (GS)
+          qDebug ("GS");
+          break;
+        case 30: // Record Separator (RS)
+          qDebug ("RS");
+          break;
+        case 31: // Unit Separator (US)
+          qDebug ("US");
+          break;
+        case 127: // Delete (DEL)
+          qDebug ("DEL");
+          break;
+        default:
+          tc.insertText (character);
+          break;
+        }
+    }
+
+  tc.endEditBlock ();
+  m_terminal->setTextCursor (tc);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/LinuxTerminalEmulation.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,50 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LINUXTERMINALEMULATION_H
+#define LINUXTERMINALEMULATION_H
+
+#include "TerminalEmulation.h"
+#include "KPtyDevice.h"
+
+/**
+  * @class LinuxTerminalEmulation
+  * Implements the terminal emulation on Linux and Unix as well as Unix-like
+  * systems, like MacOSX.
+  */
+class LinuxTerminalEmulation : public TerminalEmulation
+{
+  Q_OBJECT
+public:
+  LinuxTerminalEmulation ();
+  ~LinuxTerminalEmulation ();
+
+  /** @reimp */
+  void processKeyEvent (QKeyEvent *keyEvent);
+
+  /** @reimp */
+  void transmitText (const QString &text);
+
+private slots:
+  void handleReadyRead ();
+
+private:
+  /** KPtyDevice from the Konsole sources. */
+  KPtyDevice *m_pty;
+};
+
+#endif // LINUXTERMINALEMULATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/TerminalEmulation.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,40 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "TerminalEmulation.h"
+
+#ifdef Q_OS_UNIX
+  #include "LinuxTerminalEmulation.h"
+#endif
+
+TerminalEmulation *TerminalEmulation::newTerminalEmulation (Terminal *terminal)
+{
+#ifdef Q_OS_UNIX
+  TerminalEmulation *terminalEmulation = new LinuxTerminalEmulation ();
+  terminalEmulation->m_terminal = terminal;
+  return terminalEmulation;
+#endif
+#ifdef Q_OS_WIN
+  // TODO: Implement on Windows.
+  return 0;
+#endif
+}
+
+TerminalEmulation::TerminalEmulation ()
+  : QObject ()
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/TerminalEmulation.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,75 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TERMINALEMULATION_H
+#define TERMINALEMULATION_H
+
+#include <QObject>
+#include <QKeyEvent>
+#include <QMouseEvent>
+#include <QTextCursor>
+
+/**
+  * @class Terminal
+  * Interface for a terminal. This is the counterpart for the terminal
+  * emulation and must be implemented by the view part. It defines a basic set
+  * of actions that must be supported by the view part.
+  */
+class Terminal
+{
+  public:
+    /** Queries the current text cursor.
+      * @return The current text cursor. */
+    virtual QTextCursor textCursor () = 0;
+
+    /** Sets the given text cursor.
+      * @param cursor New text cursor to set. */
+    virtual void setTextCursor (const QTextCursor& cursor) = 0;
+
+    /** Called whenever the bell has been activated. */
+    virtual void bell () = 0;
+};
+
+/**
+  * @class TerminalEmulation
+  * Interface for any terminal emulation. It's the counterpart to the Terminal.
+  */
+class TerminalEmulation : public QObject
+{
+  Q_OBJECT
+public:
+  /** Produces a new terminal emulation for a specific terminal.
+    * @param terminal The terminal associated with the emulation
+    * @return Terminal emulation. */
+  static TerminalEmulation *newTerminalEmulation (Terminal *terminal);
+
+  TerminalEmulation ();
+  virtual ~TerminalEmulation () {}
+
+  /** Processes an incoming key event.
+    * @param keyEvent Key event to process. */
+  virtual void processKeyEvent (QKeyEvent *keyEvent) = 0;
+
+  /** Transmit a block of text straight to the terminal emulation.
+    * @param text Text to be transmitted. */
+  virtual void transmitText (const QString& text) = 0;
+protected:
+  /** The terminal this terminal emulation is connected to. */
+  Terminal *m_terminal;
+};
+
+#endif // TERMINALEMULATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/win32/QConsole	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+#include "QConsole.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/win32/QConsole.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,873 @@
+/*
+
+Copyright (C) 2011 Michael Goffioul.
+
+This file is part of QConsole.
+
+Foobar 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 3 of the License, or
+(at your option) any later version.
+
+QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QApplication>
+#include <QColor>
+#include <QFont>
+#include <QHBoxLayout>
+#include <QPaintEvent>
+#include <QPainter>
+#include <QResizeEvent>
+#include <QScrollBar>
+#include <QtDebug>
+#include <QThread>
+#include <QTimer>
+
+#include <fcntl.h>
+#include <io.h>
+#include <stdio.h>
+#include <stdarg.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <cstring>
+
+#include "QConsole.h"
+#include "QConsoleColors.h"
+
+// Uncomment to log activity to LOGFILENAME
+// #define DEBUG_QCONSOLE
+#define LOGFILENAME "QConsole.log"
+// Uncomment to create hidden console window
+#define HIDDEN_CONSOLE
+
+//////////////////////////////////////////////////////////////////////////////
+
+class QConsoleView : public QWidget
+{
+public:
+  QConsoleView (QConsole* parent = 0) : QWidget (parent), q (parent) { }
+  ~QConsoleView (void) { }
+
+protected:
+  void paintEvent (QPaintEvent* event) { q->viewPaintEvent (this, event); }
+  void resizeEvent (QResizeEvent* event) { q->viewResizeEvent (this, event); }
+
+private:
+  QConsole* q;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class QConsoleThread : public QThread
+{
+public:
+  QConsoleThread (QConsole* console) : QThread (console), q (console) { }
+
+protected:
+  void run (void)
+    { q->start (); }
+
+private:
+  QConsole* q;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class QConsolePrivate
+{
+  friend class QConsole;
+
+public:
+  QConsolePrivate (QConsole* parent, const QString& cmd = QString ());
+  ~QConsolePrivate (void);
+
+  void updateConsoleSize (bool sync = false);
+  void syncConsoleParameters (void);
+  void grabConsoleBuffer (CHAR_INFO* buf = 0);
+  void updateScrollBar (void);
+  void setScrollValue (int value);
+  void updateConsoleView (bool grab = true);
+  void monitorConsole (void);
+  void startCommand (void);
+  void sendConsoleText (const QString& s);
+
+  void log (const char* fmt, ...);
+
+  void closeStandardIO (int fd, DWORD stdHandleId, const char* name);
+  void setupStandardIO (DWORD stdHandleId, int fd, const char* name,
+                        const char* devName);
+
+private:
+  QConsole* q;
+
+private:
+  QFont m_font;
+  QColor m_backgroundColor;
+  QString m_command;
+  QConsoleColors m_colors;
+  bool m_inWheelEvent;
+  QString m_title;
+
+  QSize m_charSize;
+  QSize m_bufferSize;
+  QRect m_consoleRect;
+  QPoint m_cursorPos;
+
+  HANDLE m_stdOut;
+  HWND m_consoleWindow;
+  CHAR_INFO* m_buffer;
+  CHAR_INFO* m_tmpBuffer;
+  HANDLE m_process;
+
+  QConsoleView* m_consoleView;
+  QScrollBar* m_scrollBar;
+  QTimer* m_consoleWatcher;
+  QConsoleThread *m_consoleThread;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+QConsolePrivate::QConsolePrivate (QConsole* parent, const QString& cmd)
+    : q (parent), m_command (cmd), m_process (NULL), m_inWheelEvent (false)
+{
+  log (NULL);
+
+  // Possibly detach from any existing console
+  log ("Detaching from existing console (if any)...\n");
+  FreeConsole ();
+  log ("Closing standard IO...\n");
+  closeStandardIO (0, STD_INPUT_HANDLE, "STDIN");
+  closeStandardIO (1, STD_OUTPUT_HANDLE, "STDOUT");
+  closeStandardIO (2, STD_ERROR_HANDLE, "STDERR");
+
+#ifdef HIDDEN_CONSOLE
+  HWINSTA hOrigSta, hNewSta;
+
+  // Create new (hidden) console
+  hOrigSta = GetProcessWindowStation ();
+  hNewSta = CreateWindowStation (NULL, 0, GENERIC_ALL, NULL);
+  log ("Current Windows station: %p.\nNew Windows station: %p.\n", hOrigSta,
+       hNewSta);
+  if (! SetProcessWindowStation (hNewSta))
+    log ("Failed to switch to new Windows station.\n");
+#endif
+  if (! AllocConsole ())
+    log ("Failed to create new console.\n");
+#ifdef HIDDEN_CONSOLE
+  if (! SetProcessWindowStation (hOrigSta))
+    log ("Failed to restore original Windows station.\n");
+  if (! CloseWindowStation (hNewSta))
+    log ("Failed to close new Windows station.\n");
+#endif
+
+  log ("New (hidden) console created.\n");
+
+  setupStandardIO (STD_INPUT_HANDLE,  0, "STDIN",  "CONIN$");
+  setupStandardIO (STD_OUTPUT_HANDLE, 1, "STDOUT", "CONOUT$");
+  setupStandardIO (STD_ERROR_HANDLE,  2, "STDERR", "CONOUT$");
+
+  log ("Standard input/output/error set up.\n");
+
+  *stdin = *(fdopen (0, "rb"));
+  *stdout = *(fdopen (1, "wb"));
+  *stderr = *(fdopen (2, "wb"));
+
+  log ("POSIX standard streams created.\n");
+
+  setvbuf (stdin, NULL, _IONBF, 0);
+  setvbuf (stdout, NULL, _IONBF, 0);
+  setvbuf (stderr, NULL, _IONBF, 0);
+
+  log ("POSIX standard stream buffers adjusted.\n");
+
+  HANDLE hStdOut = GetStdHandle (STD_OUTPUT_HANDLE);
+
+  log ("Console allocated: hStdOut: %p\n", hStdOut);
+
+  m_stdOut = hStdOut;
+  m_consoleWindow = GetConsoleWindow ();
+
+  // In case the console window hasn't been created hidden...
+  ShowWindow (m_consoleWindow, SW_HIDE);
+
+  CONSOLE_SCREEN_BUFFER_INFO sbi;
+
+  GetConsoleScreenBufferInfo (hStdOut, &sbi);
+  m_bufferSize = QSize (sbi.dwSize.X, qMax (sbi.dwSize.Y, (SHORT)500));
+  m_consoleRect = QRect (sbi.srWindow.Left, sbi.srWindow.Top,
+                         sbi.srWindow.Right - sbi.srWindow.Left + 1,
+                         sbi.srWindow.Bottom - sbi.srWindow.Top + 1);
+  m_cursorPos = QPoint (sbi.dwCursorPosition.X, sbi.dwCursorPosition.Y);
+
+  log ("Initial console parameters:\n");
+  log ("  buffer size: %d x %d\n", m_bufferSize.width (),
+       m_bufferSize.height ());
+  log ("  window: (%d, %d) -> (%d, %d) [%d x %d]\n",
+       m_consoleRect.left (), m_consoleRect.top (),
+       m_consoleRect.right (), m_consoleRect.bottom (),
+       m_consoleRect.width (), m_consoleRect.height ());
+
+  wchar_t titleBuf[260];
+  GetConsoleTitleW (titleBuf, sizeof (titleBuf));
+  q->setWindowTitle (QString::fromWCharArray (titleBuf));
+
+  m_font.setFamily ("Lucida Console");
+  m_font.setPointSize (9);
+  m_font.setStyleHint (QFont::TypeWriter);
+  m_backgroundColor = Qt::black;
+
+  m_buffer = m_tmpBuffer = 0;
+
+  m_consoleView = new QConsoleView (parent);
+  m_scrollBar = new QScrollBar (Qt::Vertical, parent);
+
+  QHBoxLayout* l = new QHBoxLayout (parent);
+  l->setContentsMargins (0, 0, 0, 0);
+  l->setSpacing (0);
+  l->addWidget (m_consoleView, 1);
+  l->addWidget (m_scrollBar, 0);
+
+  m_consoleView->setPalette (QPalette (m_backgroundColor));
+  m_consoleView->setAutoFillBackground (true);
+  m_consoleView->setFont (m_font);
+  parent->setFocusPolicy (Qt::StrongFocus);
+  parent->winId ();
+
+  updateScrollBar ();
+
+  m_consoleWatcher = new QTimer (parent);
+  m_consoleWatcher->setInterval (10);
+  m_consoleWatcher->setSingleShot (false);
+  
+  QObject::connect (m_scrollBar, SIGNAL (valueChanged (int)),
+                    q, SLOT (scrollValueChanged (int)));
+  QObject::connect (m_consoleWatcher, SIGNAL (timeout (void)),
+                    q, SLOT (monitorConsole (void)));
+
+  m_consoleWatcher->start ();
+
+  if (m_command.isEmpty ())
+    m_consoleThread = 0;
+  else
+    {
+      m_consoleThread = new QConsoleThread (q);
+      QObject::connect (m_consoleThread, SIGNAL (finished (void)),
+                        q, SIGNAL (terminated (void)));
+      m_consoleThread->start ();
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+QConsolePrivate::~QConsolePrivate (void)
+{
+  if (m_consoleThread && m_consoleThread->isRunning () && m_process)
+    {
+      TerminateProcess (m_process, (UINT)-1);
+      m_consoleThread->wait ();
+    }
+  if (m_buffer)
+    delete [] m_buffer;
+  if (m_tmpBuffer)
+    delete [] m_tmpBuffer;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::setupStandardIO (DWORD stdHandleId, int targetFd,
+                                       const char* name, const char* devName)
+{
+  log ("Opening %s...\n", devName);
+
+  int fd = open (devName, _O_RDWR | _O_BINARY);
+
+  if (fd != -1)
+    {
+      if (fd != targetFd)
+        {
+          log ("Opened %s is not at target file descriptor %d, "
+               "duplicating...\n", name, targetFd);
+          if (dup2 (fd, targetFd) == -1)
+            log ("Failed to duplicate file descriptor: errno=%d.\n", errno);
+          if (close (fd) == -1)
+            log ("Failed to close original file descriptor: errno=%d.\n",
+                 errno);
+        }
+      else
+        log ("%s opened and assigned to file descriptor %d.\n", devName, fd);
+      if (! SetStdHandle (stdHandleId, (HANDLE) _get_osfhandle (targetFd)))
+        log ("Failed to re-assign %s: error=%08x.\n", name, GetLastError ());
+    }
+  else
+    log ("Failed to open %s: errno=%d.\n", devName, errno);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::closeStandardIO (int fd, DWORD stdHandleId,
+                                       const char* name)
+{
+  if (close (fd) == -1)
+    log ("Failed to close file descriptor %d: errno=%d.\n", fd, errno);
+  if (! CloseHandle (GetStdHandle (stdHandleId)))
+    log ("Failed to close Win32 %s: error=%08x.\n", name, GetLastError ());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::log (const char* fmt, ...)
+{
+#ifdef DEBUG_QCONSOLE
+  if (fmt)
+    {
+      va_list l;
+      FILE* flog = fopen (LOGFILENAME, "ab");
+
+      va_start (l, fmt);
+      vfprintf (flog, fmt, l);
+      va_end (l);
+      fclose (flog);
+    }
+  else
+    {
+      // Special case to re-initialize the log file
+      FILE* flog = fopen (LOGFILENAME, "w");
+      fclose (flog);
+    }
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::updateConsoleSize (bool sync)
+{
+  QFontMetrics fm (m_font);
+  QSize winSize = m_consoleView->size ();
+
+  m_charSize.rwidth () = fm.maxWidth ();
+  m_charSize.rheight () = fm.lineSpacing ();
+
+  m_consoleRect.setWidth (winSize.width () / fm.maxWidth ());
+  m_consoleRect.setHeight (winSize.height () / fm.lineSpacing ());
+
+  m_bufferSize.rwidth () = m_consoleRect.width ();
+  m_bufferSize.rheight () = qMax (m_bufferSize.height (),
+                                  m_consoleRect.height ());
+
+  m_consoleRect.moveLeft (0);
+  if (m_consoleRect.bottom () >= m_bufferSize.height ())
+    m_consoleRect.moveTop (m_bufferSize.height () - m_consoleRect.height ());
+
+  log ("Console resized:\n");
+  log ("  widget size: %d x %d\n", winSize.width (), winSize.height ());
+  log ("  buffer size: %d x %d\n", m_bufferSize.width (),
+       m_bufferSize.height ());
+  log ("  window: (%d, %d) -> (%d, %d) [%d x %d]\n",
+       m_consoleRect.left (), m_consoleRect.top (),
+       m_consoleRect.right (), m_consoleRect.bottom (),
+       m_consoleRect.width (), m_consoleRect.height ());
+
+  if (sync)
+    syncConsoleParameters ();
+
+  updateScrollBar ();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::syncConsoleParameters (void)
+{
+  CONSOLE_SCREEN_BUFFER_INFO sbi;
+  HANDLE hStdOut = m_stdOut;
+
+  GetConsoleScreenBufferInfo (hStdOut, &sbi);
+
+  COORD bs;
+  SMALL_RECT sr;
+
+  bs.X = sbi.dwSize.X;
+  bs.Y = m_bufferSize.height ();
+  sr.Left   = sbi.srWindow.Left;
+  sr.Right  = sbi.srWindow.Right;
+  sr.Top    = m_consoleRect.top ();
+  sr.Bottom = m_consoleRect.bottom ();
+
+  if (bs.Y > sbi.dwSize.Y)
+    {
+      SetConsoleScreenBufferSize (hStdOut, bs);
+      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
+    }
+  else
+    {
+      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
+      SetConsoleScreenBufferSize (hStdOut, bs);
+    }
+
+  bs.X = m_bufferSize.width ();
+  sr.Left  = m_consoleRect.left ();
+  sr.Right = m_consoleRect.right ();
+
+  if (bs.X > sbi.dwSize.X)
+    {
+      SetConsoleScreenBufferSize (hStdOut, bs);
+      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
+    }
+  else
+    {
+      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
+      SetConsoleScreenBufferSize (hStdOut, bs);
+    }
+
+  log ("Sync'ing console parameters:\n");
+  log ("  buffer size: %d x %d\n", bs.X, bs.Y);
+  log ("  window: (%d, %d) -> (%d, %d)\n",
+       sr.Left, sr.Top, sr.Right, sr.Bottom);
+
+  if (m_buffer)
+    delete [] m_buffer;
+  if (m_tmpBuffer)
+    delete [] m_tmpBuffer;
+
+  int bufSize = m_consoleRect.width () * m_consoleRect.height ();
+
+  m_buffer = new CHAR_INFO[bufSize];
+  m_tmpBuffer = new CHAR_INFO[bufSize];
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::grabConsoleBuffer (CHAR_INFO* buf)
+{
+  COORD bs, bc;
+  SMALL_RECT r;
+
+  bs.X = m_consoleRect.width ();
+  bs.Y = m_consoleRect.height ();
+  bc.X = 0;
+  bc.Y = 0;
+
+  r.Left   = m_consoleRect.left ();
+  r.Top    = m_consoleRect.top ();
+  r.Right  = m_consoleRect.right ();
+  r.Bottom = m_consoleRect.bottom ();
+
+  if (! ReadConsoleOutput (m_stdOut, (buf ? buf : m_buffer), bs, bc, &r))
+    qCritical ("cannot read console output");
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::updateScrollBar (void)
+{
+  m_scrollBar->setMinimum (0);
+  if (m_bufferSize.height () > m_consoleRect.height ())
+    m_scrollBar->setMaximum (m_bufferSize.height () - m_consoleRect.height ());
+  else
+    m_scrollBar->setMaximum (0);
+  m_scrollBar->setSingleStep (1);
+  m_scrollBar->setPageStep (m_consoleRect.height ());
+  m_scrollBar->setValue (m_consoleRect.top ());
+
+  log ("Scrollbar parameters updated: %d/%d/%d/%d\n",
+       m_scrollBar->minimum (), m_scrollBar->maximum (),
+       m_scrollBar->singleStep (), m_scrollBar->pageStep ());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::setScrollValue (int value)
+{
+  if (value == m_consoleRect.top ())
+    return;
+
+  SMALL_RECT r;
+  HANDLE hStdOut = m_stdOut;
+
+  if (value + m_consoleRect.height () > m_bufferSize.height ())
+    value = m_bufferSize.height () - m_consoleRect.height ();
+
+  r.Left = m_consoleRect.left ();
+  r.Top = value;
+  r.Right = m_consoleRect.right ();
+  r.Bottom = value + m_consoleRect.height () - 1;
+
+  log ("Scrolling window: (%d, %d) -> (%d, %d) [%d x %d]\n",
+       r.Left, r.Top, r.Right, r.Bottom, 
+       r.Right - r.Left + 1, r.Bottom - r.Top + 1);
+
+  if (SetConsoleWindowInfo (hStdOut, TRUE, &r))
+    {
+      m_consoleRect.moveTop (value);
+      updateConsoleView ();
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::updateConsoleView (bool grab)
+{
+  if (grab)
+    grabConsoleBuffer ();
+  m_consoleView->update ();
+  m_consoleWatcher->start ();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::monitorConsole (void)
+{
+  CONSOLE_SCREEN_BUFFER_INFO sbi;
+  HANDLE hStdOut = GetStdHandle (STD_OUTPUT_HANDLE);
+
+  static wchar_t titleBuf[260];
+
+  GetConsoleTitleW (titleBuf, sizeof (titleBuf));
+  QString title = QString::fromWCharArray (titleBuf);
+
+  if (title != m_title)
+    {
+      q->setWindowTitle (title);
+      emit q->titleChanged (title);
+    }
+
+  if (GetConsoleScreenBufferInfo (hStdOut, &sbi))
+    {
+      if (m_bufferSize.width () != sbi.dwSize.X
+          || m_bufferSize.height () != sbi.dwSize.Y)
+        {
+          // Buffer size changed
+          m_bufferSize.rwidth () = sbi.dwSize.X;
+          m_bufferSize.rheight () = sbi.dwSize.Y;
+          updateScrollBar ();
+        }
+
+      if (m_cursorPos.x () != sbi.dwCursorPosition.X
+          || m_cursorPos.y () != sbi.dwCursorPosition.Y)
+        {
+          // Cursor position changed
+          m_consoleView->update
+            ((m_cursorPos.x () - sbi.srWindow.Left) * m_charSize.width (),
+             (m_cursorPos.y () - sbi.srWindow.Top) * m_charSize.height (),
+             m_charSize.width (), m_charSize.height ());
+          m_cursorPos.rx () = sbi.dwCursorPosition.X;
+          m_cursorPos.ry () = sbi.dwCursorPosition.Y;
+          m_consoleView->update
+            ((m_cursorPos.x () - sbi.srWindow.Left) * m_charSize.width (),
+             (m_cursorPos.y () - sbi.srWindow.Top) * m_charSize.height (),
+             m_charSize.width (), m_charSize.height ());
+        }
+
+      if (m_consoleRect.left () != sbi.srWindow.Left
+          || m_consoleRect.right () != sbi.srWindow.Right
+          || m_consoleRect.top () != sbi.srWindow.Top
+          || m_consoleRect.bottom () != sbi.srWindow.Bottom)
+        {
+          // Console window changed
+          m_consoleRect = QRect (sbi.srWindow.Left, sbi.srWindow.Top,
+                                 sbi.srWindow.Right - sbi.srWindow.Left + 1,
+                                 sbi.srWindow.Bottom - sbi.srWindow.Top + 1);
+          updateScrollBar ();
+          updateConsoleView ();
+          return;
+        }
+
+      if (m_tmpBuffer && m_buffer)
+        {
+          grabConsoleBuffer (m_tmpBuffer);
+          if (memcmp (m_tmpBuffer, m_buffer,
+                      sizeof (CHAR_INFO) * m_consoleRect.width () *
+                      m_consoleRect.height ()))
+            {
+              // FIXME: compute the area to update based on the
+              // difference between the 2 buffers.
+              qSwap (m_buffer, m_tmpBuffer);
+              updateConsoleView (false);
+            }
+        }
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::startCommand (void)
+{
+  if (! m_command.isEmpty ())
+    {
+      STARTUPINFO si;
+      PROCESS_INFORMATION pi;
+
+      ZeroMemory (&si, sizeof (si));
+      si.cb = sizeof (si);
+      ZeroMemory (&pi, sizeof (pi));
+
+      if (CreateProcessW (NULL,
+                          (LPWSTR)m_command.unicode (),
+                          NULL,
+                          NULL,
+                          TRUE,
+                          0,
+                          NULL,
+                          NULL,
+                          &si,
+                          &pi))
+        {
+          CloseHandle (pi.hThread);
+          m_process = pi.hProcess;
+          WaitForSingleObject (m_process, INFINITE);
+          CloseHandle (m_process);
+          m_process = NULL;
+        }
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsolePrivate::sendConsoleText (const QString& s)
+{
+  // Send the string in chunks of 512 characters. Each character is
+  // translated into an equivalent keypress event.
+
+#define TEXT_CHUNK_SIZE 512
+
+  int len = s.length ();
+  INPUT_RECORD events[TEXT_CHUNK_SIZE];
+  DWORD nEvents = 0, written;
+  HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE);
+
+  ZeroMemory (events, sizeof (events));
+
+  for (int i = 0; i < len; i++)
+    {
+      QChar c = s.at (i);
+
+      if (c == L'\r' || c == L'\n')
+        {
+          if (c == L'\r' && i < (len - 1) && s.at (i+1) == L'\n')
+            i++;
+          if (nEvents)
+            {
+              WriteConsoleInput (hStdIn, events, nEvents, &written);
+              nEvents = 0;
+              ZeroMemory (events, sizeof (events));
+            }
+          PostMessage (m_consoleWindow, WM_KEYDOWN, VK_RETURN, 0x001C0001);
+          PostMessage (m_consoleWindow, WM_KEYDOWN, VK_RETURN, 0xC01C0001);
+        }
+      else
+        {
+          events[nEvents].EventType                        = KEY_EVENT;
+          events[nEvents].Event.KeyEvent.bKeyDown          = TRUE;
+          events[nEvents].Event.KeyEvent.wRepeatCount      = 1;
+          events[nEvents].Event.KeyEvent.wVirtualKeyCode   =
+            LOBYTE (VkKeyScan (c.unicode ()));
+          events[nEvents].Event.KeyEvent.wVirtualScanCode  = 0;
+          events[nEvents].Event.KeyEvent.uChar.UnicodeChar = c.unicode ();
+          events[nEvents].Event.KeyEvent.dwControlKeyState = 0;
+          nEvents++;
+        }
+
+      if (nEvents == TEXT_CHUNK_SIZE
+          || (nEvents > 0 && i == (len - 1)))
+        {
+          WriteConsoleInput (hStdIn, events, nEvents, &written);
+          nEvents = 0;
+          ZeroMemory (events, sizeof (events));
+        }
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+QConsole::QConsole (QWidget* parent)
+    : d (new QConsolePrivate (this))
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+QConsole::QConsole (const QString& cmd, QWidget* parent)
+    : d (new QConsolePrivate (this, cmd))
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+QConsole::~QConsole (void)
+{
+  delete d;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::viewResizeEvent (QConsoleView*, QResizeEvent*)
+{
+  d->updateConsoleSize (true);
+  d->grabConsoleBuffer ();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::viewPaintEvent (QConsoleView* w, QPaintEvent* event)
+{
+  QPainter p (w);
+  int cw = d->m_charSize.width (), ch = d->m_charSize.height ();
+  int ascent, stride, cx1, cy1, cx2, cy2, x, y;
+  WORD attr = 0;
+  QString s;
+  bool hasChar = false;
+
+  QRect updateRect = event->rect ();
+
+  cx1 = updateRect.left () / cw;
+  cy1 = updateRect.top () / ch;
+  cx2 = qMin (d->m_consoleRect.width () - 1, updateRect.right () / cw);
+  cy2 = qMin (d->m_consoleRect.height () - 1, updateRect.bottom () / ch);
+
+  if (cx1 > d->m_consoleRect.width () - 1
+      || cy1 > d->m_consoleRect.height () - 1)
+    return;
+
+  p.setFont (d->m_font);
+  p.setPen (Qt::black);
+
+  ascent = p.fontMetrics ().ascent ();
+  stride = d->m_consoleRect.width ();
+
+  s.reserve (cx2 - cx1 + 1);
+  y = ascent + cy1 * ch;;
+
+  for (int j = cy1; j <= cy2; j++, y += ch)
+    {
+      // Reset string buffer and starting X coordinate
+      s.clear ();
+      hasChar = false;
+      x = cx1 * cw;
+
+      for (int i = cx1; i <= cx2; i++)
+        {
+          CHAR_INFO* ci = &(d->m_buffer[stride*j+i]);
+
+          if ((ci->Attributes & 0x00ff) != attr)
+            {
+              // Character attributes changed
+              if (! s.isEmpty ())
+                {
+                  // String buffer not empty -> draw it
+                  if (hasChar || (attr & 0x00f0))
+                    {
+                      if (attr & 0x00f0)
+                        p.fillRect (x, y-ascent, s.length () * cw, ch,
+                                    p.brush ());
+                      p.drawText (x, y, s);
+                    }
+                  x += (s.length () * cw);
+                  s.clear ();
+                  hasChar = false;
+                }
+              // Update current pen and store current attributes
+              // FIXME: what about background?
+              attr = (ci->Attributes & 0x00ff);
+              p.setPen (d->m_colors[attr & 0x000f]);
+              p.setBrush (d->m_colors[(attr >> 4) & 0x000f]);
+            }
+
+          // Append current character to the string buffer
+          s.append (ci->Char.UnicodeChar);
+          if (ci->Char.UnicodeChar != L' ')
+            hasChar = true;
+        }
+
+      if (! s.isEmpty () && (hasChar || (attr & 0x00f0)))
+        {
+          // Line end reached, but string buffer not empty -> draw it
+          // No need to update s or x, they will be reset on the next
+          // for-loop iteration
+          if (attr & 0x00f0)
+            p.fillRect (x, y-ascent, s.length () * cw, ch, p.brush ());
+          p.drawText (x, y, s);
+        }
+    }
+
+  // Draw cursor
+  p.setCompositionMode (QPainter::RasterOp_SourceXorDestination);
+  p.fillRect ((d->m_cursorPos.x () - d->m_consoleRect.x ()) * cw,
+              (d->m_cursorPos.y () - d->m_consoleRect.y ()) * ch,
+              cw, ch, d->m_colors[7]);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::wheelEvent (QWheelEvent* event)
+{
+  if (! d->m_inWheelEvent)
+    {
+      // Forward to the scrollbar (avoid recursion)
+      d->m_inWheelEvent = true;
+      QApplication::sendEvent (d->m_scrollBar, event);
+      d->m_inWheelEvent = false;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+bool QConsole::winEvent (MSG* msg, long* result)
+{
+  switch (msg->message)
+    {
+    case WM_KEYDOWN:
+    case WM_KEYUP:
+    //case WM_CHAR:
+      // Forward Win32 message to the console window
+      PostMessage (d->m_consoleWindow,
+                   msg->message,
+                   msg->wParam,
+                   msg->lParam);
+      result = 0;
+      return true;
+    default:
+      return false;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::scrollValueChanged (int value)
+{
+  d->setScrollValue (value);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::monitorConsole (void)
+{
+  d->monitorConsole ();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::focusInEvent (QFocusEvent* event)
+{
+  QWidget::focusInEvent (event);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::start (void)
+{
+  d->startCommand ();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void QConsole::sendText (const QString& s)
+{
+  d->sendConsoleText (s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/win32/QConsole.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,75 @@
+/*
+
+Copyright (C) 2011 Michael Goffioul.
+
+This file is part of QConsole.
+
+Foobar 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 3 of the License, or
+(at your option) any later version.
+
+QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef __QConsole_h__
+#define __QConsole_h__ 1
+
+#include <QWidget>
+
+class QFocusEvent;
+class QKeyEvent;
+class QPaintEvent;
+class QResizeEvent;
+class QWheelEvent;
+
+class QConsolePrivate;
+class QConsoleThread;
+class QConsoleView;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class QConsole : public QWidget
+{
+  Q_OBJECT
+  friend class QConsolePrivate;
+  friend class QConsoleThread;
+  friend class QConsoleView;
+
+public:
+  QConsole (QWidget* parent = 0);
+  QConsole (const QString& cmd, QWidget* parent = 0);
+  ~QConsole (void);
+
+  void sendText (const QString& s);
+
+signals:
+  void terminated (void);
+  void titleChanged (const QString&);
+
+protected:
+  void viewPaintEvent (QConsoleView*, QPaintEvent*);
+  void viewResizeEvent (QConsoleView*, QResizeEvent*);
+  void wheelEvent (QWheelEvent*);
+  void focusInEvent (QFocusEvent*);
+  bool winEvent (MSG*, long*);
+  virtual void start (void);
+
+private slots:
+  void scrollValueChanged (int value);
+  void monitorConsole (void);
+
+private:
+  QConsolePrivate* d;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // __QConsole_h__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/win32/QConsoleColors.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,48 @@
+/*
+
+Copyright (C) 2011 Michael Goffioul.
+
+This file is part of QConsole.
+
+Foobar 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 3 of the License, or
+(at your option) any later version.
+
+QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include "QConsoleColors.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+QConsoleColors::QConsoleColors (void)
+    : QMap<int, QColor> ()
+{
+  (*this)[0]  = Qt::black;
+  (*this)[1]  = Qt::darkBlue;
+  (*this)[2]  = Qt::darkGreen;
+  (*this)[3]  = Qt::darkCyan;
+  (*this)[4]  = Qt::darkRed;
+  (*this)[5]  = Qt::darkMagenta;
+  (*this)[6]  = Qt::darkYellow;
+  (*this)[7]  = Qt::lightGray;
+  (*this)[8]  = Qt::darkGray;
+  (*this)[9]  = Qt::blue;
+  (*this)[10] = Qt::green;
+  (*this)[11] = Qt::cyan;
+  (*this)[12] = Qt::red;
+  (*this)[13] = Qt::magenta;
+  (*this)[14] = Qt::yellow;
+  (*this)[15] = Qt::white;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/src/terminal/win32/QConsoleColors.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,38 @@
+/*
+
+Copyright (C) 2011 Michael Goffioul.
+
+This file is part of QConsole.
+
+Foobar 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 3 of the License, or
+(at your option) any later version.
+
+QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef __QConsoleColors_h__
+#define __QConsoleColors_h__ 1
+
+#include <QColor>
+#include <QMap>
+
+//////////////////////////////////////////////////////////////////////////////
+
+class QConsoleColors : public QMap<int, QColor>
+{
+public:
+  QConsoleColors (void);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // __QConsoleColors_h__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/start.sh	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,20 @@
+# Quint - A graphical user interface for Octave
+# Copyright (C) 2011 Jacob Dawid
+# jacob.dawid@googlemail.com
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+LANG=en_US.UTF-8
+cd bin
+./octave-gui
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/octave-gui/translators	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,8 @@
+# Below Octave GUI translators are listed with their e-mails
+# to be able inform them about generic translation file changes
+en-en Jacob Dawid <jacob.dawid@googlemail.com>
+es-es Valentin Ortega-Clavero <arcanos3030@gmail.com>
+de-de Jacob Dawid <jacob.dawid@googlemail.com>
+pt-br JĂșlio Hoffimann Mendes <julio.hoffimann@gmail.com>
+ru-ru Andriy Shinkarchuck <adriano32.gnu@gmail.com>
+uk-ua Andriy Shinkarchuck <adriano32.gnu@gmail.com>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/AUTHORS	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+e_k@users.sourceforge.net
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/COPYING	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  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) <year>  <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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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) year 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.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/CVS/Entries	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,9 @@
+/AUTHORS/1.1.1.1/Sat May 10 21:27:49 2008//
+/COPYING/1.1.1.1/Sat May 10 21:27:49 2008//
+/INSTALL/1.1.1.1/Sat May 10 21:27:49 2008//
+/TODO/1.2/Tue May 27 08:34:53 2008//
+/qtermwidget.pro/1.1.1.1/Sat May 10 21:27:49 2008//
+D/lib////
+D/src////
+/Changelog/1.1/Wed Jul 30 22:06:01 2008//
+/README/1.3/Wed Jul 30 22:01:01 2008//
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/CVS/Repository	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+qtermwidget
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/CVS/Root	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+:ext:e_k@qtermwidget.cvs.sourceforge.net:/cvsroot/qtermwidget
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/Changelog	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,19 @@
+31.07.2008
+Interface class from c-style conversions rewritten with pimpl support.
+
+
+16.07.2008 
+Added optional scrollbar 
+
+
+06.06.2008 
+Some artefacts were removed, some added...
+Also added support for color schemes, and 3 color schemes provided (classical - white on black, green on black, black on light yellow). Is it enough or not? 
+
+
+26.05.2008 
+Added file release as an archive with source code. But preferrable way is still getting code from CVS, cause file release can be outdated. 
+
+
+11.05.2008 
+Initial CVS import - first version comes with number 0.0.1
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/INSTALL	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,41 @@
+Requirements
+============
+Created with QT4.3.4
+Tested with QT4.3.2
+Maybe should work with other QT4 versions
+
+Basic Installation
+==================
+    
+    These are generic installation instructions.
+
+    There is no 'configure' shell script, `cause this package is just 
+a draft. And it intended for developers rather then for end-users.  
+There is a  'qtermwidget.pro'  file  provided instead. 
+This file is used for generating Makefiles in each appropriate 
+directory via 'qmake' program.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `qmake'.
+
+  2. Type `make' to compile the package.
+
+  3. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  
+
+  4. You can remove generated Makefiles form the directory 
+     by typing `make distclean'.  
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking. You can
+provide additional options by modifying the appropriate *.pro files
+according to qmake manual.
+
+Installation
+==================
+   Installation not defined yet.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/README	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,21 @@
+QTermWidget
+version 0.1.0
+
+QTermWidget is an opensource project based on KDE4 Konsole application.
+The main goal of this project is to provide unicode-enabled, embeddable
+QT widget for using as a built-in console (or terminal emulation widget).
+
+Of course I`m aware about embedding abilities of original Konsole,
+but once I had Qt without KDE, and it was a serious obstacle.
+I decided not to rely on a chance. I cannot find any interesting related project,
+so I had to write it.
+
+The original Konsole`s code was rewritten entirely with QT4 only; also I have to
+include in the project some parts of code from kde core library. All code dealing
+with user interface parts and session managers was removed (maybe later I bring it
+back somehow), and the result is quite useful, I suppose.
+
+This library was compiled and tested on three linux systems,
+based on 2.4.32, 2.6.20, 2.6.23 kernels, x86 and amd64.
+Please inform about its behaviour on other systems.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/TODO	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,10 @@
+Global
+ - provide more compatibility for vttest
+
+Package
+ - migrate to autotools if needed
+
+Source
+ - provide more options for customization
+ - clean unused code
+ - add some QT3 support features if needed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/BlockArray.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,337 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 2000 by Stephan Kulow <coolo@kde.org>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+
+*/
+
+// Own
+#include "BlockArray.h"
+
+#include <QtCore>
+
+// System
+#include <assert.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <unistd.h>
+#include <stdio.h>
+
+
+using namespace Konsole;
+
+static int blocksize = 0;
+
+BlockArray::BlockArray()
+    : size(0),
+      current(size_t(-1)),
+      index(size_t(-1)),
+      lastmap(0),
+      lastmap_index(size_t(-1)),
+      lastblock(0), ion(-1),
+      length(0)
+{
+    // lastmap_index = index = current = size_t(-1);
+    if (blocksize == 0)
+        blocksize = ((sizeof(Block) / getpagesize()) + 1) * getpagesize();
+
+}
+
+BlockArray::~BlockArray()
+{
+    setHistorySize(0);
+    assert(!lastblock);
+}
+
+size_t BlockArray::append(Block *block)
+{
+    if (!size)
+        return size_t(-1);
+
+    ++current;
+    if (current >= size) current = 0;
+
+    int rc;
+    rc = lseek(ion, current * blocksize, SEEK_SET); if (rc < 0) { perror("HistoryBuffer::add.seek"); setHistorySize(0); return size_t(-1); }
+    rc = write(ion, block, blocksize); if (rc < 0) { perror("HistoryBuffer::add.write"); setHistorySize(0); return size_t(-1); }
+
+    length++;
+    if (length > size) length = size;
+
+    ++index;
+
+    delete block;
+    return current;
+}
+
+size_t BlockArray::newBlock()
+{
+    if (!size)
+        return size_t(-1);
+    append(lastblock);
+
+    lastblock = new Block();
+    return index + 1;
+}
+
+Block *BlockArray::lastBlock() const
+{
+    return lastblock;
+}
+
+bool BlockArray::has(size_t i) const
+{
+    if (i == index + 1)
+        return true;
+
+    if (i > index)
+        return false;
+    if (index - i >= length)
+        return false;
+    return true;
+}
+
+const Block* BlockArray::at(size_t i)
+{
+    if (i == index + 1)
+        return lastblock;
+
+    if (i == lastmap_index)
+        return lastmap;
+
+    if (i > index) {
+        qDebug() << "BlockArray::at() i > index\n";
+        return 0;
+    }
+    
+//     if (index - i >= length) {
+//         kDebug(1211) << "BlockArray::at() index - i >= length\n";
+//         return 0;
+//     }
+
+    size_t j = i; // (current - (index - i) + (index/size+1)*size) % size ;
+
+    assert(j < size);
+    unmap();
+
+    Block *block = (Block*)mmap(0, blocksize, PROT_READ, MAP_PRIVATE, ion, j * blocksize);
+
+    if (block == (Block*)-1) { perror("mmap"); return 0; }
+
+    lastmap = block;
+    lastmap_index = i;
+
+    return block;
+}
+
+void BlockArray::unmap()
+{
+    if (lastmap) {
+        int res = munmap((char*)lastmap, blocksize);
+        if (res < 0) perror("munmap");
+    }
+    lastmap = 0;
+    lastmap_index = size_t(-1);
+}
+
+bool BlockArray::setSize(size_t newsize)
+{
+    return setHistorySize(newsize * 1024 / blocksize);
+}
+
+bool BlockArray::setHistorySize(size_t newsize)
+{
+//    kDebug(1211) << "setHistorySize " << size << " " << newsize;
+
+    if (size == newsize)
+        return false;
+
+    unmap();
+
+    if (!newsize) {
+        delete lastblock;
+        lastblock = 0;
+        if (ion >= 0) close(ion);
+        ion = -1;
+        current = size_t(-1);
+        return true;
+    }
+
+    if (!size) {
+        FILE* tmp = tmpfile();
+        if (!tmp) {
+            perror("konsole: cannot open temp file.\n");
+        } else {
+            ion = dup(fileno(tmp));
+            if (ion<0) {
+                perror("konsole: cannot dup temp file.\n");
+                fclose(tmp);
+            }
+        }
+        if (ion < 0)
+            return false;
+
+        assert(!lastblock);
+
+        lastblock = new Block();
+        size = newsize;
+        return false;
+    }
+
+    if (newsize > size) {
+        increaseBuffer();
+        size = newsize;
+        return false;
+    } else {
+        decreaseBuffer(newsize);
+        ftruncate(ion, length*blocksize);
+        size = newsize;
+
+        return true;
+    }
+}
+
+void moveBlock(FILE *fion, int cursor, int newpos, char *buffer2)
+{
+    int res = fseek(fion, cursor * blocksize, SEEK_SET);
+    if (res)
+        perror("fseek");
+    res = fread(buffer2, blocksize, 1, fion);
+    if (res != 1)
+        perror("fread");
+
+    res = fseek(fion, newpos * blocksize, SEEK_SET);
+    if (res)
+        perror("fseek");
+    res = fwrite(buffer2, blocksize, 1, fion);
+    if (res != 1)
+        perror("fwrite");
+    //    printf("moving block %d to %d\n", cursor, newpos);
+}
+
+void BlockArray::decreaseBuffer(size_t newsize)
+{
+    if (index < newsize) // still fits in whole
+        return;
+
+    int offset = (current - (newsize - 1) + size) % size;
+
+    if (!offset)
+        return;
+
+    // The Block constructor could do somthing in future...
+    char *buffer1 = new char[blocksize];
+
+    FILE *fion = fdopen(dup(ion), "w+b");
+    if (!fion) {
+        delete [] buffer1;
+        perror("fdopen/dup");
+        return;
+    }
+
+    int firstblock;
+    if (current <= newsize) {
+        firstblock = current + 1;
+    } else {
+        firstblock = 0;
+    }
+
+    size_t oldpos;
+    for (size_t i = 0, cursor=firstblock; i < newsize; i++) {
+        oldpos = (size + cursor + offset) % size;
+        moveBlock(fion, oldpos, cursor, buffer1);
+        if (oldpos < newsize) {
+            cursor = oldpos;
+        } else
+            cursor++;
+    }
+
+    current = newsize - 1;
+    length = newsize;
+
+    delete [] buffer1;
+
+    fclose(fion);
+
+}
+
+void BlockArray::increaseBuffer()
+{
+    if (index < size) // not even wrapped once
+        return;
+
+    int offset = (current + size + 1) % size;
+    if (!offset) // no moving needed
+        return;
+
+    // The Block constructor could do somthing in future...
+    char *buffer1 = new char[blocksize];
+    char *buffer2 = new char[blocksize];
+
+    int runs = 1;
+    int bpr = size; // blocks per run
+
+    if (size % offset == 0) {
+        bpr = size / offset;
+        runs = offset;
+    }
+
+    FILE *fion = fdopen(dup(ion), "w+b");
+    if (!fion) {
+        perror("fdopen/dup");
+	delete [] buffer1;
+	delete [] buffer2;
+        return;
+    }
+
+    int res;
+    for (int i = 0; i < runs; i++)
+    {
+        // free one block in chain
+        int firstblock = (offset + i) % size;
+        res = fseek(fion, firstblock * blocksize, SEEK_SET);
+        if (res)
+            perror("fseek");
+        res = fread(buffer1, blocksize, 1, fion);
+        if (res != 1)
+            perror("fread");
+        int newpos = 0;
+        for (int j = 1, cursor=firstblock; j < bpr; j++)
+        {
+            cursor = (cursor + offset) % size;
+            newpos = (cursor - offset + size) % size;
+            moveBlock(fion, cursor, newpos, buffer2);
+        }
+        res = fseek(fion, i * blocksize, SEEK_SET);
+        if (res)
+            perror("fseek");
+        res = fwrite(buffer1, blocksize, 1, fion);
+        if (res != 1)
+            perror("fwrite");
+    }
+    current = size - 1;
+    length = size;
+
+    delete [] buffer1;
+    delete [] buffer2;
+
+    fclose(fion);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/BlockArray.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,125 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 2000 by Stephan Kulow <coolo@kde.org>
+   
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 BLOCKARRAY_H
+#define BLOCKARRAY_H
+
+#include <unistd.h>
+
+//#error Do not use in KDE 2.1
+
+#define BlockSize (1 << 12)
+#define ENTRIES   ((BlockSize - sizeof(size_t) ) / sizeof(unsigned char))
+
+namespace Konsole
+{
+
+struct Block {
+    Block() { size = 0; }
+    unsigned char data[ENTRIES];
+    size_t size;
+};
+
+// ///////////////////////////////////////////////////////
+
+class BlockArray {
+public:
+    /**
+    * Creates a history file for holding
+    * maximal size blocks. If more blocks
+    * are requested, then it drops earlier
+    * added ones.
+    */
+    BlockArray();
+
+    /// destructor
+    ~BlockArray();
+
+    /**
+    * adds the Block at the end of history.
+    * This may drop other blocks.
+    *
+    * The ownership on the block is transfered.
+    * An unique index number is returned for accessing
+    * it later (if not yet dropped then)
+    *
+    * Note, that the block may be dropped completely
+    * if history is turned off.
+    */
+    size_t append(Block *block);
+
+    /**
+    * gets the block at the index. Function may return
+    * 0 if the block isn't available any more.
+    *
+    * The returned block is strictly readonly as only
+    * maped in memory - and will be invalid on the next
+    * operation on this class.
+    */
+    const Block *at(size_t index);
+
+    /**
+    * reorders blocks as needed. If newsize is null,
+    * the history is emptied completely. The indices
+    * returned on append won't change their semantic,
+    * but they may not be valid after this call.
+    */
+    bool setHistorySize(size_t newsize);
+
+    size_t newBlock();
+
+    Block *lastBlock() const;
+
+    /**
+    * Convenient function to set the size in KBytes
+    * instead of blocks
+    */
+    bool setSize(size_t newsize);
+
+    size_t len() const { return length; }
+
+    bool has(size_t index) const;
+
+    size_t getCurrent() const { return current; }
+
+private:
+    void unmap();
+    void increaseBuffer();
+    void decreaseBuffer(size_t newsize);
+
+    size_t size;
+    // current always shows to the last inserted block
+    size_t current;
+    size_t index;
+
+    Block *lastmap;
+    size_t lastmap_index;
+    Block *lastblock;
+
+    int ion;
+    size_t length;
+
+};
+
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/CVS/Entries	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,48 @@
+/BlockArray.cpp/1.2/Wed May 14 19:36:48 2008//
+/BlockArray.h/1.2/Wed May 14 19:36:48 2008//
+/Character.h/1.2/Wed May 14 19:36:48 2008//
+/CharacterColor.h/1.2/Wed May 14 19:36:49 2008//
+/DefaultTranslatorText.h/1.1.1.1/Sat May 10 21:27:57 2008//
+/Emulation.cpp/1.2/Wed May 14 19:36:49 2008//
+/Emulation.h/1.2/Wed May 14 19:36:49 2008//
+/ExtendedDefaultTranslator.h/1.1.1.1/Sat May 10 21:27:52 2008//
+/Filter.cpp/1.2/Wed May 14 19:36:50 2008//
+/Filter.h/1.2/Wed May 14 19:36:50 2008//
+/History.cpp/1.2/Wed May 14 19:36:50 2008//
+/History.h/1.2/Wed May 14 19:36:50 2008//
+/KeyboardTranslator.cpp/1.2/Wed May 14 19:36:50 2008//
+/KeyboardTranslator.h/1.2/Wed May 14 19:36:50 2008//
+/LineFont.h/1.1.1.1/Sat May 10 21:27:49 2008//
+/LineFont.src/1.1.1.1/Sat May 10 21:27:52 2008//
+/Pty.cpp/1.2/Wed May 14 19:36:50 2008//
+/Pty.h/1.2/Wed May 14 19:36:51 2008//
+/README/1.1.1.1/Sat May 10 21:27:52 2008//
+/Screen.cpp/1.2/Wed May 14 19:36:51 2008//
+/Screen.h/1.2/Wed May 14 19:36:51 2008//
+/ScreenWindow.cpp/1.2/Wed May 14 19:36:52 2008//
+/ScreenWindow.h/1.2/Wed May 14 19:36:52 2008//
+/Session.cpp/1.2/Wed May 14 19:36:52 2008//
+/Session.h/1.2/Wed May 14 19:36:52 2008//
+/ShellCommand.cpp/1.3/Fri May 23 12:30:35 2008//
+/ShellCommand.h/1.2/Wed May 14 19:36:53 2008//
+/TerminalCharacterDecoder.cpp/1.2/Wed May 14 19:36:53 2008//
+/TerminalCharacterDecoder.h/1.2/Wed May 14 19:36:53 2008//
+/Vt102Emulation.cpp/1.2/Wed May 14 19:36:53 2008//
+/Vt102Emulation.h/1.2/Wed May 14 19:36:53 2008//
+/default.keytab/1.1.1.1/Sat May 10 21:27:55 2008//
+/k3process.cpp/1.2/Wed May 14 19:36:53 2008//
+/k3process.h/1.2/Wed May 14 19:36:53 2008//
+/k3processcontroller.cpp/1.2/Wed May 14 19:36:54 2008//
+/k3processcontroller.h/1.2/Wed May 14 19:36:54 2008//
+/konsole_wcwidth.cpp/1.1.1.1/Sat May 10 21:27:51 2008//
+/konsole_wcwidth.h/1.2/Wed May 14 19:36:54 2008//
+/kpty.cpp/1.2/Wed May 14 19:36:54 2008//
+/kpty.h/1.2/Wed May 14 19:36:54 2008//
+/kpty_p.h/1.2/Wed May 14 19:36:54 2008//
+D/kb-layouts////
+/ColorTables.h/1.2/Sat Jun  7 20:13:53 2008//
+/TerminalDisplay.cpp/1.4/Sat Jun  7 20:13:54 2008//
+/TerminalDisplay.h/1.3/Sat Jun  7 20:13:54 2008//
+/lib.pro/1.2/Wed Jul 30 22:00:49 2008//
+/qtermwidget.cpp/1.7/Wed Jul 30 21:31:25 2008//
+/qtermwidget.h/1.7/Wed Jul 30 21:48:51 2008//
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/CVS/Repository	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+qtermwidget/lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/CVS/Root	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+:ext:e_k@qtermwidget.cvs.sourceforge.net:/cvsroot/qtermwidget
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Character.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,210 @@
+/*
+    This file is part of Konsole, KDE's terminal.
+    
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 CHARACTER_H
+#define CHARACTER_H
+
+// Qt
+#include <QtCore/QHash>
+
+// Local
+#include "CharacterColor.h"
+
+namespace Konsole
+{
+
+typedef unsigned char LineProperty;
+
+static const int LINE_DEFAULT		= 0;
+static const int LINE_WRAPPED 	 	= (1 << 0);
+static const int LINE_DOUBLEWIDTH  	= (1 << 1);
+static const int LINE_DOUBLEHEIGHT	= (1 << 2);
+
+#define DEFAULT_RENDITION  0
+#define RE_BOLD            (1 << 0)
+#define RE_BLINK           (1 << 1)
+#define RE_UNDERLINE       (1 << 2)
+#define RE_REVERSE         (1 << 3) // Screen only
+#define RE_INTENSIVE       (1 << 3) // Widget only
+#define RE_CURSOR          (1 << 4)
+#define RE_EXTENDED_CHAR   (1 << 5)
+
+/**
+ * A single character in the terminal which consists of a unicode character
+ * value, foreground and background colors and a set of rendition attributes
+ * which specify how it should be drawn.
+ */
+class Character
+{
+public:
+  /** 
+   * Constructs a new character.
+   *
+   * @param _c The unicode character value of this character.
+   * @param _f The foreground color used to draw the character.
+   * @param _b The color used to draw the character's background.
+   * @param _r A set of rendition flags which specify how this character is to be drawn.
+   */
+  inline Character(quint16 _c = ' ',
+            CharacterColor  _f = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR),
+            CharacterColor  _b = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR),
+            quint8  _r = DEFAULT_RENDITION)
+       : character(_c), rendition(_r), foregroundColor(_f), backgroundColor(_b) {}
+
+  union
+  {
+    /** The unicode character value for this character. */
+    quint16 character;
+    /** 
+     * Experimental addition which allows a single Character instance to contain more than
+     * one unicode character.
+     *
+     * charSequence is a hash code which can be used to look up the unicode
+     * character sequence in the ExtendedCharTable used to create the sequence.
+     */
+    quint16 charSequence; 
+  };
+
+  /** A combination of RENDITION flags which specify options for drawing the character. */
+  quint8  rendition;
+
+  /** The foreground color used to draw this character. */
+  CharacterColor  foregroundColor; 
+  /** The color used to draw this character's background. */
+  CharacterColor  backgroundColor;
+
+  /** 
+   * Returns true if this character has a transparent background when
+   * it is drawn with the specified @p palette.
+   */
+  bool   isTransparent(const ColorEntry* palette) const;
+  /**
+   * Returns true if this character should always be drawn in bold when
+   * it is drawn with the specified @p palette, independent of whether
+   * or not the character has the RE_BOLD rendition flag. 
+   */
+  bool   isBold(const ColorEntry* base) const;
+  
+  /** 
+   * Compares two characters and returns true if they have the same unicode character value,
+   * rendition and colors.
+   */
+  friend bool operator == (const Character& a, const Character& b);
+  /**
+   * Compares two characters and returns true if they have different unicode character values,
+   * renditions or colors.
+   */
+  friend bool operator != (const Character& a, const Character& b);
+};
+
+inline bool operator == (const Character& a, const Character& b)
+{ 
+  return a.character == b.character && 
+         a.rendition == b.rendition && 
+         a.foregroundColor == b.foregroundColor && 
+         a.backgroundColor == b.backgroundColor;
+}
+
+inline bool operator != (const Character& a, const Character& b)
+{
+  return    a.character != b.character || 
+            a.rendition != b.rendition || 
+            a.foregroundColor != b.foregroundColor || 
+            a.backgroundColor != b.backgroundColor;
+}
+
+inline bool Character::isTransparent(const ColorEntry* base) const
+{
+  return ((backgroundColor._colorSpace == COLOR_SPACE_DEFAULT) && 
+          base[backgroundColor._u+0+(backgroundColor._v?BASE_COLORS:0)].transparent)
+      || ((backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) && 
+          base[backgroundColor._u+2+(backgroundColor._v?BASE_COLORS:0)].transparent);
+}
+
+inline bool Character::isBold(const ColorEntry* base) const
+{
+  return ((backgroundColor._colorSpace == COLOR_SPACE_DEFAULT) &&
+            base[backgroundColor._u+0+(backgroundColor._v?BASE_COLORS:0)].bold)
+      || ((backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) &&
+            base[backgroundColor._u+2+(backgroundColor._v?BASE_COLORS:0)].bold);
+}
+
+extern unsigned short vt100_graphics[32];
+
+
+/**
+ * A table which stores sequences of unicode characters, referenced
+ * by hash keys.  The hash key itself is the same size as a unicode
+ * character ( ushort ) so that it can occupy the same space in
+ * a structure.
+ */
+class ExtendedCharTable
+{
+public:
+    /** Constructs a new character table. */
+    ExtendedCharTable();
+    ~ExtendedCharTable();
+
+    /**
+     * Adds a sequences of unicode characters to the table and returns
+     * a hash code which can be used later to look up the sequence
+     * using lookupExtendedChar()
+     *
+     * If the same sequence already exists in the table, the hash
+     * of the existing sequence will be returned.
+     *
+     * @param unicodePoints An array of unicode character points
+     * @param length Length of @p unicodePoints
+     */
+    ushort createExtendedChar(ushort* unicodePoints , ushort length);
+    /**
+     * Looks up and returns a pointer to a sequence of unicode characters
+     * which was added to the table using createExtendedChar().
+     *
+     * @param hash The hash key returned by createExtendedChar()
+     * @param length This variable is set to the length of the 
+     * character sequence.
+     *
+     * @return A unicode character sequence of size @p length.
+     */
+    ushort* lookupExtendedChar(ushort hash , ushort& length) const;
+
+    /** The global ExtendedCharTable instance. */
+    static ExtendedCharTable instance;
+private:
+    // calculates the hash key of a sequence of unicode points of size 'length'
+    ushort extendedCharHash(ushort* unicodePoints , ushort length) const;
+    // tests whether the entry in the table specified by 'hash' matches the 
+    // character sequence 'unicodePoints' of size 'length'
+    bool extendedCharMatch(ushort hash , ushort* unicodePoints , ushort length) const;
+    // internal, maps hash keys to character sequence buffers.  The first ushort
+    // in each value is the length of the buffer, followed by the ushorts in the buffer
+    // themselves.
+    QHash<ushort,ushort*> extendedCharTable;
+};
+
+}
+
+#endif // CHARACTER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/CharacterColor.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,301 @@
+/*
+    This file is part of Konsole, KDE's terminal.
+    
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 CHARACTERCOLOR_H
+#define CHARACTERCOLOR_H
+
+// Qt
+#include <QtGui/QColor>
+
+namespace Konsole
+{
+
+/** 
+ * An entry in a terminal display's color palette. 
+ *
+ * A color palette is an array of 16 ColorEntry instances which map
+ * system color indexes (from 0 to 15) into actual colors.
+ *
+ * Each entry can be set as bold, in which case any text
+ * drawn using the color should be drawn in bold.  
+ *
+ * Each entry can also be transparent, in which case the terminal
+ * display should avoid drawing the background for any characters
+ * using the entry as a background.
+ */
+class ColorEntry
+{
+public:
+  /** 
+   * Constructs a new color palette entry.
+   *
+   * @param c The color value for this entry.
+   * @param tr Specifies that the color should be transparent when used as a background color.
+   * @param b Specifies that text drawn with this color should be bold.
+   */
+  ColorEntry(QColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {}
+
+  /**
+   * Constructs a new color palette entry with an undefined color, and
+   * with the transparent and bold flags set to false.
+   */ 
+  ColorEntry() : transparent(false), bold(false) {} 
+ 
+  /**
+   * Sets the color, transparency and boldness of this color to those of @p rhs.
+   */ 
+  void operator=(const ColorEntry& rhs) 
+  { 
+       color = rhs.color; 
+       transparent = rhs.transparent; 
+       bold = rhs.bold; 
+  }
+
+  /** The color value of this entry for display. */
+  QColor color;
+
+  /** 
+   * If true character backgrounds using this color should be transparent. 
+   * This is not applicable when the color is used to render text.
+   */
+  bool   transparent;
+  /**
+   * If true characters drawn using this color should be bold.
+   * This is not applicable when the color is used to draw a character's background.
+   */
+  bool   bold;        
+};
+
+
+// Attributed Character Representations ///////////////////////////////
+
+// Colors
+
+#define BASE_COLORS   (2+8)
+#define INTENSITIES   2
+#define TABLE_COLORS  (INTENSITIES*BASE_COLORS)
+
+#define DEFAULT_FORE_COLOR 0
+#define DEFAULT_BACK_COLOR 1
+
+//a standard set of colors using black text on a white background.
+//defined in TerminalDisplay.cpp
+
+static const ColorEntry base_color_table[TABLE_COLORS] =
+// The following are almost IBM standard color codes, with some slight
+// gamma correction for the dim colors to compensate for bright X screens.
+// It contains the 8 ansiterm/xterm colors in 2 intensities.
+{
+  // Fixme: could add faint colors here, also.
+  // normal
+  ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
+  ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
+  ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
+  ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
+  ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
+  // intensiv
+  ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
+  ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
+  ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
+  ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0xFF), 0, 0 ),
+  ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
+};
+
+/* CharacterColor is a union of the various color spaces.
+
+   Assignment is as follows:
+
+   Type  - Space        - Values
+
+   0     - Undefined   - u:  0,      v:0        w:0
+   1     - Default     - u:  0..1    v:intense  w:0
+   2     - System      - u:  0..7    v:intense  w:0
+   3     - Index(256)  - u: 16..255  v:0        w:0
+   4     - RGB         - u:  0..255  v:0..256   w:0..256
+
+   Default colour space has two separate colours, namely
+   default foreground and default background colour.
+*/
+
+#define COLOR_SPACE_UNDEFINED   0
+#define COLOR_SPACE_DEFAULT     1
+#define COLOR_SPACE_SYSTEM      2
+#define COLOR_SPACE_256         3
+#define COLOR_SPACE_RGB         4
+
+/**
+ * Describes the color of a single character in the terminal.
+ */
+class CharacterColor
+{
+    friend class Character;
+
+public:
+  /** Constructs a new CharacterColor whoose color and color space are undefined. */
+  CharacterColor() 
+      : _colorSpace(COLOR_SPACE_UNDEFINED), 
+        _u(0), 
+        _v(0), 
+        _w(0) 
+  {}
+
+  /** 
+   * Constructs a new CharacterColor using the specified @p colorSpace and with 
+   * color value @p co
+   *
+   * The meaning of @p co depends on the @p colorSpace used.
+   *
+   * TODO : Document how @p co relates to @p colorSpace
+   *
+   * TODO : Add documentation about available color spaces.
+   */
+  CharacterColor(quint8 colorSpace, int co) 
+      : _colorSpace(colorSpace), 
+        _u(0), 
+        _v(0), 
+        _w(0)
+  {
+    switch (colorSpace)
+    {
+        case COLOR_SPACE_DEFAULT:
+            _u = co & 1;
+            break;
+        case COLOR_SPACE_SYSTEM:
+            _u = co & 7;
+            _v = (co >> 3) & 1;
+            break;
+        case COLOR_SPACE_256:  
+            _u = co & 255;
+            break;
+        case COLOR_SPACE_RGB:
+            _u = co >> 16;
+            _v = co >> 8;
+            _w = co;
+            break;
+        default:
+            _colorSpace = COLOR_SPACE_UNDEFINED;
+    }
+  }
+
+  /** 
+   * Returns true if this character color entry is valid.
+   */
+  bool isValid() 
+  {
+        return _colorSpace != COLOR_SPACE_UNDEFINED;
+  }
+    
+  /** 
+   * Toggles the value of this color between a normal system color and the corresponding intensive
+   * system color.
+   * 
+   * This is only applicable if the color is using the COLOR_SPACE_DEFAULT or COLOR_SPACE_SYSTEM
+   * color spaces.
+   */
+  void toggleIntensive();
+
+  /** 
+   * Returns the color within the specified color @palette
+   *
+   * The @p palette is only used if this color is one of the 16 system colors, otherwise
+   * it is ignored.
+   */
+  QColor color(const ColorEntry* palette) const;
+ 
+  /** 
+   * Compares two colors and returns true if they represent the same color value and
+   * use the same color space.
+   */
+  friend bool operator == (const CharacterColor& a, const CharacterColor& b);
+  /**
+   * Compares two colors and returns true if they represent different color values
+   * or use different color spaces.
+   */
+  friend bool operator != (const CharacterColor& a, const CharacterColor& b);
+
+private:
+  quint8 _colorSpace;
+
+  // bytes storing the character color 
+  quint8 _u; 
+  quint8 _v; 
+  quint8 _w; 
+};
+
+inline bool operator == (const CharacterColor& a, const CharacterColor& b)
+{ 
+  return *reinterpret_cast<const quint32*>(&a._colorSpace) == 
+         *reinterpret_cast<const quint32*>(&b._colorSpace);
+}
+
+inline bool operator != (const CharacterColor& a, const CharacterColor& b)
+{
+  return *reinterpret_cast<const quint32*>(&a._colorSpace) != 
+         *reinterpret_cast<const quint32*>(&b._colorSpace);
+}
+
+inline const QColor color256(quint8 u, const ColorEntry* base)
+{
+  //   0.. 16: system colors
+  if (u <   8) return base[u+2            ].color; u -= 8;
+  if (u <   8) return base[u+2+BASE_COLORS].color; u -= 8;
+
+  //  16..231: 6x6x6 rgb color cube
+  if (u < 216) return QColor(255*((u/36)%6)/5,
+                             255*((u/ 6)%6)/5,
+                             255*((u/ 1)%6)/5); u -= 216;
+  
+  // 232..255: gray, leaving out black and white
+  int gray = u*10+8; return QColor(gray,gray,gray);
+}
+
+inline QColor CharacterColor::color(const ColorEntry* base) const
+{
+  switch (_colorSpace)
+  {
+    case COLOR_SPACE_DEFAULT: return base[_u+0+(_v?BASE_COLORS:0)].color;
+    case COLOR_SPACE_SYSTEM: return base[_u+2+(_v?BASE_COLORS:0)].color;
+    case COLOR_SPACE_256: return color256(_u,base);
+    case COLOR_SPACE_RGB: return QColor(_u,_v,_w);
+    case COLOR_SPACE_UNDEFINED: return QColor();
+  }
+
+  Q_ASSERT(false); // invalid color space
+
+  return QColor();
+}
+
+inline void CharacterColor::toggleIntensive()
+{
+  if (_colorSpace == COLOR_SPACE_SYSTEM || _colorSpace == COLOR_SPACE_DEFAULT)
+  {
+    _v = !_v;
+  }
+}
+
+
+}
+
+#endif // CHARACTERCOLOR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/ColorTables.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,58 @@
+#ifndef _COLOR_TABLE_H
+#define _COLOR_TABLE_H
+
+#include "CharacterColor.h"
+
+using namespace Konsole;
+
+static const ColorEntry whiteonblack_color_table[TABLE_COLORS] =
+{
+    // normal
+    ColorEntry(QColor(0xFF,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0x00,0x00,0x00), 1, 0 ), // Dfore, Dback
+    ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
+    ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
+    ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
+    ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
+    // intensiv
+    ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
+    ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
+    ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
+    ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0xFF), 0, 0 ),
+    ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
+};
+
+static const ColorEntry greenonblack_color_table[TABLE_COLORS] =
+{
+    ColorEntry(QColor(    24, 240,  24),  0, 0), ColorEntry(QColor(     0,   0,   0),  1, 0),  
+    ColorEntry(QColor(     0,   0,   0),  0, 0), ColorEntry(QColor(   178,  24,  24),  0, 0), 
+    ColorEntry(QColor(    24, 178,  24),  0, 0), ColorEntry(QColor(   178, 104,  24),  0, 0), 
+    ColorEntry(QColor(    24,  24, 178),  0, 0), ColorEntry(QColor(   178,  24, 178),  0, 0), 
+    ColorEntry(QColor(    24, 178, 178),  0, 0), ColorEntry(QColor(   178, 178, 178),  0, 0), 
+    // intensive colors
+    ColorEntry(QColor(   24, 240,  24),  0, 1 ), ColorEntry(QColor(    0,   0,   0),  1, 0 ),
+    ColorEntry(QColor(  104, 104, 104),  0, 0 ), ColorEntry(QColor(  255,  84,  84),  0, 0 ),
+    ColorEntry(QColor(   84, 255,  84),  0, 0 ), ColorEntry(QColor(  255, 255,  84),  0, 0 ),
+    ColorEntry(QColor(   84,  84, 255),  0, 0 ), ColorEntry(QColor(  255,  84, 255),  0, 0 ),
+    ColorEntry(QColor(   84, 255, 255),  0, 0 ), ColorEntry(QColor(  255, 255, 255),  0, 0 )
+};
+
+static const ColorEntry blackonlightyellow_color_table[TABLE_COLORS] = 
+{
+    ColorEntry(QColor(  0,   0,   0),  0, 0),  ColorEntry(QColor( 255, 255, 221),  1, 0),  
+    ColorEntry(QColor(  0,   0,   0),  0, 0),  ColorEntry(QColor( 178,  24,  24),  0, 0),  
+    ColorEntry(QColor( 24, 178,  24),  0, 0),  ColorEntry(QColor( 178, 104,  24),  0, 0),  
+    ColorEntry(QColor( 24,  24, 178),  0, 0),  ColorEntry(QColor( 178,  24, 178),  0, 0),  
+    ColorEntry(QColor( 24, 178, 178),  0, 0),  ColorEntry(QColor( 178, 178, 178),  0, 0),  
+    ColorEntry(QColor(  0,   0,   0),  0, 1),  ColorEntry(QColor( 255, 255, 221),  1, 0),  
+    ColorEntry(QColor(104, 104, 104),  0, 0),  ColorEntry(QColor( 255,  84,  84),  0, 0),  
+    ColorEntry(QColor( 84, 255,  84),  0, 0),  ColorEntry(QColor( 255, 255,  84),  0, 0),  
+    ColorEntry(QColor( 84,  84, 255),  0, 0),  ColorEntry(QColor( 255,  84, 255),  0, 0),  
+    ColorEntry(QColor( 84, 255, 255),  0, 0),  ColorEntry(QColor( 255, 255, 255),  0, 0)
+};
+ 			  
+			  
+			  
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/DefaultTranslatorText.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,2 @@
+"keyboard \"Fallback Key Translator\"\n"
+"key Tab : \"\\t\" \0"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Emulation.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,543 @@
+/*
+    This file is part of Konsole, an X terminal.
+
+    Copyright (C) 2007 Robert Knight <robertknight@gmail.com> 
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+    Copyright (C) 1996 by Matthias Ettrich <ettrich@kde.org>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "Emulation.h"
+
+// System
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+// Qt
+#include <QtGui/QApplication>
+#include <QtGui/QClipboard>
+#include <QtCore/QHash>
+#include <QtGui/QKeyEvent>
+#include <QtCore/QRegExp>
+#include <QtCore/QTextStream>
+#include <QtCore/QThread>
+
+#include <QtCore/QTime>
+
+// Konsole
+#include "KeyboardTranslator.h"
+#include "Screen.h"
+#include "TerminalCharacterDecoder.h"
+#include "ScreenWindow.h"
+
+using namespace Konsole;
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                               Emulation                                  */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+//#define CNTL(c) ((c)-'@')
+
+/*!
+*/
+
+Emulation::Emulation() :
+  _currentScreen(0),
+  _codec(0),
+  _decoder(0),
+  _keyTranslator(0),
+  _usesMouse(false)
+{
+
+  // create screens with a default size
+  _screen[0] = new Screen(40,80);
+  _screen[1] = new Screen(40,80);
+  _currentScreen = _screen[0];
+
+  QObject::connect(&_bulkTimer1, SIGNAL(timeout()), this, SLOT(showBulk()) );
+  QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk()) );
+   
+  // listen for mouse status changes
+  connect( this , SIGNAL(programUsesMouseChanged(bool)) , 
+           SLOT(usesMouseChanged(bool)) );
+}
+
+bool Emulation::programUsesMouse() const
+{
+    return _usesMouse;
+}
+
+void Emulation::usesMouseChanged(bool usesMouse)
+{
+    _usesMouse = usesMouse;
+}
+
+ScreenWindow* Emulation::createWindow()
+{
+    ScreenWindow* window = new ScreenWindow();
+    window->setScreen(_currentScreen);
+    _windows << window;
+
+    connect(window , SIGNAL(selectionChanged()),
+            this , SLOT(bufferedUpdate()));
+
+    connect(this , SIGNAL(outputChanged()),
+            window , SLOT(notifyOutputChanged()) );
+    return window;
+}
+
+/*!
+*/
+
+Emulation::~Emulation()
+{
+  QListIterator<ScreenWindow*> windowIter(_windows);
+
+  while (windowIter.hasNext())
+  {
+    delete windowIter.next();
+  }
+
+  delete _screen[0];
+  delete _screen[1];
+  delete _decoder;
+}
+
+/*! change between primary and alternate _screen
+*/
+
+void Emulation::setScreen(int n)
+{
+  Screen *old = _currentScreen;
+  _currentScreen = _screen[n&1];
+  if (_currentScreen != old) 
+  {
+     old->setBusySelecting(false);
+
+     // tell all windows onto this emulation to switch to the newly active _screen
+     QListIterator<ScreenWindow*> windowIter(_windows);
+     while ( windowIter.hasNext() )
+     {
+         windowIter.next()->setScreen(_currentScreen);
+     }
+  }
+}
+
+void Emulation::clearHistory()
+{
+    _screen[0]->setScroll( _screen[0]->getScroll() , false );
+}
+void Emulation::setHistory(const HistoryType& t)
+{
+  _screen[0]->setScroll(t);
+
+  showBulk();
+}
+
+const HistoryType& Emulation::history()
+{
+  return _screen[0]->getScroll();
+}
+
+void Emulation::setCodec(const QTextCodec * qtc)
+{
+  Q_ASSERT( qtc );
+
+  _codec = qtc;
+  delete _decoder;
+  _decoder = _codec->makeDecoder();
+
+  emit useUtf8Request(utf8());
+}
+
+void Emulation::setCodec(EmulationCodec codec)
+{
+    if ( codec == Utf8Codec )
+        setCodec( QTextCodec::codecForName("utf8") );
+    else if ( codec == LocaleCodec )
+        setCodec( QTextCodec::codecForLocale() );
+}
+
+void Emulation::setKeyBindings(const QString& name)
+{
+  _keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name);
+}
+
+QString Emulation::keyBindings()
+{
+  return _keyTranslator->name();
+}
+
+
+// Interpreting Codes ---------------------------------------------------------
+
+/*
+   This section deals with decoding the incoming character stream.
+   Decoding means here, that the stream is first separated into `tokens'
+   which are then mapped to a `meaning' provided as operations by the
+   `Screen' class.
+*/
+
+/*!
+*/
+
+void Emulation::receiveChar(int c)
+// process application unicode input to terminal
+// this is a trivial scanner
+{
+  c &= 0xff;
+  switch (c)
+  {
+    case '\b'      : _currentScreen->BackSpace();                 break;
+    case '\t'      : _currentScreen->Tabulate();                  break;
+    case '\n'      : _currentScreen->NewLine();                   break;
+    case '\r'      : _currentScreen->Return();                    break;
+    case 0x07      : emit stateSet(NOTIFYBELL);
+                     break;
+    default        : _currentScreen->ShowCharacter(c);            break;
+  };
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                             Keyboard Handling                             */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/*!
+*/
+
+void Emulation::sendKeyEvent( QKeyEvent* ev )
+{
+  emit stateSet(NOTIFYNORMAL);
+  
+  if (!ev->text().isEmpty())
+  { // A block of text
+    // Note that the text is proper unicode.
+    // We should do a conversion here, but since this
+    // routine will never be used, we simply emit plain ascii.
+    //emit sendBlock(ev->text().toAscii(),ev->text().length());
+    emit sendData(ev->text().toUtf8(),ev->text().length());
+  }
+}
+
+void Emulation::sendString(const char*,int)
+{
+    // default implementation does nothing
+}
+
+void Emulation::sendMouseEvent(int /*buttons*/, int /*column*/, int /*row*/, int /*eventType*/)
+{
+    // default implementation does nothing
+}
+
+// Unblocking, Byte to Unicode translation --------------------------------- --
+
+/*
+   We are doing code conversion from locale to unicode first.
+TODO: Character composition from the old code.  See #96536
+*/
+
+void Emulation::receiveData(const char* text, int length)
+{
+	emit stateSet(NOTIFYACTIVITY);
+
+	bufferedUpdate();
+    	
+    QString unicodeText = _decoder->toUnicode(text,length);
+
+	//send characters to terminal emulator
+	for (int i=0;i<unicodeText.length();i++)
+	{
+		receiveChar(unicodeText[i].unicode());
+	}
+
+	//look for z-modem indicator
+	//-- someone who understands more about z-modems that I do may be able to move
+	//this check into the above for loop?
+	for (int i=0;i<length;i++)
+	{
+		if (text[i] == '\030')
+    		{
+      			if ((length-i-1 > 3) && (strncmp(text+i+1, "B00", 3) == 0))
+      				emit zmodemDetected();
+    		}
+	}
+}
+
+//OLDER VERSION
+//This version of onRcvBlock was commented out because
+//	a)  It decoded incoming characters one-by-one, which is slow in the current version of Qt (4.2 tech preview)
+//	b)  It messed up decoding of non-ASCII characters, with the result that (for example) chinese characters
+//	    were not printed properly.
+//
+//There is something about stopping the _decoder if "we get a control code halfway a multi-byte sequence" (see below)
+//which hasn't been ported into the newer function (above).  Hopefully someone who understands this better
+//can find an alternative way of handling the check.  
+
+
+/*void Emulation::onRcvBlock(const char *s, int len)
+{
+  emit notifySessionState(NOTIFYACTIVITY);
+  
+  bufferedUpdate();
+  for (int i = 0; i < len; i++)
+  {
+
+    QString result = _decoder->toUnicode(&s[i],1);
+    int reslen = result.length();
+
+    // If we get a control code halfway a multi-byte sequence
+    // we flush the _decoder and continue with the control code.
+    if ((s[i] < 32) && (s[i] > 0))
+    {
+       // Flush _decoder
+       while(!result.length())
+          result = _decoder->toUnicode(&s[i],1);
+       reslen = 1;
+       result.resize(reslen);
+       result[0] = QChar(s[i]);
+    }
+
+    for (int j = 0; j < reslen; j++)
+    {
+      if (result[j].characterategory() == QChar::Mark_NonSpacing)
+         _currentScreen->compose(result.mid(j,1));
+      else
+         onRcvChar(result[j].unicode());
+    }
+    if (s[i] == '\030')
+    {
+      if ((len-i-1 > 3) && (strncmp(s+i+1, "B00", 3) == 0))
+      	emit zmodemDetected();
+    }
+  }
+}*/
+
+// Selection --------------------------------------------------------------- --
+
+#if 0
+void Emulation::onSelectionBegin(const int x, const int y, const bool columnmode) {
+  if (!connected) return;
+  _currentScreen->setSelectionStart( x,y,columnmode);
+  showBulk();
+}
+
+void Emulation::onSelectionExtend(const int x, const int y) {
+  if (!connected) return;
+  _currentScreen->setSelectionEnd(x,y);
+  showBulk();
+}
+
+void Emulation::setSelection(const bool preserve_line_breaks) {
+  if (!connected) return;
+  QString t = _currentScreen->selectedText(preserve_line_breaks);
+  if (!t.isNull()) 
+  {
+    QListIterator< TerminalDisplay* > viewIter(_views);
+
+    while (viewIter.hasNext())    
+        viewIter.next()->setSelection(t);
+  }
+}
+
+void Emulation::testIsSelected(const int x, const int y, bool &selected)
+{
+  if (!connected) return;
+  selected=_currentScreen->isSelected(x,y);
+}
+
+void Emulation::clearSelection() {
+  if (!connected) return;
+  _currentScreen->clearSelection();
+  showBulk();
+}
+
+#endif 
+
+void Emulation::writeToStream( TerminalCharacterDecoder* _decoder , 
+                               int startLine ,
+                               int endLine) 
+{
+  _currentScreen->writeToStream(_decoder,startLine,endLine);
+}
+
+int Emulation::lineCount()
+{
+    // sum number of lines currently on _screen plus number of lines in history
+    return _currentScreen->getLines() + _currentScreen->getHistLines();
+}
+
+// Refreshing -------------------------------------------------------------- --
+
+#define BULK_TIMEOUT1 10
+#define BULK_TIMEOUT2 40
+
+/*!
+*/
+void Emulation::showBulk()
+{
+    _bulkTimer1.stop();
+    _bulkTimer2.stop();
+
+    emit outputChanged();
+
+    _currentScreen->resetScrolledLines();
+    _currentScreen->resetDroppedLines();
+}
+
+void Emulation::bufferedUpdate()
+{
+   _bulkTimer1.setSingleShot(true);
+   _bulkTimer1.start(BULK_TIMEOUT1);
+   if (!_bulkTimer2.isActive())
+   {
+      _bulkTimer2.setSingleShot(true);
+      _bulkTimer2.start(BULK_TIMEOUT2);
+   }
+}
+
+char Emulation::getErase() const
+{
+  return '\b';
+}
+
+void Emulation::setImageSize(int lines, int columns)
+{
+  //kDebug() << "Resizing image to: " << lines << "by" << columns << QTime::currentTime().msec();
+  Q_ASSERT( lines > 0 );
+  Q_ASSERT( columns > 0 );
+
+  _screen[0]->resizeImage(lines,columns);
+  _screen[1]->resizeImage(lines,columns);
+
+  emit imageSizeChanged(lines,columns);
+
+  bufferedUpdate();
+}
+
+QSize Emulation::imageSize()
+{
+  return QSize(_currentScreen->getColumns(), _currentScreen->getLines());
+}
+
+ushort ExtendedCharTable::extendedCharHash(ushort* unicodePoints , ushort length) const
+{
+    ushort hash = 0;
+    for ( ushort i = 0 ; i < length ; i++ )
+    {
+        hash = 31*hash + unicodePoints[i];
+    }
+    return hash;
+}
+bool ExtendedCharTable::extendedCharMatch(ushort hash , ushort* unicodePoints , ushort length) const
+{
+    ushort* entry = extendedCharTable[hash];
+
+    // compare given length with stored sequence length ( given as the first ushort in the 
+    // stored buffer ) 
+    if ( entry == 0 || entry[0] != length ) 
+       return false;
+    // if the lengths match, each character must be checked.  the stored buffer starts at
+    // entry[1]
+    for ( int i = 0 ; i < length ; i++ )
+    {
+        if ( entry[i+1] != unicodePoints[i] )
+           return false; 
+    } 
+    return true;
+}
+ushort ExtendedCharTable::createExtendedChar(ushort* unicodePoints , ushort length)
+{
+    // look for this sequence of points in the table
+    ushort hash = extendedCharHash(unicodePoints,length);
+
+    // check existing entry for match
+    while ( extendedCharTable.contains(hash) )
+    {
+        if ( extendedCharMatch(hash,unicodePoints,length) )
+        {
+            // this sequence already has an entry in the table, 
+            // return its hash
+            return hash;
+        }
+        else
+        {
+            // if hash is already used by another, different sequence of unicode character
+            // points then try next hash
+            hash++;
+        }
+    }    
+
+    
+     // add the new sequence to the table and
+     // return that index
+    ushort* buffer = new ushort[length+1];
+    buffer[0] = length;
+    for ( int i = 0 ; i < length ; i++ )
+       buffer[i+1] = unicodePoints[i]; 
+    
+    extendedCharTable.insert(hash,buffer);
+
+    return hash;
+}
+
+ushort* ExtendedCharTable::lookupExtendedChar(ushort hash , ushort& length) const
+{
+    // lookup index in table and if found, set the length
+    // argument and return a pointer to the character sequence
+
+    ushort* buffer = extendedCharTable[hash];
+    if ( buffer )
+    {
+        length = buffer[0];
+        return buffer+1;
+    }
+    else
+    {
+        length = 0;
+        return 0;
+    }
+}
+
+ExtendedCharTable::ExtendedCharTable()
+{
+}
+ExtendedCharTable::~ExtendedCharTable()
+{
+    // free all allocated character buffers
+    QHashIterator<ushort,ushort*> iter(extendedCharTable);
+    while ( iter.hasNext() )
+    {
+        iter.next();
+        delete[] iter.value();
+    }
+}
+
+// global instance
+ExtendedCharTable ExtendedCharTable::instance;
+
+
+//#include "moc_Emulation.cpp"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Emulation.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,465 @@
+/*
+    This file is part of Konsole, an X terminal.
+    
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 EMULATION_H
+#define EMULATION_H
+
+// System
+#include <stdio.h>
+
+// Qt 
+#include <QtGui/QKeyEvent>
+//#include <QPointer>
+#include <QtCore/QTextCodec>
+#include <QtCore/QTextStream>
+#include <QtCore/QTimer>
+
+
+namespace Konsole
+{
+
+class KeyboardTranslator;
+class HistoryType;
+class Screen;
+class ScreenWindow;
+class TerminalCharacterDecoder;
+
+/** 
+ * This enum describes the available states which 
+ * the terminal emulation may be set to.
+ *
+ * These are the values used by Emulation::stateChanged() 
+ */
+enum 
+{ 
+    /** The emulation is currently receiving user input. */
+    NOTIFYNORMAL=0, 
+    /** 
+     * The terminal program has triggered a bell event
+     * to get the user's attention.
+     */
+    NOTIFYBELL=1, 
+    /** 
+     * The emulation is currently receiving data from its 
+     * terminal input.
+     */
+    NOTIFYACTIVITY=2,
+
+    // unused here? 
+    NOTIFYSILENCE=3 
+};
+
+/**
+ * Base class for terminal emulation back-ends.
+ *
+ * The back-end is responsible for decoding an incoming character stream and 
+ * producing an output image of characters.
+ *
+ * When input from the terminal is received, the receiveData() slot should be called with
+ * the data which has arrived.  The emulation will process the data and update the 
+ * screen image accordingly.  The codec used to decode the incoming character stream
+ * into the unicode characters used internally can be specified using setCodec() 
+ *
+ * The size of the screen image can be specified by calling setImageSize() with the 
+ * desired number of lines and columns.  When new lines are added, old content
+ * is moved into a history store, which can be set by calling setHistory(). 
+ *
+ * The screen image can be accessed by creating a ScreenWindow onto this emulation 
+ * by calling createWindow().  Screen windows provide access to a section of the 
+ * output.  Each screen window covers the same number of lines and columns as the 
+ * image size returned by imageSize().  The screen window can be moved up and down
+ * and provides transparent access to both the current on-screen image and the 
+ * previous output.  The screen windows emit an outputChanged signal
+ * when the section of the image they are looking at changes.
+ * Graphical views can then render the contents of a screen window, listening for notifications
+ * of output changes from the screen window which they are associated with and updating 
+ * accordingly. 
+ *
+ * The emulation also is also responsible for converting input from the connected views such
+ * as keypresses and mouse activity into a character string which can be sent
+ * to the terminal program.  Key presses can be processed by calling the sendKeyEvent() slot,
+ * while mouse events can be processed using the sendMouseEvent() slot.  When the character
+ * stream has been produced, the emulation will emit a sendData() signal with a pointer
+ * to the character buffer.  This data should be fed to the standard input of the terminal
+ * process.  The translation of key presses into an output character stream is performed
+ * using a lookup in a set of key bindings which map key sequences to output
+ * character sequences.  The name of the key bindings set used can be specified using
+ * setKeyBindings()
+ *
+ * The emulation maintains certain state information which changes depending on the 
+ * input received.  The emulation can be reset back to its starting state by calling 
+ * reset().  
+ *
+ * The emulation also maintains an activity state, which specifies whether
+ * terminal is currently active ( when data is received ), normal
+ * ( when the terminal is idle or receiving user input ) or trying
+ * to alert the user ( also known as a "Bell" event ).  The stateSet() signal
+ * is emitted whenever the activity state is set.  This can be used to determine
+ * how long the emulation has been active/idle for and also respond to
+ * a 'bell' event in different ways.
+ */
+class Emulation : public QObject
+{ 
+Q_OBJECT
+
+public:
+ 
+   /** Constructs a new terminal emulation */ 
+   Emulation();
+  ~Emulation();
+
+  /**
+   * Creates a new window onto the output from this emulation.  The contents
+   * of the window are then rendered by views which are set to use this window using the
+   * TerminalDisplay::setScreenWindow() method.
+   */
+  ScreenWindow* createWindow();
+
+  /** Returns the size of the screen image which the emulation produces */
+  QSize imageSize();
+
+  /**
+   * Returns the total number of lines, including those stored in the history.
+   */ 
+  int lineCount();
+
+  
+  /** 
+   * Sets the history store used by this emulation.  When new lines
+   * are added to the output, older lines at the top of the screen are transferred to a history
+   * store.   
+   *
+   * The number of lines which are kept and the storage location depend on the 
+   * type of store.
+   */
+  void setHistory(const HistoryType&);
+  /** Returns the history store used by this emulation.  See setHistory() */
+  const HistoryType& history();
+  /** Clears the history scroll. */
+  void clearHistory();
+
+  /** 
+   * Copies the output history from @p startLine to @p endLine 
+   * into @p stream, using @p decoder to convert the terminal
+   * characters into text. 
+   *
+   * @param decoder A decoder which converts lines of terminal characters with 
+   * appearance attributes into output text.  PlainTextDecoder is the most commonly
+   * used decoder.
+   * @param startLine The first
+   */
+  virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine);
+  
+  
+  /** Returns the codec used to decode incoming characters.  See setCodec() */
+  const QTextCodec* codec() { return _codec; }
+  /** Sets the codec used to decode incoming characters.  */
+  void setCodec(const QTextCodec*);
+
+  /** 
+   * Convenience method.  
+   * Returns true if the current codec used to decode incoming
+   * characters is UTF-8
+   */
+  bool utf8() { Q_ASSERT(_codec); return _codec->mibEnum() == 106; }
+  
+
+  /** TODO Document me */
+  virtual char getErase() const;
+
+  /** 
+   * Sets the key bindings used to key events
+   * ( received through sendKeyEvent() ) into character
+   * streams to send to the terminal.
+   */
+  void setKeyBindings(const QString& name);
+  /** 
+   * Returns the name of the emulation's current key bindings.
+   * See setKeyBindings()
+   */
+  QString keyBindings();
+
+  /** 
+   * Copies the current image into the history and clears the screen.
+   */
+  virtual void clearEntireScreen() =0;
+
+  /** Resets the state of the terminal. */
+  virtual void reset() =0;
+
+  /** 
+   * Returns true if the active terminal program wants
+   * mouse input events.
+   *
+   * The programUsesMouseChanged() signal is emitted when this
+   * changes.
+   */
+  bool programUsesMouse() const;
+
+public slots: 
+
+  /** Change the size of the emulation's image */
+  virtual void setImageSize(int lines, int columns);
+  
+  /** 
+   * Interprets a sequence of characters and sends the result to the terminal.
+   * This is equivalent to calling sendKeyEvent() for each character in @p text in succession.
+   */
+  virtual void sendText(const QString& text) = 0;
+
+  /** 
+   * Interprets a key press event and emits the sendData() signal with
+   * the resulting character stream. 
+   */
+  virtual void sendKeyEvent(QKeyEvent*);
+ 
+  /** 
+   * Converts information about a mouse event into an xterm-compatible escape
+   * sequence and emits the character sequence via sendData()
+   */
+  virtual void sendMouseEvent(int buttons, int column, int line, int eventType);
+  
+  /**
+   * Sends a string of characters to the foreground terminal process. 
+   *
+   * @param string The characters to send.  
+   * @param length Length of @p string or if set to a negative value, @p string will
+   * be treated as a null-terminated string and its length will be determined automatically.
+   */
+  virtual void sendString(const char* string, int length = -1) = 0;
+
+  /** 
+   * Processes an incoming stream of characters.  receiveData() decodes the incoming
+   * character buffer using the current codec(), and then calls receiveChar() for
+   * each unicode character in the resulting buffer.  
+   *
+   * receiveData() also starts a timer which causes the outputChanged() signal
+   * to be emitted when it expires.  The timer allows multiple updates in quick
+   * succession to be buffered into a single outputChanged() signal emission.
+   *
+   * @param buffer A string of characters received from the terminal program.
+   * @param len The length of @p buffer
+   */
+  void receiveData(const char* buffer,int len);
+
+signals:
+
+  /** 
+   * Emitted when a buffer of data is ready to send to the 
+   * standard input of the terminal.
+   *
+   * @param data The buffer of data ready to be sent
+   * @paran len The length of @p data in bytes
+   */
+  void sendData(const char* data,int len);
+
+  /** 
+   * Requests that sending of input to the emulation
+   * from the terminal process be suspended or resumed.
+   *
+   * @param suspend If true, requests that sending of 
+   * input from the terminal process' stdout be 
+   * suspended.  Otherwise requests that sending of
+   * input be resumed. 
+   */
+  void lockPtyRequest(bool suspend);
+
+  /**
+   * Requests that the pty used by the terminal process
+   * be set to UTF 8 mode.  
+   *
+   * TODO: More documentation
+   */
+  void useUtf8Request(bool);
+
+  /**
+   * Emitted when the activity state of the emulation is set.
+   *
+   * @param state The new activity state, one of NOTIFYNORMAL, NOTIFYACTIVITY
+   * or NOTIFYBELL
+   */
+  void stateSet(int state);
+
+  /** TODO Document me */
+  void zmodemDetected();
+
+
+  /**
+   * Requests that the color of the text used
+   * to represent the tabs associated with this
+   * emulation be changed.  This is a Konsole-specific
+   * extension from pre-KDE 4 times.
+   *
+   * TODO: Document how the parameter works.
+   */
+  void changeTabTextColorRequest(int color);
+
+  /** 
+   * This is emitted when the program running in the shell indicates whether or
+   * not it is interested in mouse events.
+   *
+   * @param usesMouse This will be true if the program wants to be informed about
+   * mouse events or false otherwise.
+   */
+  void programUsesMouseChanged(bool usesMouse);
+
+  /** 
+   * Emitted when the contents of the screen image change.
+   * The emulation buffers the updates from successive image changes,
+   * and only emits outputChanged() at sensible intervals when
+   * there is a lot of terminal activity.
+   *
+   * Normally there is no need for objects other than the screen windows
+   * created with createWindow() to listen for this signal.
+   *
+   * ScreenWindow objects created using createWindow() will emit their
+   * own outputChanged() signal in response to this signal. 
+   */
+  void outputChanged();
+
+  /**
+   * Emitted when the program running in the terminal wishes to update the 
+   * session's title.  This also allows terminal programs to customize other
+   * aspects of the terminal emulation display. 
+   *
+   * This signal is emitted when the escape sequence "\033]ARG;VALUE\007"
+   * is received in the input string, where ARG is a number specifying what
+   * should change and VALUE is a string specifying the new value.
+   *
+   * TODO:  The name of this method is not very accurate since this method
+   * is used to perform a whole range of tasks besides just setting
+   * the user-title of the session.    
+   *
+   * @param title Specifies what to change.
+   * <ul>
+   * <li>0 - Set window icon text and session title to @p newTitle</li>
+   * <li>1 - Set window icon text to @p newTitle</li>
+   * <li>2 - Set session title to @p newTitle</li>
+   * <li>11 - Set the session's default background color to @p newTitle,
+   *         where @p newTitle can be an HTML-style string (#RRGGBB) or a named
+   *         color (eg 'red', 'blue').  
+   *         See http://doc.trolltech.com/4.2/qcolor.html#setNamedColor for more
+   *         details.
+   * </li>
+   * <li>31 - Supposedly treats @p newTitle as a URL and opens it (NOT IMPLEMENTED)</li>
+   * <li>32 - Sets the icon associated with the session.  @p newTitle is the name 
+   *    of the icon to use, which can be the name of any icon in the current KDE icon
+   *    theme (eg: 'konsole', 'kate', 'folder_home')</li>
+   * </ul>
+   * @param newTitle Specifies the new title 
+   */
+
+  void titleChanged(int title,const QString& newTitle);
+
+  /**
+   * Emitted when the program running in the terminal changes the
+   * screen size.
+   */
+  void imageSizeChanged(int lineCount , int columnCount);
+
+  /** 
+   * Emitted when the terminal program requests to change various properties
+   * of the terminal display.  
+   *
+   * A profile change command occurs when a special escape sequence, followed
+   * by a string containing a series of name and value pairs is received.
+   * This string can be parsed using a ProfileCommandParser instance.
+   *
+   * @param text A string expected to contain a series of key and value pairs in
+   * the form:  name=value;name2=value2 ...
+   */
+  void profileChangeCommandReceived(const QString& text);
+
+protected:
+  virtual void setMode  (int mode) = 0;
+  virtual void resetMode(int mode) = 0;
+   
+ /** 
+   * Processes an incoming character.  See receiveData()
+   * @p ch A unicode character code. 
+   */
+  virtual void receiveChar(int ch);
+
+  /** 
+   * Sets the active screen.  The terminal has two screens, primary and alternate.
+   * The primary screen is used by default.  When certain interactive programs such
+   * as Vim are run, they trigger a switch to the alternate screen.
+   *
+   * @param index 0 to switch to the primary screen, or 1 to switch to the alternate screen
+   */
+  void setScreen(int index); 
+
+  enum EmulationCodec
+  {
+      LocaleCodec = 0,
+      Utf8Codec   = 1
+  };
+  void setCodec(EmulationCodec codec); // codec number, 0 = locale, 1=utf8
+
+
+  QList<ScreenWindow*> _windows;
+  
+  Screen* _currentScreen;  // pointer to the screen which is currently active, 
+                            // this is one of the elements in the screen[] array
+
+  Screen* _screen[2];      // 0 = primary screen ( used by most programs, including the shell
+                            //                      scrollbars are enabled in this mode )
+                            // 1 = alternate      ( used by vi , emacs etc.
+                            //                      scrollbars are not enabled in this mode )
+                            
+  
+  //decodes an incoming C-style character stream into a unicode QString using 
+  //the current text codec.  (this allows for rendering of non-ASCII characters in text files etc.)
+  const QTextCodec* _codec;
+  QTextDecoder* _decoder;
+
+  const KeyboardTranslator* _keyTranslator; // the keyboard layout
+
+protected slots:
+  /** 
+   * Schedules an update of attached views.
+   * Repeated calls to bufferedUpdate() in close succession will result in only a single update,
+   * much like the Qt buffered update of widgets. 
+   */
+  void bufferedUpdate();
+
+private slots: 
+
+  // triggered by timer, causes the emulation to send an updated screen image to each
+  // view
+  void showBulk(); 
+
+  void usesMouseChanged(bool usesMouse);
+
+private:
+
+  bool _usesMouse;
+  QTimer _bulkTimer1;
+  QTimer _bulkTimer2;
+  
+};
+
+}
+
+#endif // ifndef EMULATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/ExtendedDefaultTranslator.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,74 @@
+"keyboard \"Default (XFree 4)\""
+"key Escape             : \"\\E\""
+"key Tab   -Shift       : \"\\t\"\n"
+"key Tab   +Shift+Ansi  : \"\\E[Z\"\n"
+"key Tab   +Shift-Ansi  : \"\\t\"\n"
+"key Backtab     +Ansi  : \"\\E[Z\"\n"
+"key Backtab     -Ansi  : \"\\t\"\n"
+"key Return-Shift-NewLine : \"\\r\"\n"
+"key Return-Shift+NewLine : \"\\r\\n\"\n"
+"key Return+Shift         : \"\\EOM\"\n"
+"key Backspace      : \"\\x7f\"\n"
+"key Up   -Shift-Ansi : \"\\EA\"\n"
+"key Down -Shift-Ansi : \"\\EB\"\n"
+"key Right-Shift-Ansi : \"\\EC\"\n"
+"key Left -Shift-Ansi : \"\\ED\"\n"
+"key Up    -Shift-AnyMod+Ansi+AppCuKeys           : \"\\EOA\"\n"
+"key Down  -Shift-AnyMod+Ansi+AppCuKeys           : \"\\EOB\"\n"
+"key Right -Shift-AnyMod+Ansi+AppCuKeys           : \"\\EOC\"\n"
+"key Left  -Shift-AnyMod+Ansi+AppCuKeys           : \"\\EOD\"\n"
+"key Up    -Shift-AnyMod+Ansi-AppCuKeys           : \"\\E[A\"\n"
+"key Down  -Shift-AnyMod+Ansi-AppCuKeys           : \"\\E[B\"\n"
+"key Right -Shift-AnyMod+Ansi-AppCuKeys           : \"\\E[C\"\n"
+"key Left  -Shift-AnyMod+Ansi-AppCuKeys           : \"\\E[D\"\n"
+"key Up    -Shift+AnyMod+Ansi                     : \"\\E[1;*A\"\n"
+"key Down  -Shift+AnyMod+Ansi                     : \"\\E[1;*B\"\n"
+"key Right -Shift+AnyMod+Ansi                     : \"\\E[1;*C\"\n"
+"key Left  -Shift+AnyMod+Ansi                     : \"\\E[1;*D\"\n"
+"key Enter+NewLine : \"\\r\\n\"\n"
+"key Enter-NewLine : \"\\r\"\n"
+"key Home        -AnyMod     -AppCuKeys           : \"\\E[H\"  \n"
+"key End         -AnyMod     -AppCuKeys           : \"\\E[F\"  \n"
+"key Home        -AnyMod     +AppCuKeys           : \"\\EOH\"  \n"
+"key End         -AnyMod     +AppCuKeys           : \"\\EOF\"  \n"
+"key Home        +AnyMod                          : \"\\E[1;*H\"\n"
+"key End         +AnyMod                          : \"\\E[1;*F\"\n"
+"key Insert      -AnyMod                          : \"\\E[2~\"\n"
+"key Delete      -AnyMod                          : \"\\E[3~\"\n"
+"key Insert      +AnyMod                          : \"\\E[2;*~\"\n"
+"key Delete      +AnyMod                          : \"\\E[3;*~\"\n"
+"key Prior -Shift-AnyMod                          : \"\\E[5~\"\n"
+"key Next  -Shift-AnyMod                          : \"\\E[6~\"\n"
+"key Prior -Shift+AnyMod                          : \"\\E[5;*~\"\n"
+"key Next  -Shift+AnyMod                          : \"\\E[6;*~\"\n"
+"key F1          -AnyMod                          : \"\\EOP\"\n"
+"key F2          -AnyMod                          : \"\\EOQ\"\n"
+"key F3          -AnyMod                          : \"\\EOR\"\n"
+"key F4          -AnyMod                          : \"\\EOS\"\n"
+"key F5          -AnyMod                          : \"\\E[15~\"\n"
+"key F6          -AnyMod                          : \"\\E[17~\"\n"
+"key F7          -AnyMod                          : \"\\E[18~\"\n"
+"key F8          -AnyMod                          : \"\\E[19~\"\n"
+"key F9          -AnyMod                          : \"\\E[20~\"\n"
+"key F10         -AnyMod                          : \"\\E[21~\"\n"
+"key F11         -AnyMod                          : \"\\E[23~\"\n"
+"key F12         -AnyMod                          : \"\\E[24~\"\n"
+"key F1          +AnyMod                          : \"\\EO*P\"\n"
+"key F2          +AnyMod                          : \"\\EO*Q\"\n"
+"key F3          +AnyMod                          : \"\\EO*R\"\n"
+"key F4          +AnyMod                          : \"\\EO*S\"\n"
+"key F5          +AnyMod                          : \"\\E[15;*~\"\n"
+"key F6          +AnyMod                          : \"\\E[17;*~\"\n"
+"key F7          +AnyMod                          : \"\\E[18;*~\"\n"
+"key F8          +AnyMod                          : \"\\E[19;*~\"\n"
+"key F9          +AnyMod                          : \"\\E[20;*~\"\n"
+"key F10         +AnyMod                          : \"\\E[21;*~\"\n"
+"key F11         +AnyMod                          : \"\\E[23;*~\"\n"
+"key F12         +AnyMod                          : \"\\E[24;*~\"\n"
+"key Space +Control : \"\\x00\"\n"
+"key Up    +Shift-AppScreen  : scrollLineUp\n"
+"key Prior +Shift-AppScreen  : scrollPageUp\n"
+"key Down  +Shift-AppScreen  : scrollLineDown\n"
+"key Next  +Shift-AppScreen  : scrollPageDown\n"
+"key ScrollLock     : scrollLock\n"
+"\0"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Filter.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,562 @@
+/*
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "Filter.h"
+
+// System
+#include <iostream>
+
+// Qt
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QClipboard>
+#include <QtCore/QString>
+
+#include <QtCore/QSharedData>
+#include <QtCore>
+
+// KDE
+//#include <KLocale>
+//#include <KRun>
+
+// Konsole
+#include "TerminalCharacterDecoder.h"
+
+using namespace Konsole;
+
+FilterChain::~FilterChain()
+{
+    QMutableListIterator<Filter*> iter(*this);
+    
+    while ( iter.hasNext() )
+    {
+        Filter* filter = iter.next();
+        iter.remove();
+        delete filter;
+    }
+}
+
+void FilterChain::addFilter(Filter* filter)
+{
+    append(filter);
+}
+void FilterChain::removeFilter(Filter* filter)
+{
+    removeAll(filter);
+}
+bool FilterChain::containsFilter(Filter* filter)
+{
+    return contains(filter);
+}
+void FilterChain::reset()
+{
+    QListIterator<Filter*> iter(*this);
+    while (iter.hasNext())
+        iter.next()->reset();
+}
+void FilterChain::setBuffer(const QString* buffer , const QList<int>* linePositions)
+{
+    QListIterator<Filter*> iter(*this);
+    while (iter.hasNext())
+        iter.next()->setBuffer(buffer,linePositions);
+}
+void FilterChain::process()
+{
+    QListIterator<Filter*> iter(*this);
+    while (iter.hasNext())
+        iter.next()->process();
+}
+void FilterChain::clear()
+{
+    QList<Filter*>::clear();
+}
+Filter::HotSpot* FilterChain::hotSpotAt(int line , int column) const
+{
+    QListIterator<Filter*> iter(*this);
+    while (iter.hasNext())
+    {
+        Filter* filter = iter.next();
+        Filter::HotSpot* spot = filter->hotSpotAt(line,column);
+        if ( spot != 0 )
+        {
+            return spot;
+        }
+    }
+
+    return 0;
+}
+
+QList<Filter::HotSpot*> FilterChain::hotSpots() const
+{
+    QList<Filter::HotSpot*> list;
+    QListIterator<Filter*> iter(*this);
+    while (iter.hasNext())
+    {
+        Filter* filter = iter.next();
+        list << filter->hotSpots();
+    }
+    return list;
+}
+//QList<Filter::HotSpot*> FilterChain::hotSpotsAtLine(int line) const;
+
+TerminalImageFilterChain::TerminalImageFilterChain()
+: _buffer(0)
+, _linePositions(0)
+{
+}
+
+TerminalImageFilterChain::~TerminalImageFilterChain()
+{
+    delete _buffer;
+    delete _linePositions;
+}
+
+void TerminalImageFilterChain::setImage(const Character* const image , int lines , int columns, const QVector<LineProperty>& lineProperties)
+{
+//qDebug("%s %d", __FILE__, __LINE__);
+    if (empty())
+        return;
+//qDebug("%s %d", __FILE__, __LINE__);
+
+    // reset all filters and hotspots
+    reset();
+//qDebug("%s %d", __FILE__, __LINE__);
+
+    PlainTextDecoder decoder;
+    decoder.setTrailingWhitespace(false);
+    
+//qDebug("%s %d", __FILE__, __LINE__);
+    // setup new shared buffers for the filters to process on
+    QString* newBuffer = new QString();
+    QList<int>* newLinePositions = new QList<int>();
+    setBuffer( newBuffer , newLinePositions );
+
+    // free the old buffers
+    delete _buffer;
+    delete _linePositions;
+
+    _buffer = newBuffer;
+    _linePositions = newLinePositions;
+
+    QTextStream lineStream(_buffer);
+    decoder.begin(&lineStream);
+
+    for (int i=0 ; i < lines ; i++)
+    {
+        _linePositions->append(_buffer->length());
+        decoder.decodeLine(image + i*columns,columns,LINE_DEFAULT);
+
+        // pretend that each line ends with a newline character.
+        // this prevents a link that occurs at the end of one line
+        // being treated as part of a link that occurs at the start of the next line
+        //
+        // the downside is that links which are spread over more than one line are not
+        // highlighted.  
+        //
+        // TODO - Use the "line wrapped" attribute associated with lines in a
+        // terminal image to avoid adding this imaginary character for wrapped
+        // lines
+        if ( !(lineProperties.value(i,LINE_DEFAULT) & LINE_WRAPPED) )
+        	lineStream << QChar('\n');
+    }
+    decoder.end();
+//    qDebug("%s %d", __FILE__, __LINE__);
+}
+
+Filter::Filter() :
+_linePositions(0),
+_buffer(0)
+{
+}
+
+Filter::~Filter()
+{
+    QListIterator<HotSpot*> iter(_hotspotList);
+    while (iter.hasNext())
+    {
+        delete iter.next();
+    }
+}
+void Filter::reset()
+{
+    _hotspots.clear();
+    _hotspotList.clear();
+}
+
+void Filter::setBuffer(const QString* buffer , const QList<int>* linePositions)
+{
+    _buffer = buffer;
+    _linePositions = linePositions;
+}
+
+void Filter::getLineColumn(int position , int& startLine , int& startColumn)
+{
+    Q_ASSERT( _linePositions );
+    Q_ASSERT( _buffer );
+
+
+    for (int i = 0 ; i < _linePositions->count() ; i++)
+    {
+        //kDebug() << "line position at " << i << " = " << _linePositions[i];
+        int nextLine = 0;
+
+        if ( i == _linePositions->count()-1 )
+        {
+            nextLine = _buffer->length() + 1;
+        }
+        else
+        {
+            nextLine = _linePositions->value(i+1);
+        }
+
+       // kDebug() << "pos - " << position << " line pos(" << i<< ") " << _linePositions->value(i) << 
+       //     " next = " << nextLine << " buffer len = " << _buffer->length();
+
+        if ( _linePositions->value(i) <= position && position < nextLine ) 
+        {
+            startLine = i;
+            startColumn = position - _linePositions->value(i);
+            return;
+        }
+    }
+}
+    
+
+/*void Filter::addLine(const QString& text)
+{
+    _linePositions << _buffer.length();
+    _buffer.append(text);
+}*/
+
+const QString* Filter::buffer()
+{
+    return _buffer;
+}
+Filter::HotSpot::~HotSpot()
+{
+}
+void Filter::addHotSpot(HotSpot* spot)
+{
+    _hotspotList << spot;
+
+    for (int line = spot->startLine() ; line <= spot->endLine() ; line++)
+    {
+        _hotspots.insert(line,spot);
+    }    
+}
+QList<Filter::HotSpot*> Filter::hotSpots() const
+{
+    return _hotspotList;
+}
+QList<Filter::HotSpot*> Filter::hotSpotsAtLine(int line) const
+{
+    return _hotspots.values(line);
+}
+
+Filter::HotSpot* Filter::hotSpotAt(int line , int column) const
+{
+    QListIterator<HotSpot*> spotIter(_hotspots.values(line));
+
+    while (spotIter.hasNext())
+    {
+        HotSpot* spot = spotIter.next();
+        
+        if ( spot->startLine() == line && spot->startColumn() > column )
+            continue;
+        if ( spot->endLine() == line && spot->endColumn() < column )
+            continue;
+       
+        return spot;
+    }
+
+    return 0;
+}
+
+Filter::HotSpot::HotSpot(int startLine , int startColumn , int endLine , int endColumn)
+    : _startLine(startLine)
+    , _startColumn(startColumn)
+    , _endLine(endLine)
+    , _endColumn(endColumn)
+    , _type(NotSpecified)
+{
+}
+QString Filter::HotSpot::tooltip() const
+{
+    return QString();
+}
+QList<QAction*> Filter::HotSpot::actions()
+{
+    return QList<QAction*>();
+}
+int Filter::HotSpot::startLine() const
+{
+    return _startLine;
+}
+int Filter::HotSpot::endLine() const
+{
+    return _endLine;
+}
+int Filter::HotSpot::startColumn() const
+{
+    return _startColumn;
+}
+int Filter::HotSpot::endColumn() const
+{
+    return _endColumn;
+}
+Filter::HotSpot::Type Filter::HotSpot::type() const
+{
+    return _type;
+}
+void Filter::HotSpot::setType(Type type)
+{
+    _type = type;
+}
+
+RegExpFilter::RegExpFilter()
+{
+}
+
+RegExpFilter::HotSpot::HotSpot(int startLine,int startColumn,int endLine,int endColumn)
+    : Filter::HotSpot(startLine,startColumn,endLine,endColumn)
+{
+    setType(Marker);
+}
+
+void RegExpFilter::HotSpot::activate(QObject*)
+{
+}
+
+void RegExpFilter::HotSpot::setCapturedTexts(const QStringList& texts)
+{
+    _capturedTexts = texts;
+}
+QStringList RegExpFilter::HotSpot::capturedTexts() const
+{
+    return _capturedTexts;
+}
+
+void RegExpFilter::setRegExp(const QRegExp& regExp) 
+{
+    _searchText = regExp;
+}
+QRegExp RegExpFilter::regExp() const
+{
+    return _searchText;
+}
+/*void RegExpFilter::reset(int)
+{
+    _buffer = QString();
+}*/
+void RegExpFilter::process()
+{
+    int pos = 0;
+    const QString* text = buffer();
+
+    Q_ASSERT( text );
+
+    // ignore any regular expressions which match an empty string.
+    // otherwise the while loop below will run indefinitely
+    static const QString emptyString("");
+    if ( _searchText.exactMatch(emptyString) )
+        return;
+
+    while(pos >= 0)
+    {
+        pos = _searchText.indexIn(*text,pos);
+
+        if ( pos >= 0 )
+        {
+
+            int startLine = 0;
+            int endLine = 0;
+            int startColumn = 0;
+            int endColumn = 0;
+
+            
+            //kDebug() << "pos from " << pos << " to " << pos + _searchText.matchedLength();
+            
+            getLineColumn(pos,startLine,startColumn);
+            getLineColumn(pos + _searchText.matchedLength(),endLine,endColumn);
+
+            //kDebug() << "start " << startLine << " / " << startColumn;
+            //kDebug() << "end " << endLine << " / " << endColumn;
+
+            RegExpFilter::HotSpot* spot = newHotSpot(startLine,startColumn,
+                                           endLine,endColumn);
+            spot->setCapturedTexts(_searchText.capturedTexts());
+
+            addHotSpot( spot );  
+            pos += _searchText.matchedLength();
+
+            // if matchedLength == 0, the program will get stuck in an infinite loop
+            Q_ASSERT( _searchText.matchedLength() > 0 );
+        }
+    }    
+}
+
+RegExpFilter::HotSpot* RegExpFilter::newHotSpot(int startLine,int startColumn,
+                                                int endLine,int endColumn)
+{
+    return new RegExpFilter::HotSpot(startLine,startColumn,
+                                                  endLine,endColumn);
+}
+RegExpFilter::HotSpot* UrlFilter::newHotSpot(int startLine,int startColumn,int endLine,
+                                                    int endColumn)
+{
+    return new UrlFilter::HotSpot(startLine,startColumn,
+                                               endLine,endColumn);
+}
+UrlFilter::HotSpot::HotSpot(int startLine,int startColumn,int endLine,int endColumn)
+: RegExpFilter::HotSpot(startLine,startColumn,endLine,endColumn)
+, _urlObject(new FilterObject(this))
+{
+    setType(Link);
+}
+QString UrlFilter::HotSpot::tooltip() const
+{
+    QString url = capturedTexts().first();
+
+    const UrlType kind = urlType();
+
+    if ( kind == StandardUrl )
+        return QString(); 
+    else if ( kind == Email )
+        return QString(); 
+    else
+        return QString();
+}
+UrlFilter::HotSpot::UrlType UrlFilter::HotSpot::urlType() const
+{
+    QString url = capturedTexts().first();
+    
+    if ( FullUrlRegExp.exactMatch(url) )
+        return StandardUrl;
+    else if ( EmailAddressRegExp.exactMatch(url) )
+        return Email;
+    else
+        return Unknown;
+}
+
+void UrlFilter::HotSpot::activate(QObject* object)
+{
+    QString url = capturedTexts().first();
+
+    const UrlType kind = urlType();
+
+    const QString& actionName = object ? object->objectName() : QString();
+
+    if ( actionName == "copy-action" )
+    {
+        //kDebug() << "Copying url to clipboard:" << url;
+
+        QApplication::clipboard()->setText(url);
+        return;
+    }
+
+    if ( !object || actionName == "open-action" )
+    {
+        if ( kind == StandardUrl )
+        {
+            // if the URL path does not include the protocol ( eg. "www.kde.org" ) then
+            // prepend http:// ( eg. "www.kde.org" --> "http://www.kde.org" )
+            if (!url.contains("://"))
+            {
+                url.prepend("http://");
+            }
+        } 
+        else if ( kind == Email )
+        {
+            url.prepend("mailto:");
+        }
+    
+//        new KRun(url,QApplication::activeWindow());
+    }
+}
+
+// Note:  Altering these regular expressions can have a major effect on the performance of the filters 
+// used for finding URLs in the text, especially if they are very general and could match very long
+// pieces of text.
+// Please be careful when altering them.
+
+//regexp matches:
+// full url:  
+// protocolname:// or www. followed by anything other than whitespaces, <, >, ' or ", and ends before whitespaces, <, >, ', ", ], !, comma and dot
+const QRegExp UrlFilter::FullUrlRegExp("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]]");
+// email address:
+// [word chars, dots or dashes]@[word chars, dots or dashes].[word chars]
+const QRegExp UrlFilter::EmailAddressRegExp("\\b(\\w|\\.|-)+@(\\w|\\.|-)+\\.\\w+\\b");
+
+// matches full url or email address
+const QRegExp UrlFilter::CompleteUrlRegExp('('+FullUrlRegExp.pattern()+'|'+
+                                            EmailAddressRegExp.pattern()+')');
+
+UrlFilter::UrlFilter()
+{
+    setRegExp( CompleteUrlRegExp );
+}
+UrlFilter::HotSpot::~HotSpot()
+{
+    delete _urlObject;
+}
+void FilterObject::activated()
+{
+    _filter->activate(sender());
+}
+QList<QAction*> UrlFilter::HotSpot::actions()
+{
+    QList<QAction*> list;
+
+    const UrlType kind = urlType();
+
+    QAction* openAction = new QAction(_urlObject);
+    QAction* copyAction = new QAction(_urlObject);;
+
+    Q_ASSERT( kind == StandardUrl || kind == Email );
+
+    if ( kind == StandardUrl )
+    {
+        openAction->setText(("Open Link"));
+        copyAction->setText(("Copy Link Address"));
+    }
+    else if ( kind == Email )
+    {
+        openAction->setText(("Send Email To..."));
+        copyAction->setText(("Copy Email Address"));
+    }
+
+    // object names are set here so that the hotspot performs the
+    // correct action when activated() is called with the triggered
+    // action passed as a parameter.
+    openAction->setObjectName("open-action");
+    copyAction->setObjectName("copy-action");
+
+    QObject::connect( openAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()) );
+    QObject::connect( copyAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()) );
+
+    list << openAction;
+    list << copyAction;
+
+    return list; 
+}
+
+//#include "moc_Filter.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Filter.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,383 @@
+/*
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 FILTER_H
+#define FILTER_H
+
+// Qt
+#include <QtGui/QAction>
+#include <QtCore/QList>
+#include <QtCore/QObject>
+#include <QtCore/QStringList>
+#include <QtCore/QHash>
+#include <QtCore/QRegExp>
+
+// Local
+#include "Character.h"
+
+namespace Konsole
+{
+
+/**
+ * A filter processes blocks of text looking for certain patterns (such as URLs or keywords from a list)
+ * and marks the areas which match the filter's patterns as 'hotspots'.
+ *
+ * Each hotspot has a type identifier associated with it ( such as a link or a highlighted section ),
+ * and an action.  When the user performs some activity such as a mouse-click in a hotspot area ( the exact
+ * action will depend on what is displaying the block of text which the filter is processing ), the hotspot's
+ * activate() method should be called.  Depending on the type of hotspot this will trigger a suitable response.
+ *
+ * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser.
+ * Hotspots may have more than one action, in which case the list of actions can be obtained using the 
+ * actions() method.
+ *
+ * Different subclasses of filter will return different types of hotspot.
+ * Subclasses must reimplement the process() method to examine a block of text and identify sections of interest.
+ * When processing the text they should create instances of Filter::HotSpot subclasses for sections of interest
+ * and add them to the filter's list of hotspots using addHotSpot()
+ */
+class Filter
+{
+public:
+    /**
+    * Represents an area of text which matched the pattern a particular filter has been looking for.
+    *
+    * Each hotspot has a type identifier associated with it ( such as a link or a highlighted section ),
+    * and an action.  When the user performs some activity such as a mouse-click in a hotspot area ( the exact
+    * action will depend on what is displaying the block of text which the filter is processing ), the hotspot's
+    * activate() method should be called.  Depending on the type of hotspot this will trigger a suitable response.
+    *
+    * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser.
+    * Hotspots may have more than one action, in which case the list of actions can be obtained using the 
+    * actions() method.  These actions may then be displayed in a popup menu or toolbar for example. 
+    */
+    class HotSpot
+    {
+    public:
+       /** 
+        * Constructs a new hotspot which covers the area from (@p startLine,@p startColumn) to (@p endLine,@p endColumn)
+        * in a block of text.
+        */
+       HotSpot(int startLine , int startColumn , int endLine , int endColumn);
+       virtual ~HotSpot();
+
+       enum Type
+       {
+            // the type of the hotspot is not specified
+            NotSpecified,
+            // this hotspot represents a clickable link
+            Link,
+            // this hotspot represents a marker
+            Marker
+       }; 
+
+       /** Returns the line when the hotspot area starts */
+       int startLine() const;
+       /** Returns the line where the hotspot area ends */
+       int endLine() const;
+       /** Returns the column on startLine() where the hotspot area starts */
+       int startColumn() const;
+       /** Returns the column on endLine() where the hotspot area ends */
+       int endColumn() const;
+       /** 
+        * Returns the type of the hotspot.  This is usually used as a hint for views on how to represent
+        * the hotspot graphically.  eg.  Link hotspots are typically underlined when the user mouses over them
+        */
+       Type type() const;
+       /** 
+        * Causes the an action associated with a hotspot to be triggered. 
+        *
+        * @param object The object which caused the hotspot to be triggered.  This is
+        * typically null ( in which case the default action should be performed ) or
+        * one of the objects from the actions() list.  In which case the associated
+        * action should be performed. 
+        */
+       virtual void activate(QObject* object = 0) = 0; 
+       /** 
+        * Returns a list of actions associated with the hotspot which can be used in a 
+        * menu or toolbar 
+        */
+       virtual QList<QAction*> actions();
+
+       /** 
+        * Returns the text of a tooltip to be shown when the mouse moves over the hotspot, or
+        * an empty string if there is no tooltip associated with this hotspot.
+        *
+        * The default implementation returns an empty string. 
+        */
+       virtual QString tooltip() const;
+
+    protected:
+       /** Sets the type of a hotspot.  This should only be set once */
+       void setType(Type type);
+
+    private:
+       int    _startLine;
+       int    _startColumn;
+       int    _endLine;
+       int    _endColumn;
+       Type _type;
+    
+    };
+
+    /** Constructs a new filter. */
+    Filter();
+    virtual ~Filter();
+
+    /** Causes the filter to process the block of text currently in its internal buffer */
+    virtual void process() = 0;
+
+    /** 
+     * Empties the filters internal buffer and resets the line count back to 0.
+     * All hotspots are deleted. 
+     */
+    void reset();
+
+    /** Adds a new line of text to the filter and increments the line count */
+    //void addLine(const QString& string);
+
+    /** Returns the hotspot which covers the given @p line and @p column, or 0 if no hotspot covers that area */
+    HotSpot* hotSpotAt(int line , int column) const;
+
+    /** Returns the list of hotspots identified by the filter */
+    QList<HotSpot*> hotSpots() const;
+
+    /** Returns the list of hotspots identified by the filter which occur on a given line */
+    QList<HotSpot*> hotSpotsAtLine(int line) const;
+
+    /** 
+     * TODO: Document me
+     */
+    void setBuffer(const QString* buffer , const QList<int>* linePositions);
+
+protected:
+    /** Adds a new hotspot to the list */
+    void addHotSpot(HotSpot*);
+    /** Returns the internal buffer */
+    const QString* buffer();
+    /** Converts a character position within buffer() to a line and column */
+    void getLineColumn(int position , int& startLine , int& startColumn);
+
+private:
+    QMultiHash<int,HotSpot*> _hotspots;
+    QList<HotSpot*> _hotspotList;
+    
+    const QList<int>* _linePositions;
+    const QString* _buffer;
+};
+
+/** 
+ * A filter which searches for sections of text matching a regular expression and creates a new RegExpFilter::HotSpot 
+ * instance for them.
+ *
+ * Subclasses can reimplement newHotSpot() to return custom hotspot types when matches for the regular expression
+ * are found. 
+ */
+class RegExpFilter : public Filter
+{
+public:
+    /** 
+     * Type of hotspot created by RegExpFilter.  The capturedTexts() method can be used to find the text
+     * matched by the filter's regular expression.
+     */
+    class HotSpot : public Filter::HotSpot
+    {
+    public:
+        HotSpot(int startLine, int startColumn, int endLine , int endColumn);
+        virtual void activate(QObject* object = 0);
+
+        /** Sets the captured texts associated with this hotspot */
+        void setCapturedTexts(const QStringList& texts);
+        /** Returns the texts found by the filter when matching the filter's regular expression */
+        QStringList capturedTexts() const;
+    private:
+        QStringList _capturedTexts;
+    };
+
+    /** Constructs a new regular expression filter */
+    RegExpFilter();
+
+    /** 
+     * Sets the regular expression which the filter searches for in blocks of text. 
+     *
+     * Regular expressions which match the empty string are treated as not matching
+     * anything. 
+     */
+    void setRegExp(const QRegExp& text);
+    /** Returns the regular expression which the filter searches for in blocks of text */
+    QRegExp regExp() const;
+
+    /** 
+     * Reimplemented to search the filter's text buffer for text matching regExp() 
+     *
+     * If regexp matches the empty string, then process() will return immediately
+     * without finding results. 
+     */
+    virtual void process();
+
+protected:
+    /** 
+     * Called when a match for the regular expression is encountered.  Subclasses should reimplement this
+     * to return custom hotspot types
+     */
+    virtual RegExpFilter::HotSpot* newHotSpot(int startLine,int startColumn,
+                                    int endLine,int endColumn);
+
+private:
+    QRegExp _searchText;
+};
+
+class FilterObject;
+
+/** A filter which matches URLs in blocks of text */
+class UrlFilter : public RegExpFilter 
+{
+public:
+    /** 
+     * Hotspot type created by UrlFilter instances.  The activate() method opens a web browser 
+     * at the given URL when called.
+     */
+    class HotSpot : public RegExpFilter::HotSpot 
+    {
+    public:
+        HotSpot(int startLine,int startColumn,int endLine,int endColumn);
+        virtual ~HotSpot();
+
+        virtual QList<QAction*> actions();
+
+        /** 
+         * Open a web browser at the current URL.  The url itself can be determined using
+         * the capturedTexts() method.
+         */
+        virtual void activate(QObject* object = 0);
+
+        virtual QString tooltip() const;
+    private:
+        enum UrlType
+        {
+            StandardUrl,
+            Email,
+            Unknown
+        };
+        UrlType urlType() const;
+
+        FilterObject* _urlObject;
+    };
+
+    UrlFilter();
+
+protected:
+    virtual RegExpFilter::HotSpot* newHotSpot(int,int,int,int);
+
+private:
+    
+    static const QRegExp FullUrlRegExp;
+    static const QRegExp EmailAddressRegExp;
+
+    // combined OR of FullUrlRegExp and EmailAddressRegExp
+    static const QRegExp CompleteUrlRegExp; 
+};
+
+class FilterObject : public QObject
+{
+Q_OBJECT
+public:
+    FilterObject(Filter::HotSpot* filter) : _filter(filter) {}
+private slots:
+    void activated();
+private:
+    Filter::HotSpot* _filter;
+};
+
+/** 
+ * A chain which allows a group of filters to be processed as one. 
+ * The chain owns the filters added to it and deletes them when the chain itself is destroyed.
+ *
+ * Use addFilter() to add a new filter to the chain.  
+ * When new text to be filtered arrives, use addLine() to add each additional
+ * line of text which needs to be processed and then after adding the last line, use
+ * process() to cause each filter in the chain to process the text.
+ *
+ * After processing a block of text, the reset() method can be used to set the filter chain's
+ * internal cursor back to the first line.
+ *
+ * The hotSpotAt() method will return the first hotspot which covers a given position.
+ *
+ * The hotSpots() and hotSpotsAtLine() method return all of the hotspots in the text and on
+ * a given line respectively.
+ */
+class FilterChain : protected QList<Filter*>
+{
+public:
+    virtual ~FilterChain();
+
+    /** Adds a new filter to the chain.  The chain will delete this filter when it is destroyed */
+    void addFilter(Filter* filter);
+    /** Removes a filter from the chain.  The chain will no longer delete the filter when destroyed */
+    void removeFilter(Filter* filter);
+    /** Returns true if the chain contains @p filter */
+    bool containsFilter(Filter* filter);
+    /** Removes all filters from the chain */
+    void clear();
+
+    /** Resets each filter in the chain */
+    void reset();
+    /**
+     * Processes each filter in the chain 
+     */
+    void process();
+
+    /** Sets the buffer for each filter in the chain to process. */
+    void setBuffer(const QString* buffer , const QList<int>* linePositions); 
+
+    /** Returns the first hotspot which occurs at @p line, @p column or 0 if no hotspot was found */
+    Filter::HotSpot* hotSpotAt(int line , int column) const;
+    /** Returns a list of all the hotspots in all the chain's filters */
+    QList<Filter::HotSpot*> hotSpots() const;
+    /** Returns a list of all hotspots at the given line in all the chain's filters */
+    QList<Filter::HotSpot> hotSpotsAtLine(int line) const;
+
+};
+
+/** A filter chain which processes character images from terminal displays */
+class TerminalImageFilterChain : public FilterChain
+{
+public:
+    TerminalImageFilterChain();
+    virtual ~TerminalImageFilterChain();
+
+    /**
+     * Set the current terminal image to @p image.
+     *
+     * @param image The terminal image
+     * @param lines The number of lines in the terminal image
+     * @param columns The number of columns in the terminal image
+     */
+    void setImage(const Character* const image , int lines , int columns,
+				  const QVector<LineProperty>& lineProperties);  
+
+private:
+    QString* _buffer;
+    QList<int>* _linePositions;
+};
+
+}
+#endif //FILTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/History.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,698 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "History.h"
+
+// System
+#include <iostream>
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <errno.h>
+
+
+// Reasonable line size
+#define LINE_SIZE	1024
+
+using namespace Konsole;
+
+/*
+   An arbitrary long scroll.
+
+   One can modify the scroll only by adding either cells
+   or newlines, but access it randomly.
+
+   The model is that of an arbitrary wide typewriter scroll
+   in that the scroll is a serie of lines and each line is
+   a serie of cells with no overwriting permitted.
+
+   The implementation provides arbitrary length and numbers
+   of cells and line/column indexed read access to the scroll
+   at constant costs.
+
+KDE4: Can we use QTemporaryFile here, instead of KTempFile?
+
+FIXME: some complain about the history buffer comsuming the
+       memory of their machines. This problem is critical
+       since the history does not behave gracefully in cases
+       where the memory is used up completely.
+
+       I put in a workaround that should handle it problem
+       now gracefully. I'm not satisfied with the solution.
+
+FIXME: Terminating the history is not properly indicated
+       in the menu. We should throw a signal.
+
+FIXME: There is noticeable decrease in speed, also. Perhaps,
+       there whole feature needs to be revisited therefore.
+       Disadvantage of a more elaborated, say block-oriented
+       scheme with wrap around would be it's complexity.
+*/
+
+//FIXME: tempory replacement for tmpfile
+//       this is here one for debugging purpose.
+
+//#define tmpfile xTmpFile
+
+// History File ///////////////////////////////////////////
+
+/*
+  A Row(X) data type which allows adding elements to the end.
+*/
+
+HistoryFile::HistoryFile()
+  : ion(-1),
+    length(0),
+	fileMap(0)
+{
+  if (tmpFile.open())
+  { 
+    tmpFile.setAutoRemove(true);
+    ion = tmpFile.handle();
+  }
+}
+
+HistoryFile::~HistoryFile()
+{
+	if (fileMap)
+		unmap();
+}
+
+//TODO:  Mapping the entire file in will cause problems if the history file becomes exceedingly large,
+//(ie. larger than available memory).  HistoryFile::map() should only map in sections of the file at a time,
+//to avoid this.
+void HistoryFile::map()
+{
+	assert( fileMap == 0 );
+
+	fileMap = (char*)mmap( 0 , length , PROT_READ , MAP_PRIVATE , ion , 0 );
+
+    //if mmap'ing fails, fall back to the read-lseek combination
+    if ( fileMap == MAP_FAILED )
+    {
+            readWriteBalance = 0; 
+            fileMap = 0;
+            qDebug() << ": mmap'ing history failed.  errno = " << errno;
+    }
+}
+
+void HistoryFile::unmap()
+{
+	int result = munmap( fileMap , length );
+	assert( result == 0 );
+
+	fileMap = 0;
+}
+
+bool HistoryFile::isMapped()
+{
+	return (fileMap != 0);
+}
+
+void HistoryFile::add(const unsigned char* bytes, int len)
+{
+  if ( fileMap )
+		  unmap();
+		
+  readWriteBalance++;
+
+  int rc = 0;
+
+  rc = lseek(ion,length,SEEK_SET); if (rc < 0) { perror("HistoryFile::add.seek"); return; }
+  rc = write(ion,bytes,len);       if (rc < 0) { perror("HistoryFile::add.write"); return; }
+  length += rc;
+}
+
+void HistoryFile::get(unsigned char* bytes, int len, int loc)
+{
+  //count number of get() calls vs. number of add() calls.  
+  //If there are many more get() calls compared with add() 
+  //calls (decided by using MAP_THRESHOLD) then mmap the log
+  //file to improve performance.
+  readWriteBalance--;
+  if ( !fileMap && readWriteBalance < MAP_THRESHOLD )
+		  map();
+
+  if ( fileMap )
+  {
+	for (int i=0;i<len;i++)
+			bytes[i]=fileMap[loc+i];
+  }
+  else
+  {	
+  	int rc = 0;
+
+  	if (loc < 0 || len < 0 || loc + len > length)
+    	fprintf(stderr,"getHist(...,%d,%d): invalid args.\n",len,loc);
+  	rc = lseek(ion,loc,SEEK_SET); if (rc < 0) { perror("HistoryFile::get.seek"); return; }
+  	rc = read(ion,bytes,len);     if (rc < 0) { perror("HistoryFile::get.read"); return; }
+  }
+}
+
+int HistoryFile::len()
+{
+  return length;
+}
+
+
+// History Scroll abstract base class //////////////////////////////////////
+
+
+HistoryScroll::HistoryScroll(HistoryType* t)
+  : m_histType(t)
+{
+}
+
+HistoryScroll::~HistoryScroll()
+{
+  delete m_histType;
+}
+
+bool HistoryScroll::hasScroll()
+{
+  return true;
+}
+
+// History Scroll File //////////////////////////////////////
+
+/* 
+   The history scroll makes a Row(Row(Cell)) from
+   two history buffers. The index buffer contains
+   start of line positions which refere to the cells
+   buffer.
+
+   Note that index[0] addresses the second line
+   (line #1), while the first line (line #0) starts
+   at 0 in cells.
+*/
+
+HistoryScrollFile::HistoryScrollFile(const QString &logFileName)
+  : HistoryScroll(new HistoryTypeFile(logFileName)),
+  m_logFileName(logFileName)
+{
+}
+
+HistoryScrollFile::~HistoryScrollFile()
+{
+}
+ 
+int HistoryScrollFile::getLines()
+{
+  return index.len() / sizeof(int);
+}
+
+int HistoryScrollFile::getLineLen(int lineno)
+{
+  return (startOfLine(lineno+1) - startOfLine(lineno)) / sizeof(Character);
+}
+
+bool HistoryScrollFile::isWrappedLine(int lineno)
+{
+  if (lineno>=0 && lineno <= getLines()) {
+    unsigned char flag;
+    lineflags.get((unsigned char*)&flag,sizeof(unsigned char),(lineno)*sizeof(unsigned char));
+    return flag;
+  }
+  return false;
+}
+
+int HistoryScrollFile::startOfLine(int lineno)
+{
+  if (lineno <= 0) return 0;
+  if (lineno <= getLines())
+    { 
+	
+	if (!index.isMapped())
+			index.map();
+	
+	int res;
+    index.get((unsigned char*)&res,sizeof(int),(lineno-1)*sizeof(int));
+    return res;
+    }
+  return cells.len();
+}
+
+void HistoryScrollFile::getCells(int lineno, int colno, int count, Character res[])
+{
+  cells.get((unsigned char*)res,count*sizeof(Character),startOfLine(lineno)+colno*sizeof(Character));
+}
+
+void HistoryScrollFile::addCells(const Character text[], int count)
+{
+  cells.add((unsigned char*)text,count*sizeof(Character));
+}
+
+void HistoryScrollFile::addLine(bool previousWrapped)
+{
+  if (index.isMapped())
+		  index.unmap();
+
+  int locn = cells.len();
+  index.add((unsigned char*)&locn,sizeof(int));
+  unsigned char flags = previousWrapped ? 0x01 : 0x00;
+  lineflags.add((unsigned char*)&flags,sizeof(unsigned char));
+}
+
+
+// History Scroll Buffer //////////////////////////////////////
+HistoryScrollBuffer::HistoryScrollBuffer(unsigned int maxLineCount)
+  : HistoryScroll(new HistoryTypeBuffer(maxLineCount))
+   ,_historyBuffer()
+   ,_maxLineCount(0)
+   ,_usedLines(0)
+   ,_head(0)
+{
+  setMaxNbLines(maxLineCount);
+}
+
+HistoryScrollBuffer::~HistoryScrollBuffer()
+{
+    delete[] _historyBuffer;
+}
+
+void HistoryScrollBuffer::addCellsVector(const QVector<Character>& cells)
+{
+    _head++;
+    if ( _usedLines < _maxLineCount )
+        _usedLines++;
+
+    if ( _head >= _maxLineCount )
+    {
+        _head = 0;
+    }
+
+    _historyBuffer[bufferIndex(_usedLines-1)] = cells;
+    _wrappedLine[bufferIndex(_usedLines-1)] = false;
+}
+void HistoryScrollBuffer::addCells(const Character a[], int count)
+{
+  HistoryLine newLine(count);
+  qCopy(a,a+count,newLine.begin());
+
+  addCellsVector(newLine);
+}
+
+void HistoryScrollBuffer::addLine(bool previousWrapped)
+{
+    _wrappedLine[bufferIndex(_usedLines-1)] = previousWrapped;
+}
+
+int HistoryScrollBuffer::getLines()
+{
+    return _usedLines;
+}
+
+int HistoryScrollBuffer::getLineLen(int lineNumber)
+{
+  Q_ASSERT( lineNumber >= 0 && lineNumber < _maxLineCount );
+
+  if ( lineNumber < _usedLines )
+  {
+    return _historyBuffer[bufferIndex(lineNumber)].size();
+  }
+  else
+  {
+    return 0;
+  }
+}
+
+bool HistoryScrollBuffer::isWrappedLine(int lineNumber)
+{
+  Q_ASSERT( lineNumber >= 0 && lineNumber < _maxLineCount );
+    
+  if (lineNumber < _usedLines)
+  {
+    //kDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)];
+    return _wrappedLine[bufferIndex(lineNumber)];
+  }
+  else
+    return false;
+}
+
+void HistoryScrollBuffer::getCells(int lineNumber, int startColumn, int count, Character* buffer)
+{
+  if ( count == 0 ) return;
+
+  Q_ASSERT( lineNumber < _maxLineCount );
+
+  if (lineNumber >= _usedLines) 
+  {
+    memset(buffer, 0, count * sizeof(Character));
+    return;
+  }
+  
+  const HistoryLine& line = _historyBuffer[bufferIndex(lineNumber)];
+
+  //kDebug() << "startCol " << startColumn;
+  //kDebug() << "line.size() " << line.size();
+  //kDebug() << "count " << count;
+
+  Q_ASSERT( startColumn <= line.size() - count );
+    
+  memcpy(buffer, line.constData() + startColumn , count * sizeof(Character));
+}
+
+void HistoryScrollBuffer::setMaxNbLines(unsigned int lineCount)
+{
+    HistoryLine* oldBuffer = _historyBuffer;
+    HistoryLine* newBuffer = new HistoryLine[lineCount];
+    
+    for ( int i = 0 ; i < qMin(_usedLines,(int)lineCount) ; i++ )
+    {
+        newBuffer[i] = oldBuffer[bufferIndex(i)];
+    }
+    
+    _usedLines = qMin(_usedLines,(int)lineCount);
+    _maxLineCount = lineCount;
+    _head = ( _usedLines == _maxLineCount ) ? 0 : _usedLines-1;
+
+    _historyBuffer = newBuffer;
+    delete[] oldBuffer;
+
+    _wrappedLine.resize(lineCount);
+}
+
+int HistoryScrollBuffer::bufferIndex(int lineNumber)
+{
+    Q_ASSERT( lineNumber >= 0 );
+    Q_ASSERT( lineNumber < _maxLineCount );
+    Q_ASSERT( (_usedLines == _maxLineCount) || lineNumber <= _head );
+
+    if ( _usedLines == _maxLineCount )
+    {
+        return (_head+lineNumber+1) % _maxLineCount;
+    }
+    else
+    {   
+        return lineNumber;
+    }
+}
+
+
+// History Scroll None //////////////////////////////////////
+
+HistoryScrollNone::HistoryScrollNone()
+  : HistoryScroll(new HistoryTypeNone())
+{
+}
+
+HistoryScrollNone::~HistoryScrollNone()
+{
+}
+
+bool HistoryScrollNone::hasScroll()
+{
+  return false;
+}
+
+int  HistoryScrollNone::getLines()
+{
+  return 0;
+}
+
+int  HistoryScrollNone::getLineLen(int)
+{
+  return 0;
+}
+
+bool HistoryScrollNone::isWrappedLine(int /*lineno*/)
+{
+  return false;
+}
+
+void HistoryScrollNone::getCells(int, int, int, Character [])
+{
+}
+
+void HistoryScrollNone::addCells(const Character [], int)
+{
+}
+
+void HistoryScrollNone::addLine(bool)
+{
+}
+
+// History Scroll BlockArray //////////////////////////////////////
+
+HistoryScrollBlockArray::HistoryScrollBlockArray(size_t size)
+  : HistoryScroll(new HistoryTypeBlockArray(size))
+{
+  m_blockArray.setHistorySize(size); // nb. of lines.
+}
+
+HistoryScrollBlockArray::~HistoryScrollBlockArray()
+{
+}
+
+int  HistoryScrollBlockArray::getLines()
+{
+  return m_lineLengths.count();
+}
+
+int  HistoryScrollBlockArray::getLineLen(int lineno)
+{
+    if ( m_lineLengths.contains(lineno) )
+        return m_lineLengths[lineno];
+    else
+        return 0;
+}
+
+bool HistoryScrollBlockArray::isWrappedLine(int /*lineno*/)
+{
+  return false;
+}
+
+void HistoryScrollBlockArray::getCells(int lineno, int colno,
+                                       int count, Character res[])
+{
+  if (!count) return;
+
+  const Block *b = m_blockArray.at(lineno);
+
+  if (!b) {
+    memset(res, 0, count * sizeof(Character)); // still better than random data
+    return;
+  }
+
+  assert(((colno + count) * sizeof(Character)) < ENTRIES);
+  memcpy(res, b->data + (colno * sizeof(Character)), count * sizeof(Character));
+}
+
+void HistoryScrollBlockArray::addCells(const Character a[], int count)
+{
+  Block *b = m_blockArray.lastBlock();
+  
+  if (!b) return;
+
+  // put cells in block's data
+  assert((count * sizeof(Character)) < ENTRIES);
+
+  memset(b->data, 0, ENTRIES);
+
+  memcpy(b->data, a, count * sizeof(Character));
+  b->size = count * sizeof(Character);
+
+  size_t res = m_blockArray.newBlock();
+  assert (res > 0);
+  Q_UNUSED( res );
+
+  m_lineLengths.insert(m_blockArray.getCurrent(), count);
+}
+
+void HistoryScrollBlockArray::addLine(bool)
+{
+}
+
+//////////////////////////////////////////////////////////////////////
+// History Types
+//////////////////////////////////////////////////////////////////////
+
+HistoryType::HistoryType()
+{
+}
+
+HistoryType::~HistoryType()
+{
+}
+
+//////////////////////////////
+
+HistoryTypeNone::HistoryTypeNone()
+{
+}
+
+bool HistoryTypeNone::isEnabled() const
+{
+  return false;
+}
+
+HistoryScroll* HistoryTypeNone::scroll(HistoryScroll *old) const
+{
+  delete old;
+  return new HistoryScrollNone();
+}
+
+int HistoryTypeNone::maximumLineCount() const
+{
+  return 0;
+}
+
+//////////////////////////////
+
+HistoryTypeBlockArray::HistoryTypeBlockArray(size_t size)
+  : m_size(size)
+{
+}
+
+bool HistoryTypeBlockArray::isEnabled() const
+{
+  return true;
+}
+
+int HistoryTypeBlockArray::maximumLineCount() const
+{
+  return m_size;
+}
+
+HistoryScroll* HistoryTypeBlockArray::scroll(HistoryScroll *old) const
+{
+  delete old;
+  return new HistoryScrollBlockArray(m_size);
+}
+
+
+//////////////////////////////
+
+HistoryTypeBuffer::HistoryTypeBuffer(unsigned int nbLines)
+  : m_nbLines(nbLines)
+{
+}
+
+bool HistoryTypeBuffer::isEnabled() const
+{
+  return true;
+}
+
+int HistoryTypeBuffer::maximumLineCount() const
+{
+  return m_nbLines;
+}
+
+HistoryScroll* HistoryTypeBuffer::scroll(HistoryScroll *old) const
+{
+  if (old)
+  {
+    HistoryScrollBuffer *oldBuffer = dynamic_cast<HistoryScrollBuffer*>(old);
+    if (oldBuffer)
+    {
+       oldBuffer->setMaxNbLines(m_nbLines);
+       return oldBuffer;
+    }
+
+    HistoryScroll *newScroll = new HistoryScrollBuffer(m_nbLines);
+    int lines = old->getLines();
+    int startLine = 0;
+    if (lines > (int) m_nbLines)
+       startLine = lines - m_nbLines;
+
+    Character line[LINE_SIZE];
+    for(int i = startLine; i < lines; i++)
+    {
+       int size = old->getLineLen(i);
+       if (size > LINE_SIZE)
+       {
+          Character *tmp_line = new Character[size];
+          old->getCells(i, 0, size, tmp_line);
+          newScroll->addCells(tmp_line, size);
+          newScroll->addLine(old->isWrappedLine(i));
+          delete [] tmp_line;
+       }
+       else
+       {
+          old->getCells(i, 0, size, line);
+          newScroll->addCells(line, size);
+          newScroll->addLine(old->isWrappedLine(i));
+       }
+    }
+    delete old;
+    return newScroll;
+  }
+  return new HistoryScrollBuffer(m_nbLines);
+}
+
+//////////////////////////////
+
+HistoryTypeFile::HistoryTypeFile(const QString& fileName)
+  : m_fileName(fileName)
+{
+}
+
+bool HistoryTypeFile::isEnabled() const
+{
+  return true;
+}
+
+const QString& HistoryTypeFile::getFileName() const
+{
+  return m_fileName;
+}
+
+HistoryScroll* HistoryTypeFile::scroll(HistoryScroll *old) const
+{
+  if (dynamic_cast<HistoryFile *>(old)) 
+     return old; // Unchanged.
+
+  HistoryScroll *newScroll = new HistoryScrollFile(m_fileName);
+
+  Character line[LINE_SIZE];
+  int lines = (old != 0) ? old->getLines() : 0;
+  for(int i = 0; i < lines; i++)
+  {
+     int size = old->getLineLen(i);
+     if (size > LINE_SIZE)
+     {
+        Character *tmp_line = new Character[size];
+        old->getCells(i, 0, size, tmp_line);
+        newScroll->addCells(tmp_line, size);
+        newScroll->addLine(old->isWrappedLine(i));
+        delete [] tmp_line;
+     }
+     else
+     {
+        old->getCells(i, 0, size, line);
+        newScroll->addCells(line, size);
+        newScroll->addLine(old->isWrappedLine(i));
+     }
+  }
+
+  delete old;
+  return newScroll; 
+}
+
+int HistoryTypeFile::maximumLineCount() const
+{
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/History.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,344 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 TEHISTORY_H
+#define TEHISTORY_H
+
+// Qt
+#include <QtCore/QBitRef>
+#include <QtCore/QHash>
+#include <QtCore>
+
+// Konsole
+#include "BlockArray.h"
+#include "Character.h"
+
+namespace Konsole
+{
+
+#if 1
+/*
+   An extendable tmpfile(1) based buffer.
+*/
+
+class HistoryFile
+{
+public:
+  HistoryFile();
+  virtual ~HistoryFile();
+
+  virtual void add(const unsigned char* bytes, int len);
+  virtual void get(unsigned char* bytes, int len, int loc);
+  virtual int  len();
+
+  //mmaps the file in read-only mode
+  void map();
+  //un-mmaps the file
+  void unmap();
+  //returns true if the file is mmap'ed
+  bool isMapped();
+
+
+private:
+  int  ion;
+  int  length;
+  QTemporaryFile tmpFile;
+
+  //pointer to start of mmap'ed file data, or 0 if the file is not mmap'ed
+  char* fileMap;
+ 
+  //incremented whenver 'add' is called and decremented whenever
+  //'get' is called.
+  //this is used to detect when a large number of lines are being read and processed from the history
+  //and automatically mmap the file for better performance (saves the overhead of many lseek-read calls).
+  int readWriteBalance;
+
+  //when readWriteBalance goes below this threshold, the file will be mmap'ed automatically
+  static const int MAP_THRESHOLD = -1000;
+};
+#endif
+
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+// Abstract base class for file and buffer versions
+//////////////////////////////////////////////////////////////////////
+class HistoryType;
+
+class HistoryScroll
+{
+public:
+  HistoryScroll(HistoryType*);
+ virtual ~HistoryScroll();
+
+  virtual bool hasScroll();
+
+  // access to history
+  virtual int  getLines() = 0;
+  virtual int  getLineLen(int lineno) = 0;
+  virtual void getCells(int lineno, int colno, int count, Character res[]) = 0;
+  virtual bool isWrappedLine(int lineno) = 0;
+
+  // backward compatibility (obsolete)
+  Character   getCell(int lineno, int colno) { Character res; getCells(lineno,colno,1,&res); return res; }
+
+  // adding lines.
+  virtual void addCells(const Character a[], int count) = 0;
+  // convenience method - this is virtual so that subclasses can take advantage
+  // of QVector's implicit copying
+  virtual void addCellsVector(const QVector<Character>& cells)
+  {
+    addCells(cells.data(),cells.size());
+  }
+
+  virtual void addLine(bool previousWrapped=false) = 0;
+
+  //
+  // FIXME:  Passing around constant references to HistoryType instances
+  // is very unsafe, because those references will no longer
+  // be valid if the history scroll is deleted.
+  //
+  const HistoryType& getType() { return *m_histType; }
+
+protected:
+  HistoryType* m_histType;
+
+};
+
+#if 1
+
+//////////////////////////////////////////////////////////////////////
+// File-based history (e.g. file log, no limitation in length)
+//////////////////////////////////////////////////////////////////////
+
+class HistoryScrollFile : public HistoryScroll
+{
+public:
+  HistoryScrollFile(const QString &logFileName);
+  virtual ~HistoryScrollFile();
+
+  virtual int  getLines();
+  virtual int  getLineLen(int lineno);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
+  virtual bool isWrappedLine(int lineno);
+
+  virtual void addCells(const Character a[], int count);
+  virtual void addLine(bool previousWrapped=false);
+
+private:
+  int startOfLine(int lineno);
+
+  QString m_logFileName;
+  HistoryFile index; // lines Row(int)
+  HistoryFile cells; // text  Row(Character)
+  HistoryFile lineflags; // flags Row(unsigned char)
+};
+
+
+//////////////////////////////////////////////////////////////////////
+// Buffer-based history (limited to a fixed nb of lines)
+//////////////////////////////////////////////////////////////////////
+class HistoryScrollBuffer : public HistoryScroll
+{
+public:
+  typedef QVector<Character> HistoryLine;
+
+  HistoryScrollBuffer(unsigned int maxNbLines = 1000);
+  virtual ~HistoryScrollBuffer();
+
+  virtual int  getLines();
+  virtual int  getLineLen(int lineno);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
+  virtual bool isWrappedLine(int lineno);
+
+  virtual void addCells(const Character a[], int count);
+  virtual void addCellsVector(const QVector<Character>& cells);
+  virtual void addLine(bool previousWrapped=false);
+
+  void setMaxNbLines(unsigned int nbLines);
+  unsigned int maxNbLines() { return _maxLineCount; }
+  
+
+private:
+  int bufferIndex(int lineNumber);
+
+  HistoryLine* _historyBuffer;
+  QBitArray _wrappedLine;
+  int _maxLineCount;
+  int _usedLines;  
+  int _head;
+  
+  //QVector<histline*> m_histBuffer;
+  //QBitArray m_wrappedLine;
+  //unsigned int m_maxNbLines;
+  //unsigned int m_nbLines;
+  //unsigned int m_arrayIndex;
+  //bool         m_buffFilled;
+};
+
+/*class HistoryScrollBufferV2 : public HistoryScroll
+{
+public:
+  virtual int  getLines();
+  virtual int  getLineLen(int lineno);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
+  virtual bool isWrappedLine(int lineno);
+
+  virtual void addCells(const Character a[], int count);
+  virtual void addCells(const QVector<Character>& cells);
+  virtual void addLine(bool previousWrapped=false);
+
+};*/
+
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Nothing-based history (no history :-)
+//////////////////////////////////////////////////////////////////////
+class HistoryScrollNone : public HistoryScroll
+{
+public:
+  HistoryScrollNone();
+  virtual ~HistoryScrollNone();
+
+  virtual bool hasScroll();
+
+  virtual int  getLines();
+  virtual int  getLineLen(int lineno);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
+  virtual bool isWrappedLine(int lineno);
+
+  virtual void addCells(const Character a[], int count);
+  virtual void addLine(bool previousWrapped=false);
+};
+
+//////////////////////////////////////////////////////////////////////
+// BlockArray-based history
+//////////////////////////////////////////////////////////////////////
+class HistoryScrollBlockArray : public HistoryScroll
+{
+public:
+  HistoryScrollBlockArray(size_t size);
+  virtual ~HistoryScrollBlockArray();
+
+  virtual int  getLines();
+  virtual int  getLineLen(int lineno);
+  virtual void getCells(int lineno, int colno, int count, Character res[]);
+  virtual bool isWrappedLine(int lineno);
+
+  virtual void addCells(const Character a[], int count);
+  virtual void addLine(bool previousWrapped=false);
+
+protected:
+  BlockArray m_blockArray;
+  QHash<int,size_t> m_lineLengths;
+};
+
+//////////////////////////////////////////////////////////////////////
+// History type
+//////////////////////////////////////////////////////////////////////
+
+class HistoryType
+{
+public:
+  HistoryType();
+  virtual ~HistoryType();
+
+  /**
+   * Returns true if the history is enabled ( can store lines of output )
+   * or false otherwise. 
+   */
+  virtual bool isEnabled()           const = 0;
+  /**
+   * Returns true if the history size is unlimited.
+   */
+  bool isUnlimited() const { return maximumLineCount() == 0; }
+  /**
+   * Returns the maximum number of lines which this history type
+   * can store or 0 if the history can store an unlimited number of lines.
+   */
+  virtual int maximumLineCount()    const = 0;
+
+  virtual HistoryScroll* scroll(HistoryScroll *) const = 0;
+};
+
+class HistoryTypeNone : public HistoryType
+{
+public:
+  HistoryTypeNone();
+
+  virtual bool isEnabled() const;
+  virtual int maximumLineCount() const;
+
+  virtual HistoryScroll* scroll(HistoryScroll *) const;
+};
+
+class HistoryTypeBlockArray : public HistoryType
+{
+public:
+  HistoryTypeBlockArray(size_t size);
+  
+  virtual bool isEnabled() const;
+  virtual int maximumLineCount() const;
+
+  virtual HistoryScroll* scroll(HistoryScroll *) const;
+
+protected:
+  size_t m_size;
+};
+
+#if 1 
+class HistoryTypeFile : public HistoryType
+{
+public:
+  HistoryTypeFile(const QString& fileName=QString());
+
+  virtual bool isEnabled() const;
+  virtual const QString& getFileName() const;
+  virtual int maximumLineCount() const;
+
+  virtual HistoryScroll* scroll(HistoryScroll *) const;
+
+protected:
+  QString m_fileName;
+};
+
+
+class HistoryTypeBuffer : public HistoryType
+{
+public:
+  HistoryTypeBuffer(unsigned int nbLines);
+  
+  virtual bool isEnabled() const;
+  virtual int maximumLineCount() const;
+
+  virtual HistoryScroll* scroll(HistoryScroll *) const;
+
+protected:
+  unsigned int m_nbLines;
+};
+
+#endif
+
+}
+
+#endif // TEHISTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/KeyboardTranslator.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,903 @@
+/*
+    This source file was part of Konsole, a terminal emulator.
+
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "KeyboardTranslator.h"
+
+// System
+#include <ctype.h>
+#include <stdio.h>
+
+// Qt
+#include <QtCore/QBuffer>
+//#include <KDebug>
+#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtCore>
+#include <QtGui>
+
+// KDE
+//#include <KDebug>
+//#include <KLocale>
+//#include <KStandardDirs>
+
+using namespace Konsole;
+
+//this is for default REALLY fallback translator.
+
+//const char* KeyboardTranslatorManager::defaultTranslatorText =
+//#include "DefaultTranslatorText.h"
+//;
+
+//and this is default now translator - default.keytab from original Konsole
+const char* KeyboardTranslatorManager::defaultTranslatorText = 
+#include "ExtendedDefaultTranslator.h"
+;
+
+KeyboardTranslatorManager::KeyboardTranslatorManager()
+    : _haveLoadedAll(false)
+{
+}
+KeyboardTranslatorManager::~KeyboardTranslatorManager()
+{
+    qDeleteAll(_translators.values());
+}
+QString KeyboardTranslatorManager::findTranslatorPath(const QString& name)
+{
+    return QString("kb-layouts/" + name + ".keytab");
+}
+void KeyboardTranslatorManager::findTranslators()
+{
+    QDir dir("kb-layouts/");
+    QStringList filters;
+    filters << "*.keytab";
+    dir.setNameFilters(filters);
+    QStringList list = dir.entryList(filters); //(".keytab"); // = KGlobal::dirs()->findAllResources("data",
+                        //                                 "konsole/*.keytab",
+                        //                                 KStandardDirs::NoDuplicates);
+    list = dir.entryList(filters);
+    // add the name of each translator to the list and associated
+    // the name with a null pointer to indicate that the translator
+    // has not yet been loaded from disk
+    QStringListIterator listIter(list);
+    while (listIter.hasNext())
+    {
+        QString translatorPath = listIter.next();
+
+        QString name = QFileInfo(translatorPath).baseName();
+       
+        if ( !_translators.contains(name) ) {
+            _translators.insert(name,0);
+	}
+    }
+    _haveLoadedAll = true;
+}
+
+const KeyboardTranslator* KeyboardTranslatorManager::findTranslator(const QString& name)
+{
+    if ( name.isEmpty() )
+        return defaultTranslator();
+
+//here was smth wrong in original Konsole source 
+    findTranslators();
+
+    if ( _translators.contains(name) && _translators[name] != 0 ) {
+        return _translators[name];
+    }
+
+    KeyboardTranslator* translator = loadTranslator(name);
+
+    if ( translator != 0 )
+        _translators[name] = translator;
+    else if ( !name.isEmpty() )
+        qWarning() << "Unable to load translator" << name;
+
+    return translator;
+}
+
+bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* translator)
+{
+    const QString path = ".keytab";// = KGlobal::dirs()->saveLocation("data","konsole/")+translator->name()
+//           +".keytab";
+
+    qDebug() << "Saving translator to" << path;
+
+    QFile destination(path);
+    
+    if (!destination.open(QIODevice::WriteOnly | QIODevice::Text))
+    {
+        qWarning() << "Unable to save keyboard translation:" 
+                   << destination.errorString();
+
+        return false;
+    }
+
+    {
+        KeyboardTranslatorWriter writer(&destination);
+        writer.writeHeader(translator->description());
+    
+        QListIterator<KeyboardTranslator::Entry> iter(translator->entries());
+        while ( iter.hasNext() )
+            writer.writeEntry(iter.next());
+    }
+
+    destination.close();
+
+    return true;
+}
+
+KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(const QString& name)
+{
+    const QString& path = findTranslatorPath(name);
+
+    QFile source(path); 
+    
+    if (name.isEmpty() || !source.open(QIODevice::ReadOnly | QIODevice::Text))
+        return 0;
+
+    return loadTranslator(&source,name);
+}
+
+const KeyboardTranslator* KeyboardTranslatorManager::defaultTranslator()
+{
+    qDebug() << "Loading default translator from text";
+    QBuffer textBuffer;
+    textBuffer.setData(defaultTranslatorText,strlen(defaultTranslatorText));
+
+    if (!textBuffer.open(QIODevice::ReadOnly))
+        return 0;
+
+    return loadTranslator(&textBuffer,"fallback");
+}
+
+KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(QIODevice* source,const QString& name)
+{
+    KeyboardTranslator* translator = new KeyboardTranslator(name);
+    KeyboardTranslatorReader reader(source);
+    translator->setDescription( reader.description() );
+    
+    while ( reader.hasNextEntry() ) {
+        translator->addEntry(reader.nextEntry());
+    }	
+
+    source->close();
+
+    if ( !reader.parseError() )
+    {
+        return translator;
+    }
+    else
+    {
+        delete translator;
+        return 0;
+    }
+}
+
+KeyboardTranslatorWriter::KeyboardTranslatorWriter(QIODevice* destination)
+: _destination(destination)
+{
+    Q_ASSERT( destination && destination->isWritable() );
+
+    _writer = new QTextStream(_destination);
+}
+KeyboardTranslatorWriter::~KeyboardTranslatorWriter()
+{
+    delete _writer;
+}
+void KeyboardTranslatorWriter::writeHeader( const QString& description )
+{
+    *_writer << "keyboard \"" << description << '\"' << '\n';
+}
+void KeyboardTranslatorWriter::writeEntry( const KeyboardTranslator::Entry& entry )
+{
+    QString result;
+
+    if ( entry.command() != KeyboardTranslator::NoCommand )
+        result = entry.resultToString();
+    else
+        result = '\"' + entry.resultToString() + '\"';
+
+    *_writer << "key " << entry.conditionToString() << " : " << result << '\n';
+}
+
+
+// each line of the keyboard translation file is one of:
+//
+// - keyboard "name"
+// - key KeySequence : "characters"
+// - key KeySequence : CommandName
+//
+// KeySequence begins with the name of the key ( taken from the Qt::Key enum )
+// and is followed by the keyboard modifiers and state flags ( with + or - in front
+// of each modifier or flag to indicate whether it is required ).  All keyboard modifiers
+// and flags are optional, if a particular modifier or state is not specified it is 
+// assumed not to be a part of the sequence.  The key sequence may contain whitespace
+//
+// eg:  "key Up+Shift : scrollLineUp"
+//      "key Next-Shift : "\E[6~"
+//
+// (lines containing only whitespace are ignored, parseLine assumes that comments have
+// already been removed)
+//
+
+KeyboardTranslatorReader::KeyboardTranslatorReader( QIODevice* source )
+    : _source(source)
+    , _hasNext(false)
+{
+   // read input until we find the description
+   while ( _description.isEmpty() && !source->atEnd() )
+   {
+        const QList<Token>& tokens = tokenize( QString(source->readLine()) );
+   
+        if ( !tokens.isEmpty() && tokens.first().type == Token::TitleKeyword )
+        {
+            _description = (tokens[1].text.toUtf8());
+        }
+   }
+
+   readNext();
+}
+void KeyboardTranslatorReader::readNext() 
+{
+    // find next entry
+    while ( !_source->atEnd() )
+    {
+        const QList<Token>& tokens = tokenize( QString(_source->readLine()) );
+        if ( !tokens.isEmpty() && tokens.first().type == Token::KeyKeyword )
+        {
+            KeyboardTranslator::States flags = KeyboardTranslator::NoState;
+            KeyboardTranslator::States flagMask = KeyboardTranslator::NoState;
+            Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+            Qt::KeyboardModifiers modifierMask = Qt::NoModifier;
+
+            int keyCode = Qt::Key_unknown;
+
+            decodeSequence(tokens[1].text.toLower(),
+                           keyCode,
+                           modifiers,
+                           modifierMask,
+                           flags,
+                           flagMask); 
+
+            KeyboardTranslator::Command command = KeyboardTranslator::NoCommand;
+            QByteArray text;
+
+            // get text or command
+            if ( tokens[2].type == Token::OutputText )
+            {
+                text = tokens[2].text.toLocal8Bit();
+            }
+            else if ( tokens[2].type == Token::Command )
+            {
+                // identify command
+				if (!parseAsCommand(tokens[2].text,command))
+					qWarning() << "Command" << tokens[2].text << "not understood.";
+            }
+
+            KeyboardTranslator::Entry newEntry;
+            newEntry.setKeyCode( keyCode );
+            newEntry.setState( flags );
+            newEntry.setStateMask( flagMask );
+            newEntry.setModifiers( modifiers );
+            newEntry.setModifierMask( modifierMask );
+            newEntry.setText( text );
+            newEntry.setCommand( command );
+
+            _nextEntry = newEntry;
+
+            _hasNext = true;
+
+            return;
+        }
+    } 
+
+    _hasNext = false;
+}
+
+bool KeyboardTranslatorReader::parseAsCommand(const QString& text,KeyboardTranslator::Command& command) 
+{
+	if ( text.compare("erase",Qt::CaseInsensitive) == 0 )
+		command = KeyboardTranslator::EraseCommand;
+    else if ( text.compare("scrollpageup",Qt::CaseInsensitive) == 0 )
+        command = KeyboardTranslator::ScrollPageUpCommand;
+    else if ( text.compare("scrollpagedown",Qt::CaseInsensitive) == 0 )
+        command = KeyboardTranslator::ScrollPageDownCommand;
+    else if ( text.compare("scrolllineup",Qt::CaseInsensitive) == 0 )
+        command = KeyboardTranslator::ScrollLineUpCommand;
+    else if ( text.compare("scrolllinedown",Qt::CaseInsensitive) == 0 )
+        command = KeyboardTranslator::ScrollLineDownCommand;
+    else if ( text.compare("scrolllock",Qt::CaseInsensitive) == 0 )
+        command = KeyboardTranslator::ScrollLockCommand;
+    else
+    	return false;
+
+	return true;
+}
+
+bool KeyboardTranslatorReader::decodeSequence(const QString& text,
+                                              int& keyCode,
+                                              Qt::KeyboardModifiers& modifiers,
+                                              Qt::KeyboardModifiers& modifierMask,
+                                              KeyboardTranslator::States& flags,
+                                              KeyboardTranslator::States& flagMask)
+{
+    bool isWanted = true; 
+    bool endOfItem = false;
+    QString buffer;
+
+    Qt::KeyboardModifiers tempModifiers = modifiers;
+    Qt::KeyboardModifiers tempModifierMask = modifierMask;
+    KeyboardTranslator::States tempFlags = flags;
+    KeyboardTranslator::States tempFlagMask = flagMask;
+
+    for ( int i = 0 ; i < text.count() ; i++ )
+    {
+        const QChar& ch = text[i];
+        bool isLastLetter = ( i == text.count()-1 );
+
+        endOfItem = true;
+        if ( ch.isLetterOrNumber() )
+        {
+            endOfItem = false;
+            buffer.append(ch);
+        }
+
+        if ( (endOfItem || isLastLetter) && !buffer.isEmpty() )
+        {
+            Qt::KeyboardModifier itemModifier = Qt::NoModifier;
+            int itemKeyCode = 0;
+            KeyboardTranslator::State itemFlag = KeyboardTranslator::NoState;
+
+            if ( parseAsModifier(buffer,itemModifier) )
+            {
+                tempModifierMask |= itemModifier;
+
+                if ( isWanted )
+                    tempModifiers |= itemModifier;
+            }
+            else if ( parseAsStateFlag(buffer,itemFlag) )
+            {
+                tempFlagMask |= itemFlag;
+
+                if ( isWanted )
+                    tempFlags |= itemFlag;
+            }
+            else if ( parseAsKeyCode(buffer,itemKeyCode) )
+                keyCode = itemKeyCode;
+            else
+                qDebug() << "Unable to parse key binding item:" << buffer;
+
+            buffer.clear();
+        }
+
+        // check if this is a wanted / not-wanted flag and update the 
+        // state ready for the next item
+        if ( ch == '+' )
+           isWanted = true;
+        else if ( ch == '-' )
+           isWanted = false; 
+    } 
+
+    modifiers = tempModifiers;
+    modifierMask = tempModifierMask;
+    flags = tempFlags;
+    flagMask = tempFlagMask;
+
+    return true;
+}
+
+bool KeyboardTranslatorReader::parseAsModifier(const QString& item , Qt::KeyboardModifier& modifier)
+{
+    if ( item == "shift" )
+        modifier = Qt::ShiftModifier;
+    else if ( item == "ctrl" || item == "control" )
+        modifier = Qt::ControlModifier;
+    else if ( item == "alt" )
+        modifier = Qt::AltModifier;
+    else if ( item == "meta" )
+        modifier = Qt::MetaModifier;
+	else if ( item == "keypad" )
+		modifier = Qt::KeypadModifier;
+    else
+        return false;
+
+    return true;
+}
+bool KeyboardTranslatorReader::parseAsStateFlag(const QString& item , KeyboardTranslator::State& flag)
+{
+    if ( item == "appcukeys" )
+        flag = KeyboardTranslator::CursorKeysState;
+    else if ( item == "ansi" )
+        flag = KeyboardTranslator::AnsiState;
+    else if ( item == "newline" )
+        flag = KeyboardTranslator::NewLineState;
+    else if ( item == "appscreen" )
+        flag = KeyboardTranslator::AlternateScreenState;
+    else if ( item == "anymod" )
+        flag = KeyboardTranslator::AnyModifierState;
+    else
+        return false;
+
+    return true;
+}
+bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode)
+{
+    QKeySequence sequence = QKeySequence::fromString(item);
+    if ( !sequence.isEmpty() )
+    {
+        keyCode = sequence[0];
+
+        if ( sequence.count() > 1 )
+        {
+            qDebug() << "Unhandled key codes in sequence: " << item;
+        }
+    }
+    // additional cases implemented for backwards compatibility with KDE 3
+    else if ( item == "prior" )
+        keyCode = Qt::Key_PageUp;
+    else if ( item == "next" )
+        keyCode = Qt::Key_PageDown;
+    else
+        return false;
+
+    return true;
+}
+
+QString KeyboardTranslatorReader::description() const
+{
+    return _description;
+}
+bool KeyboardTranslatorReader::hasNextEntry()
+{
+    return _hasNext;
+}
+KeyboardTranslator::Entry KeyboardTranslatorReader::createEntry( const QString& condition , 
+                                                                 const QString& result )
+{
+    QString entryString("keyboard \"temporary\"\nkey ");
+    entryString.append(condition);
+    entryString.append(" : ");
+
+	// if 'result' is the name of a command then the entry result will be that command,
+	// otherwise the result will be treated as a string to echo when the key sequence
+	// specified by 'condition' is pressed
+	KeyboardTranslator::Command command;
+	if (parseAsCommand(result,command))
+    	entryString.append(result);
+	else
+		entryString.append('\"' + result + '\"');
+
+    QByteArray array = entryString.toUtf8();
+
+    KeyboardTranslator::Entry entry;
+
+    QBuffer buffer(&array);
+    buffer.open(QIODevice::ReadOnly);
+    KeyboardTranslatorReader reader(&buffer);
+
+    if ( reader.hasNextEntry() )
+        entry = reader.nextEntry();
+
+    return entry;
+}
+
+KeyboardTranslator::Entry KeyboardTranslatorReader::nextEntry() 
+{
+    Q_ASSERT( _hasNext );
+
+
+    KeyboardTranslator::Entry entry = _nextEntry;
+
+    readNext();
+
+    return entry;
+}
+bool KeyboardTranslatorReader::parseError()
+{
+    return false;
+}
+QList<KeyboardTranslatorReader::Token> KeyboardTranslatorReader::tokenize(const QString& line)
+{
+    QString text = line.simplified();
+
+    // comment line: # comment
+    static QRegExp comment("\\#.*");
+    // title line: keyboard "title"
+    static QRegExp title("keyboard\\s+\"(.*)\"");
+    // key line: key KeySequence : "output"
+    // key line: key KeySequence : command
+    static QRegExp key("key\\s+([\\w\\+\\s\\-]+)\\s*:\\s*(\"(.*)\"|\\w+)");
+
+    QList<Token> list;
+
+    if ( text.isEmpty() || comment.exactMatch(text) )
+    {
+        return list;
+    }
+
+    if ( title.exactMatch(text) )
+    {
+        Token titleToken = { Token::TitleKeyword , QString() };
+        Token textToken = { Token::TitleText , title.capturedTexts()[1] };
+    
+        list << titleToken << textToken;
+    }
+    else if  ( key.exactMatch(text) )
+    {
+        Token keyToken = { Token::KeyKeyword , QString() };
+        Token sequenceToken = { Token::KeySequence , key.capturedTexts()[1].remove(' ') };
+
+        list << keyToken << sequenceToken;
+
+        if ( key.capturedTexts()[3].isEmpty() )
+        {
+            // capturedTexts()[2] is a command
+            Token commandToken = { Token::Command , key.capturedTexts()[2] };
+            list << commandToken;    
+        }   
+        else
+        {
+            // capturedTexts()[3] is the output string
+           Token outputToken = { Token::OutputText , key.capturedTexts()[3] };
+           list << outputToken;
+        }     
+    }
+    else
+    {
+        qWarning() << "Line in keyboard translator file could not be understood:" << text;
+    }
+
+    return list;
+}
+
+QList<QString> KeyboardTranslatorManager::allTranslators() 
+{
+    if ( !_haveLoadedAll )
+    {
+        findTranslators();
+    }
+
+    return _translators.keys();
+}
+
+KeyboardTranslator::Entry::Entry()
+: _keyCode(0)
+, _modifiers(Qt::NoModifier)
+, _modifierMask(Qt::NoModifier)
+, _state(NoState)
+, _stateMask(NoState)
+, _command(NoCommand)
+{
+}
+
+bool KeyboardTranslator::Entry::operator==(const Entry& rhs) const
+{
+    return _keyCode == rhs._keyCode &&
+           _modifiers == rhs._modifiers &&
+           _modifierMask == rhs._modifierMask &&
+           _state == rhs._state &&
+           _stateMask == rhs._stateMask &&
+           _command == rhs._command &&
+           _text == rhs._text;
+}
+
+bool KeyboardTranslator::Entry::matches(int keyCode , 
+                                        Qt::KeyboardModifiers modifiers,
+                                        States state) const
+{
+    if ( _keyCode != keyCode )
+        return false;
+
+    if ( (modifiers & _modifierMask) != (_modifiers & _modifierMask) ) 
+        return false;
+
+    // if modifiers is non-zero, the 'any modifier' state is implicit
+    if ( modifiers != 0 )
+        state |= AnyModifierState;
+
+    if ( (state & _stateMask) != (_state & _stateMask) )
+        return false;
+
+    // special handling for the 'Any Modifier' state, which checks for the presence of 
+    // any or no modifiers.  In this context, the 'keypad' modifier does not count.
+    bool anyModifiersSet = modifiers != 0 && modifiers != Qt::KeypadModifier;
+    if ( _stateMask & KeyboardTranslator::AnyModifierState )
+    {
+        // test fails if any modifier is required but none are set
+        if ( (_state & KeyboardTranslator::AnyModifierState) && !anyModifiersSet )
+           return false;
+
+        // test fails if no modifier is allowed but one or more are set
+        if ( !(_state & KeyboardTranslator::AnyModifierState) && anyModifiersSet )
+            return false;
+    }
+
+    return true;
+}
+QByteArray KeyboardTranslator::Entry::escapedText(bool expandWildCards,Qt::KeyboardModifiers modifiers) const
+{
+    QByteArray result(text(expandWildCards,modifiers));
+
+    for ( int i = 0 ; i < result.count() ; i++ )
+    {
+        char ch = result[i];
+        char replacement = 0;
+
+        switch ( ch )
+        {
+            case 27 : replacement = 'E'; break;
+            case 8  : replacement = 'b'; break;
+            case 12 : replacement = 'f'; break;
+            case 9  : replacement = 't'; break;
+            case 13 : replacement = 'r'; break;
+            case 10 : replacement = 'n'; break;
+            default:
+                // any character which is not printable is replaced by an equivalent
+                // \xhh escape sequence (where 'hh' are the corresponding hex digits)
+                if ( !QChar(ch).isPrint() )
+                    replacement = 'x';
+        }
+
+        if ( replacement == 'x' )
+        {
+            result.replace(i,1,"\\x"+QByteArray(1,ch).toInt(0, 16)); 
+        } else if ( replacement != 0 )
+        {
+            result.remove(i,1);
+            result.insert(i,'\\');
+            result.insert(i+1,replacement);
+        }
+    }
+
+    return result;
+}
+QByteArray KeyboardTranslator::Entry::unescape(const QByteArray& input) const
+{
+    QByteArray result(input);
+
+    for ( int i = 0 ; i < result.count()-1 ; i++ )
+    {
+
+        QByteRef ch = result[i];
+        if ( ch == '\\' )
+        {
+           char replacement[2] = {0,0};
+           int charsToRemove = 2;
+		   bool escapedChar = true;
+
+           switch ( result[i+1] )
+           {
+              case 'E' : replacement[0] = 27; break;
+              case 'b' : replacement[0] = 8 ; break;
+              case 'f' : replacement[0] = 12; break;
+              case 't' : replacement[0] = 9 ; break;
+              case 'r' : replacement[0] = 13; break;
+              case 'n' : replacement[0] = 10; break;
+              case 'x' :
+			  {
+                    // format is \xh or \xhh where 'h' is a hexadecimal
+                    // digit from 0-9 or A-F which should be replaced
+                    // with the corresponding character value
+                    char hexDigits[3] = {0};
+
+                    if ( (i < result.count()-2) && isxdigit(result[i+2]) )
+                            hexDigits[0] = result[i+2];
+                    if ( (i < result.count()-3) && isxdigit(result[i+3]) )
+                            hexDigits[1] = result[i+3];
+
+                    int charValue = 0;
+                    sscanf(hexDigits,"%x",&charValue);
+                    
+                    replacement[0] = (char)charValue; 
+
+                    charsToRemove = 2 + strlen(hexDigits);
+			  }
+              break;
+			  default:
+			  		escapedChar = false;
+           }
+
+           if ( escapedChar )
+               result.replace(i,charsToRemove,replacement);
+        }
+    }
+    
+    return result;
+}
+
+void KeyboardTranslator::Entry::insertModifier( QString& item , int modifier ) const
+{
+    if ( !(modifier & _modifierMask) )
+        return;
+
+    if ( modifier & _modifiers )
+        item += '+';
+    else
+        item += '-';
+
+    if ( modifier == Qt::ShiftModifier )
+        item += "Shift";
+    else if ( modifier == Qt::ControlModifier )
+        item += "Ctrl";
+    else if ( modifier == Qt::AltModifier )
+        item += "Alt";
+    else if ( modifier == Qt::MetaModifier )
+        item += "Meta";
+	else if ( modifier == Qt::KeypadModifier )
+		item += "KeyPad";
+}
+void KeyboardTranslator::Entry::insertState( QString& item , int state ) const
+{
+    if ( !(state & _stateMask) )
+        return;
+
+    if ( state & _state )
+        item += '+' ;
+    else
+        item += '-' ;
+
+    if ( state == KeyboardTranslator::AlternateScreenState )
+        item += "AppScreen";
+    else if ( state == KeyboardTranslator::NewLineState )
+        item += "NewLine";
+    else if ( state == KeyboardTranslator::AnsiState )
+        item += "Ansi";
+    else if ( state == KeyboardTranslator::CursorKeysState )
+        item += "AppCuKeys";
+    else if ( state == KeyboardTranslator::AnyModifierState )
+        item += "AnyMod";
+}
+QString KeyboardTranslator::Entry::resultToString(bool expandWildCards,Qt::KeyboardModifiers modifiers) const
+{
+    if ( !_text.isEmpty() )
+        return escapedText(expandWildCards,modifiers);
+	else if ( _command == EraseCommand )
+		return "Erase";
+    else if ( _command == ScrollPageUpCommand )
+        return "ScrollPageUp";
+    else if ( _command == ScrollPageDownCommand )
+        return "ScrollPageDown";
+    else if ( _command == ScrollLineUpCommand )
+        return "ScrollLineUp";
+    else if ( _command == ScrollLineDownCommand )
+        return "ScrollLineDown";
+    else if ( _command == ScrollLockCommand )
+        return "ScrollLock";
+
+    return QString();
+}
+QString KeyboardTranslator::Entry::conditionToString() const
+{
+    QString result = QKeySequence(_keyCode).toString();
+
+    // add modifiers
+    insertModifier( result , Qt::ShiftModifier );
+    insertModifier( result , Qt::ControlModifier );
+    insertModifier( result , Qt::AltModifier );
+    insertModifier( result , Qt::MetaModifier ); 
+
+    // add states
+    insertState( result , KeyboardTranslator::AlternateScreenState );
+    insertState( result , KeyboardTranslator::NewLineState );
+    insertState( result , KeyboardTranslator::AnsiState );
+    insertState( result , KeyboardTranslator::CursorKeysState );
+    insertState( result , KeyboardTranslator::AnyModifierState );
+
+    return result;
+}
+
+KeyboardTranslator::KeyboardTranslator(const QString& name)
+: _name(name)
+{
+}
+
+void KeyboardTranslator::setDescription(const QString& description) 
+{
+    _description = description;
+}
+QString KeyboardTranslator::description() const
+{
+    return _description;
+}
+void KeyboardTranslator::setName(const QString& name)
+{
+    _name = name;
+}
+QString KeyboardTranslator::name() const
+{
+    return _name;
+}
+
+QList<KeyboardTranslator::Entry> KeyboardTranslator::entries() const
+{
+    return _entries.values();
+}
+
+void KeyboardTranslator::addEntry(const Entry& entry)
+{
+    const int keyCode = entry.keyCode();
+    _entries.insertMulti(keyCode,entry);
+}
+void KeyboardTranslator::replaceEntry(const Entry& existing , const Entry& replacement)
+{
+    if ( !existing.isNull() )
+        _entries.remove(existing.keyCode());
+    _entries.insertMulti(replacement.keyCode(),replacement);
+}
+void KeyboardTranslator::removeEntry(const Entry& entry)
+{
+    _entries.remove(entry.keyCode());
+}
+KeyboardTranslator::Entry KeyboardTranslator::findEntry(int keyCode, Qt::KeyboardModifiers modifiers, States state) const
+{
+    if ( _entries.contains(keyCode) )
+    {
+        QList<Entry> entriesForKey = _entries.values(keyCode);
+        
+        QListIterator<Entry> iter(entriesForKey);
+
+        while (iter.hasNext())
+        {
+            const Entry& next = iter.next();
+            if ( next.matches(keyCode,modifiers,state) )
+                return next;
+        }
+
+        return Entry(); // entry not found
+    }
+    else
+    {
+        return Entry();
+    }
+    
+}
+void KeyboardTranslatorManager::addTranslator(KeyboardTranslator* translator)
+{
+    _translators.insert(translator->name(),translator);
+
+    if ( !saveTranslator(translator) )
+        qWarning() << "Unable to save translator" << translator->name()
+                   << "to disk.";
+}
+bool KeyboardTranslatorManager::deleteTranslator(const QString& name)
+{
+    Q_ASSERT( _translators.contains(name) );
+
+    // locate and delete
+    QString path = findTranslatorPath(name);
+    if ( QFile::remove(path) )
+    {
+        _translators.remove(name);
+        return true; 
+    }
+    else
+    {
+        qWarning() << "Failed to remove translator - " << path;
+        return false;
+    }
+}
+K_GLOBAL_STATIC( KeyboardTranslatorManager , theKeyboardTranslatorManager )
+KeyboardTranslatorManager* KeyboardTranslatorManager::instance()
+{
+    return theKeyboardTranslatorManager;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/KeyboardTranslator.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,657 @@
+/*
+    This source file is part of Konsole, a terminal emulator.
+
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 KEYBOARDTRANSLATOR_H
+#define KEYBOARDTRANSLATOR_H
+
+// Qt
+#include <QtCore/QHash>
+#include <QtCore/QList>
+#include <QtGui/QKeySequence>
+#include <QtCore/QMetaType>
+#include <QtCore/QVarLengthArray>
+#include <QtCore>
+
+typedef void (*CleanUpFunction)();
+
+/**
+ * @internal
+ *
+ * Helper class for K_GLOBAL_STATIC to clean up the object on library unload or application
+ * shutdown.
+ */
+class CleanUpGlobalStatic
+{
+    public:
+        CleanUpFunction func;
+
+        inline ~CleanUpGlobalStatic() { func(); }
+};
+
+
+//these directives are taken from the heart of kdecore
+
+# define K_GLOBAL_STATIC_STRUCT_NAME(NAME)
+
+#if QT_VERSION < 0x040400
+# define Q_BASIC_ATOMIC_INITIALIZER     Q_ATOMIC_INIT
+# define testAndSetOrdered              testAndSet
+#endif
+
+#define K_GLOBAL_STATIC(TYPE, NAME) K_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())
+
+#define K_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)                            \
+static QBasicAtomicPointer<TYPE > _k_static_##NAME = Q_BASIC_ATOMIC_INITIALIZER(0); \
+static bool _k_static_##NAME##_destroyed;                                      \
+static struct K_GLOBAL_STATIC_STRUCT_NAME(NAME)                                \
+{                                                                              \
+    bool isDestroyed()                                                         \
+    {                                                                          \
+        return _k_static_##NAME##_destroyed;                                   \
+    }                                                                          \
+    inline operator TYPE*()                                                    \
+    {                                                                          \
+        return operator->();                                                   \
+    }                                                                          \
+    inline TYPE *operator->()                                                  \
+    {                                                                          \
+        if (!_k_static_##NAME) {                                               \
+            if (isDestroyed()) {                                               \
+            qFatal("Fatal Error: Accessed global static '%s *%s()' after destruction. " \
+             "Defined at %s:%d", #TYPE, #NAME, __FILE__, __LINE__);		\
+	     }                                                                  \
+	     TYPE *x = new TYPE ARGS;                                           \
+	     if (!_k_static_##NAME.testAndSetOrdered(0, x)                      \
+	         && _k_static_##NAME != x ) {                                   \
+	         delete x;                                                      \
+	     } else { 								\
+		static CleanUpGlobalStatic cleanUpObject = { destroy };	\
+	     }   								\
+	 }                                                                      \
+         return _k_static_##NAME;                                               \
+    }            								\
+    inline TYPE &operator*()                                                   \
+    {                                                                          \
+        return *operator->();                                                  \
+    }                                                                          \
+    static void destroy()                                                      \
+    {                                                                          \
+        _k_static_##NAME##_destroyed = true;                                   \
+        TYPE *x = _k_static_##NAME;                                            \
+        _k_static_##NAME = 0;                                                  \
+        delete x;                                                              \
+    }                                                                          \
+} NAME;
+								
+								
+
+
+
+class QIODevice;
+class QTextStream;
+
+namespace Konsole
+{
+
+/** 
+ * A convertor which maps between key sequences pressed by the user and the
+ * character strings which should be sent to the terminal and commands
+ * which should be invoked when those character sequences are pressed.
+ *
+ * Konsole supports multiple keyboard translators, allowing the user to
+ * specify the character sequences which are sent to the terminal
+ * when particular key sequences are pressed.
+ *
+ * A key sequence is defined as a key code, associated keyboard modifiers
+ * (Shift,Ctrl,Alt,Meta etc.) and state flags which indicate the state
+ * which the terminal must be in for the key sequence to apply.
+ */
+class KeyboardTranslator
+{
+public:
+    /** 
+     * The meaning of a particular key sequence may depend upon the state which
+     * the terminal emulation is in.  Therefore findEntry() may return a different
+     * Entry depending upon the state flags supplied.
+     *
+     * This enum describes the states which may be associated with with a particular
+     * entry in the keyboard translation entry.
+     */
+    enum State
+    {
+        /** Indicates that no special state is active */
+        NoState = 0,
+        /**
+         * TODO More documentation
+         */
+        NewLineState = 1,
+        /** 
+         * Indicates that the terminal is in 'Ansi' mode.
+         * TODO: More documentation
+         */
+        AnsiState = 2,
+        /**
+         * TODO More documentation
+         */
+        CursorKeysState = 4,
+        /**
+         * Indicates that the alternate screen ( typically used by interactive programs
+         * such as screen or vim ) is active 
+         */
+        AlternateScreenState = 8,
+        /** Indicates that any of the modifier keys is active. */ 
+        AnyModifierState = 16
+    };
+    Q_DECLARE_FLAGS(States,State)
+
+    /**
+     * This enum describes commands which are associated with particular key sequences.
+     */
+    enum Command
+    {
+        /** Indicates that no command is associated with this command sequence */
+        NoCommand = 0,
+        /** TODO Document me */
+        SendCommand = 1,
+        /** Scroll the terminal display up one page */
+        ScrollPageUpCommand = 2,
+        /** Scroll the terminal display down one page */
+        ScrollPageDownCommand = 4,
+        /** Scroll the terminal display up one line */
+        ScrollLineUpCommand = 8,
+        /** Scroll the terminal display down one line */
+        ScrollLineDownCommand = 16,
+        /** Toggles scroll lock mode */
+        ScrollLockCommand = 32,
+		/** Echos the operating system specific erase character. */
+		EraseCommand = 64
+    };
+    Q_DECLARE_FLAGS(Commands,Command)
+
+    /**
+     * Represents an association between a key sequence pressed by the user
+     * and the character sequence and commands associated with it for a particular
+     * KeyboardTranslator.
+     */
+    class Entry
+    {
+    public:
+        /** 
+         * Constructs a new entry for a keyboard translator.
+         */
+        Entry();
+
+        /** 
+         * Returns true if this entry is null.
+         * This is true for newly constructed entries which have no properties set. 
+         */
+        bool isNull() const;
+
+        /** Returns the commands associated with this entry */
+        Command command() const;
+        /** Sets the command associated with this entry. */
+        void setCommand(Command command);
+
+        /** 
+         * Returns the character sequence associated with this entry, optionally replacing 
+         * wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed.
+         *
+         * TODO: The numbers used to replace '*' characters are taken from the Konsole/KDE 3 code.
+         * Document them. 
+         *
+         * @param expandWildCards Specifies whether wild cards (occurrences of the '*' character) in
+         * the entry should be replaced with a number to indicate the modifier keys being pressed. 
+         *
+         * @param modifiers The keyboard modifiers being pressed.
+         */
+        QByteArray text(bool expandWildCards = false,
+                        Qt::KeyboardModifiers modifiers = Qt::NoModifier) const;
+
+        /** Sets the character sequence associated with this entry */
+        void setText(const QByteArray& text);
+
+        /** 
+         * Returns the character sequence associated with this entry,
+         * with any non-printable characters replaced with escape sequences.
+         *
+         * eg. \\E for Escape, \\t for tab, \\n for new line.
+         *
+         * @param expandWildCards See text()
+         * @param modifiers See text()
+         */
+        QByteArray escapedText(bool expandWildCards = false,
+                               Qt::KeyboardModifiers modifiers = Qt::NoModifier) const;
+
+        /** Returns the character code ( from the Qt::Key enum ) associated with this entry */
+        int keyCode() const;
+        /** Sets the character code associated with this entry */
+        void setKeyCode(int keyCode);
+
+        /** 
+         * Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry. 
+         * If a modifier is set in modifierMask() but not in modifiers(), this means that the entry
+         * only matches when that modifier is NOT pressed.
+         *
+         * If a modifier is not set in modifierMask() then the entry matches whether the modifier
+         * is pressed or not. 
+         */
+        Qt::KeyboardModifiers modifiers() const;
+
+        /** Returns the keyboard modifiers which are valid in this entry.  See modifiers() */
+        Qt::KeyboardModifiers modifierMask() const;
+
+        /** See modifiers() */
+        void setModifiers( Qt::KeyboardModifiers modifiers );
+        /** See modifierMask() and modifiers() */
+        void setModifierMask( Qt::KeyboardModifiers modifiers );
+
+        /** 
+         * Returns a bitwise-OR of the enabled state flags associated with this entry. 
+         * If flag is set in stateMask() but not in state(), this means that the entry only 
+         * matches when the terminal is NOT in that state.
+         *
+         * If a state is not set in stateMask() then the entry matches whether the terminal
+         * is in that state or not. 
+         */
+        States state() const;
+
+        /** Returns the state flags which are valid in this entry.  See state() */
+        States stateMask() const;
+
+        /** See state() */
+        void setState( States state );
+        /** See stateMask() */
+        void setStateMask( States mask );
+
+        /** 
+         * Returns the key code and modifiers associated with this entry 
+         * as a QKeySequence
+         */
+        //QKeySequence keySequence() const;
+
+        /** 
+         * Returns this entry's conditions ( ie. its key code, modifier and state criteria )
+         * as a string.
+         */
+        QString conditionToString() const;
+
+        /**
+         * Returns this entry's result ( ie. its command or character sequence )
+         * as a string.
+         *
+         * @param expandWildCards See text()
+         * @param modifiers See text()
+         */
+        QString resultToString(bool expandWildCards = false,
+                               Qt::KeyboardModifiers modifiers = Qt::NoModifier) const;
+
+        /** 
+         * Returns true if this entry matches the given key sequence, specified
+         * as a combination of @p keyCode , @p modifiers and @p state.
+         */
+        bool matches( int keyCode , 
+                      Qt::KeyboardModifiers modifiers , 
+                      States flags ) const;
+
+        bool operator==(const Entry& rhs) const;
+       
+    private:
+        void insertModifier( QString& item , int modifier ) const;
+        void insertState( QString& item , int state ) const;
+        QByteArray unescape(const QByteArray& text) const;
+
+        int _keyCode;
+        Qt::KeyboardModifiers _modifiers;
+        Qt::KeyboardModifiers _modifierMask;
+        States _state;
+        States _stateMask;
+
+        Command _command;
+        QByteArray _text;
+    };
+
+    /** Constructs a new keyboard translator with the given @p name */
+    KeyboardTranslator(const QString& name);
+   
+    //KeyboardTranslator(const KeyboardTranslator& other);
+
+    /** Returns the name of this keyboard translator */
+    QString name() const;
+
+    /** Sets the name of this keyboard translator */
+    void setName(const QString& name);
+
+    /** Returns the descriptive name of this keyboard translator */
+    QString description() const;
+
+    /** Sets the descriptive name of this keyboard translator */
+    void setDescription(const QString& description);
+
+    /**
+     * Looks for an entry in this keyboard translator which matches the given
+     * key code, keyboard modifiers and state flags.
+     * 
+     * Returns the matching entry if found or a null Entry otherwise ( ie.
+     * entry.isNull() will return true )
+     *
+     * @param keyCode A key code from the Qt::Key enum
+     * @param modifiers A combination of modifiers
+     * @param state Optional flags which specify the current state of the terminal
+     */
+    Entry findEntry(int keyCode , 
+                    Qt::KeyboardModifiers modifiers , 
+                    States state = NoState) const;
+
+    /** 
+     * Adds an entry to this keyboard translator's table.  Entries can be looked up according
+     * to their key sequence using findEntry()
+     */
+    void addEntry(const Entry& entry);
+
+    /**
+     * Replaces an entry in the translator.  If the @p existing entry is null,
+     * then this is equivalent to calling addEntry(@p replacement)
+     */
+    void replaceEntry(const Entry& existing , const Entry& replacement);
+
+    /**
+     * Removes an entry from the table.
+     */
+    void removeEntry(const Entry& entry);
+
+    /** Returns a list of all entries in the translator. */
+    QList<Entry> entries() const;
+
+private:
+
+    QHash<int,Entry> _entries; // entries in this keyboard translation,
+                                                 // entries are indexed according to
+                                                 // their keycode
+    QString _name;
+    QString _description;
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::States)
+Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::Commands)
+
+/** 
+ * Parses the contents of a Keyboard Translator (.keytab) file and 
+ * returns the entries found in it.
+ *
+ * Usage example:
+ *
+ * @code
+ *  QFile source( "/path/to/keytab" );
+ *  source.open( QIODevice::ReadOnly );
+ *
+ *  KeyboardTranslator* translator = new KeyboardTranslator( "name-of-translator" );
+ *
+ *  KeyboardTranslatorReader reader(source);
+ *  while ( reader.hasNextEntry() )
+ *      translator->addEntry(reader.nextEntry());
+ *
+ *  source.close();
+ *
+ *  if ( !reader.parseError() )
+ *  {
+ *      // parsing succeeded, do something with the translator
+ *  } 
+ *  else
+ *  {
+ *      // parsing failed
+ *  }
+ * @endcode
+ */
+class KeyboardTranslatorReader
+{
+public:
+    /** Constructs a new reader which parses the given @p source */
+    KeyboardTranslatorReader( QIODevice* source );
+
+    /** 
+     * Returns the description text. 
+     * TODO: More documentation 
+     */
+    QString description() const;
+
+    /** Returns true if there is another entry in the source stream */
+    bool hasNextEntry();
+    /** Returns the next entry found in the source stream */
+    KeyboardTranslator::Entry nextEntry(); 
+
+    /** 
+     * Returns true if an error occurred whilst parsing the input or
+     * false if no error occurred.
+     */
+    bool parseError();
+
+    /**
+     * Parses a condition and result string for a translator entry
+     * and produces a keyboard translator entry.
+     *
+     * The condition and result strings are in the same format as in  
+     */
+    static KeyboardTranslator::Entry createEntry( const QString& condition ,
+                                                  const QString& result );
+private:
+    struct Token
+    {
+        enum Type
+        {
+            TitleKeyword,
+            TitleText,
+            KeyKeyword,
+            KeySequence,
+            Command,
+            OutputText
+        };
+        Type type;
+        QString text;
+    };
+    QList<Token> tokenize(const QString&);
+    void readNext();
+    bool decodeSequence(const QString& , 
+                                int& keyCode,
+                                Qt::KeyboardModifiers& modifiers,
+                                Qt::KeyboardModifiers& modifierMask,
+                                KeyboardTranslator::States& state,
+                                KeyboardTranslator::States& stateFlags);
+
+    static bool parseAsModifier(const QString& item , Qt::KeyboardModifier& modifier);
+    static bool parseAsStateFlag(const QString& item , KeyboardTranslator::State& state);
+    static bool parseAsKeyCode(const QString& item , int& keyCode);
+   	static bool parseAsCommand(const QString& text , KeyboardTranslator::Command& command);
+
+    QIODevice* _source;
+    QString _description;
+    KeyboardTranslator::Entry _nextEntry;
+    bool _hasNext;
+};
+
+/** Writes a keyboard translation to disk. */
+class KeyboardTranslatorWriter
+{
+public:
+    /** 
+     * Constructs a new writer which saves data into @p destination.
+     * The caller is responsible for closing the device when writing is complete.
+     */
+    KeyboardTranslatorWriter(QIODevice* destination);
+    ~KeyboardTranslatorWriter();
+
+    /** 
+     * Writes the header for the keyboard translator. 
+     * @param description Description of the keyboard translator. 
+     */
+    void writeHeader( const QString& description );
+    /** Writes a translator entry. */
+    void writeEntry( const KeyboardTranslator::Entry& entry ); 
+
+private:
+    QIODevice* _destination;  
+    QTextStream* _writer;
+};
+
+/**
+ * Manages the keyboard translations available for use by terminal sessions,
+ * see KeyboardTranslator.
+ */
+class KeyboardTranslatorManager
+{
+public:
+    /** 
+     * Constructs a new KeyboardTranslatorManager and loads the list of
+     * available keyboard translations.
+     *
+     * The keyboard translations themselves are not loaded until they are
+     * first requested via a call to findTranslator()
+     */
+    KeyboardTranslatorManager();
+    ~KeyboardTranslatorManager();
+
+    /**
+     * Adds a new translator.  If a translator with the same name 
+     * already exists, it will be replaced by the new translator.
+     *
+     * TODO: More documentation.
+     */
+    void addTranslator(KeyboardTranslator* translator);
+
+    /**
+     * Deletes a translator.  Returns true on successful deletion or false otherwise.
+     *
+     * TODO: More documentation
+     */
+    bool deleteTranslator(const QString& name);
+
+    /** Returns the default translator for Konsole. */
+    const KeyboardTranslator* defaultTranslator();
+
+    /** 
+     * Returns the keyboard translator with the given name or 0 if no translator
+     * with that name exists.
+     *
+     * The first time that a translator with a particular name is requested,
+     * the on-disk .keyboard file is loaded and parsed.  
+     */
+    const KeyboardTranslator* findTranslator(const QString& name);
+    /**
+     * Returns a list of the names of available keyboard translators.
+     *
+     * The first time this is called, a search for available 
+     * translators is started.
+     */
+    QList<QString> allTranslators();
+
+    /** Returns the global KeyboardTranslatorManager instance. */
+   static KeyboardTranslatorManager* instance();
+
+private:
+    static const char* defaultTranslatorText;
+    
+    void findTranslators(); // locate the available translators
+    KeyboardTranslator* loadTranslator(const QString& name); // loads the translator 
+                                                             // with the given name
+    KeyboardTranslator* loadTranslator(QIODevice* device,const QString& name);
+
+    bool saveTranslator(const KeyboardTranslator* translator);
+    QString findTranslatorPath(const QString& name);
+    
+    QHash<QString,KeyboardTranslator*> _translators; // maps translator-name -> KeyboardTranslator
+                                                     // instance
+    bool _haveLoadedAll;
+};
+
+inline int KeyboardTranslator::Entry::keyCode() const { return _keyCode; }
+inline void KeyboardTranslator::Entry::setKeyCode(int keyCode) { _keyCode = keyCode; }
+
+inline void KeyboardTranslator::Entry::setModifiers( Qt::KeyboardModifiers modifier ) 
+{ 
+    _modifiers = modifier;
+}
+inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifiers() const { return _modifiers; }
+
+inline void  KeyboardTranslator::Entry::setModifierMask( Qt::KeyboardModifiers mask ) 
+{ 
+   _modifierMask = mask; 
+}
+inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifierMask() const { return _modifierMask; }
+
+inline bool KeyboardTranslator::Entry::isNull() const
+{
+    return ( *this == Entry() );
+}
+
+inline void KeyboardTranslator::Entry::setCommand( Command command )
+{ 
+    _command = command; 
+}
+inline KeyboardTranslator::Command KeyboardTranslator::Entry::command() const { return _command; }
+
+inline void KeyboardTranslator::Entry::setText( const QByteArray& text )
+{ 
+    _text = unescape(text);
+}
+inline int oneOrZero(int value)
+{
+    return value ? 1 : 0;
+}
+inline QByteArray KeyboardTranslator::Entry::text(bool expandWildCards,Qt::KeyboardModifiers modifiers) const 
+{
+    QByteArray expandedText = _text;
+    
+    if (expandWildCards)
+    {
+        int modifierValue = 1;
+        modifierValue += oneOrZero(modifiers & Qt::ShiftModifier);
+        modifierValue += oneOrZero(modifiers & Qt::AltModifier)     << 1;
+        modifierValue += oneOrZero(modifiers & Qt::ControlModifier) << 2;
+
+        for (int i=0;i<_text.length();i++) 
+        {
+            if (expandedText[i] == '*')
+                expandedText[i] = '0' + modifierValue;
+        }
+    }
+
+    return expandedText; 
+}
+
+inline void KeyboardTranslator::Entry::setState( States state )
+{ 
+    _state = state; 
+}
+inline KeyboardTranslator::States KeyboardTranslator::Entry::state() const { return _state; }
+
+inline void KeyboardTranslator::Entry::setStateMask( States stateMask )
+{ 
+    _stateMask = stateMask; 
+}
+inline KeyboardTranslator::States KeyboardTranslator::Entry::stateMask() const { return _stateMask; }
+
+}
+
+Q_DECLARE_METATYPE(Konsole::KeyboardTranslator::Entry)
+Q_DECLARE_METATYPE(const Konsole::KeyboardTranslator*)
+
+#endif // KEYBOARDTRANSLATOR_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/LineFont.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,21 @@
+// WARNING: Autogenerated by "fontembedder ./linefont.src".
+// You probably do not want to hand-edit this!
+
+static const quint32 LineChars[] = {
+	0x00007c00, 0x000fffe0, 0x00421084, 0x00e739ce, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
+	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00427000, 0x004e7380, 0x00e77800, 0x00ef7bc0, 
+	0x00421c00, 0x00439ce0, 0x00e73c00, 0x00e7bde0, 0x00007084, 0x000e7384, 0x000079ce, 0x000f7bce, 
+	0x00001c84, 0x00039ce4, 0x00003dce, 0x0007bdee, 0x00427084, 0x004e7384, 0x004279ce, 0x00e77884, 
+	0x00e779ce, 0x004f7bce, 0x00ef7bc4, 0x00ef7bce, 0x00421c84, 0x00439ce4, 0x00423dce, 0x00e73c84, 
+	0x00e73dce, 0x0047bdee, 0x00e7bde4, 0x00e7bdee, 0x00427c00, 0x0043fce0, 0x004e7f80, 0x004fffe0, 
+	0x004fffe0, 0x00e7fde0, 0x006f7fc0, 0x00efffe0, 0x00007c84, 0x0003fce4, 0x000e7f84, 0x000fffe4, 
+	0x00007dce, 0x0007fdee, 0x000f7fce, 0x000fffee, 0x00427c84, 0x0043fce4, 0x004e7f84, 0x004fffe4, 
+	0x00427dce, 0x00e77c84, 0x00e77dce, 0x0047fdee, 0x004e7fce, 0x00e7fde4, 0x00ef7f84, 0x004fffee, 
+	0x00efffe4, 0x00e7fdee, 0x00ef7fce, 0x00efffee, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
+	0x000f83e0, 0x00a5294a, 0x004e1380, 0x00a57800, 0x00ad0bc0, 0x004390e0, 0x00a53c00, 0x00a5a1e0, 
+	0x000e1384, 0x0000794a, 0x000f0b4a, 0x000390e4, 0x00003d4a, 0x0007a16a, 0x004e1384, 0x00a5694a, 
+	0x00ad2b4a, 0x004390e4, 0x00a52d4a, 0x00a5a16a, 0x004f83e0, 0x00a57c00, 0x00ad83e0, 0x000f83e4, 
+	0x00007d4a, 0x000f836a, 0x004f93e4, 0x00a57d4a, 0x00ad836a, 0x00000000, 0x00000000, 0x00000000, 
+	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0x00001084, 0x00007000, 0x00421000, 
+	0x00039ce0, 0x000039ce, 0x000e7380, 0x00e73800, 0x000e7f80, 0x00e73884, 0x0003fce0, 0x004239ce
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/LineFont.src	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,786 @@
+#2500: single horizontal line
+2500
+     
+     
+-----
+     
+     
+
+#2501: triple horizontal line
+2501
+     
+-----
+-----
+-----
+     
+
+#2502: single vertical line
+2502
+  |  
+  |  
+  |  
+  |  
+  |  
+
+#2503: triple vertical line
+2503
+ ||| 
+ ||| 
+ ||| 
+ ||| 
+ ||| 
+
+#2504-250B are dashed - not handled
+
+#250C: top-left corner (lines on bottom + right)
+250C
+     
+     
+  .--
+  |  
+  |  
+
+#250D: as above, but top line triple-width
+250D
+     
+  .--
+  .--
+  |--
+  |  
+
+#250E: now the vert line triple-width
+250E
+     
+     
+ ..--
+ ||| 
+ ||| 
+
+#250F: and now both lines triple-width
+250F
+     
+ .___
+ |.--
+ ||._
+ ||| 
+
+#2510: top-right corner
+2510
+     
+     
+--.  
+  |  
+  |  
+
+2511
+     
+==.  
+==.  
+==|  
+  | 
+
+2512
+     
+     
+==.. 
+ ||| 
+ ||| 
+
+2513
+     
+===. 
+==.| 
+=.|| 
+ ||| 
+
+#2514: bottom-left corner
+2514
+  |  
+  |  
+  .==
+     
+     
+
+2515
+  |  
+  |==
+  |==
+  ===
+     
+
+
+2516
+ ||| 
+ ||| 
+ |.==
+     
+     
+
+2517
+ ||| 
+ ||.=
+ |.==
+ .===
+     
+
+#2518: bottm-right corner
+2518
+  |  
+  |  
+==.  
+     
+     
+
+2519
+  |  
+==|  
+==|  
+===  
+     
+
+
+251A
+ ||| 
+ ||| 
+==== 
+     
+     
+
+251B
+ ||| 
+=.|| 
+==.| 
+===. 
+     
+
+#251C: Join of vertical line and one from the right
+251C
+  |  
+  |  
+  |==
+  |  
+  |  
+
+251D
+  |  
+  |==
+  |==
+  |==
+  |  
+
+251E
+ ||| 
+ ||| 
+ ||==
+  |  
+  |  
+
+251F
+  |  
+  |  
+ ||==
+ ||| 
+ ||| 
+
+
+2520
+ ||| 
+ ||| 
+ ||==
+ ||| 
+ ||| 
+
+2521
+ ||| 
+ |||=
+ ||==
+ .|==
+  |  
+
+2522
+  |  
+ .|==
+ ||==
+ |||=
+ ||| 
+
+2523
+ ||| 
+ ||.=
+ ||==
+ ||.=
+ ||| 
+
+#2524: Join of vertical line and one from the left
+2524
+  |  
+  |  
+==|  
+  |  
+  |  
+
+2525
+  |  
+==|  
+==|  
+==|  
+  |  
+
+2526
+ ||| 
+ ||| 
+==+| 
+  |  
+  |  
+
+2527
+  |  
+  |  
+==+| 
+ ||| 
+ ||| 
+
+2528
+ ||| 
+ ||| 
+==+| 
+ ||| 
+ ||| 
+
+2529
+ ||| 
+=+|| 
+==+| 
+===+ 
+  |  
+
+252A
+  |  
+=+|| 
+==+| 
+===+ 
+ ||| 
+
+252B
+ |||
+=+|| 
+==+| 
+=+|| 
+ |||
+
+#252C: horizontal line joined to from below
+252C
+     
+     
+=====
+  |  
+  |  
+
+252D
+     
+===  
+==|==
+==|  
+  |  
+
+252E
+     
+  ===
+==|==
+  |==
+  |  
+
+252F
+     
+==+==
+==|==
+==|==
+  |  
+
+2530
+     
+=====
+=====
+==|==
+  |  
+
+2531
+     
+===| 
+==||=
+=||| 
+ ||| 
+
+2532
+     
+ |===
+=||==
+ ||==
+ ||  
+
+2533
+     
+=====
+==|==
+=+|+=
+ ||| 
+
+#2534: bottom line, connected to from top
+2534
+  |
+  |
+=====
+     
+     
+
+2535
+  |
+==|
+=====
+===  
+    
+
+2536
+  |
+  |==
+=====
+  ===
+     
+
+2537
+  |
+==|==
+=====
+=====
+     
+
+2538
+ |||
+ |||
+=====
+     
+     
+
+2539
+ |||
+==||
+=====
+===| 
+    
+
+
+253A
+ |||
+ ||==
+=|===
+ |===
+     
+
+253B
+ |||
+==|==
+=====
+=====
+     
+
+#253C: vertical + horizontal lines intersecting
+253C
+  |  
+  |  
+=====
+  |  
+  |
+
+253D
+  |  
+==|  
+=====
+==|  
+  |
+
+253E
+  |  
+  |==
+=====
+  |==
+  |
+
+253F
+  |  
+==|==
+=====
+==|==
+  |
+
+2540
+ ||| 
+ ||| 
+=====
+  |  
+  |
+
+2541
+  |  
+  |  
+=====
+ ||| 
+ |||
+
+2542
+ ||| 
+ ||| 
+=====
+ ||| 
+ |||
+
+2543
+ ||| 
+=|||
+=====
+==|+ 
+  |
+
+2544
+ ||| 
+ ||==
+=====
+  |==
+  |
+
+2545
+  |
+==|+ 
+=====
+=|||
+ ||| 
+
+2546
+  |
+  |==
+=====
+ ||==
+ ||| 
+
+2547
+ ||| 
+=|||=
+=====
+=|||=
+  | 
+
+2548
+  |  
+=|||=
+=====
+=|||=
+ |||
+
+2549
+ ||| 
+=||| 
+=====
+=||| 
+ |||
+
+254A
+ ||| 
+ |||=
+=====
+ |||=
+ |||
+
+254B
+ ||| 
+=|||=
+=====
+=|||=
+ |||
+
+#254C-254F are dashed
+2550
+     
+_____
+     
+_____
+     
+
+2551
+ | | 
+ | |
+ | |
+ | |
+ | |
+
+2552
+     
+  |--
+  |
+  |--
+  |
+
+2553
+     
+     
+ ----
+ | | 
+ | | 
+
+2554
+     
+ +---
+ |
+ + +-
+ | |
+
+2555
+     
+--+
+  |  
+--+  
+  |  
+
+2556
+    
+    
+-+-+
+ | |
+ | |
+
+2557
+     
+---+ 
+   | 
+-+ |
+ | |
+
+2558
+  |
+  +--
+  |
+  +--
+
+2559
+ | | 
+ | | 
+ +-+-
+     
+     
+
+255A
+ | | 
+ | +-
+ |   
+ +---
+     
+
+255B
+  |  
+--+  
+  | 
+--+  
+     
+
+255C
+ | | 
+ | | 
+-+-+ 
+    
+
+255D
+ | | 
+-+ | 
+   |
+---+
+    
+
+255E
+  |
+  +--
+  |
+  +--
+  |
+
+255F
+ | |
+ | |
+ | +-
+ | |
+ | |
+
+2560
+ | |
+ | +-
+ | |
+ | +-
+ | |
+
+2561
+  |
+--+
+  |
+--+
+  |
+
+2562
+ | | 
+ | |
+-+ +
+ | |
+ | |
+
+2563
+ | |
+-+ |
+   |
+-+ |
+ | |
+
+2564
+     
+-----
+     
+--+--
+  |
+
+2565
+     
+     
+-+-+-
+ | | 
+ | |
+
+2566
+     
+-----
+     
+-+ +-
+ | |
+
+2567
+  |  
+--+--
+     
+-----
+     
+
+2568
+ | | 
+ | | 
+-+-+-
+     
+     
+
+2569
+ | | 
+-+ +-
+     
+-----
+     
+
+256A
+  |  
+--+--
+  |  
+--+--
+  |
+
+256B
+ | | 
+ | | 
+-+-+-
+ | | 
+ | | 
+
+256C
+ | | 
+-+ +-
+
+-+ +-
+ | | 
+
+#256F-2570 are curly,
+#2571-2573 are slashes and X
+
+2574
+     
+     
+___  
+     
+     
+
+2575
+  |  
+  |  
+  |  
+     
+    
+
+2576
+     
+     
+  ___
+     
+     
+
+2577
+     
+    
+  |  
+  |  
+  |  
+
+2578
+     
+___  
+___  
+___  
+     
+
+2579
+ ||| 
+ ||| 
+ ||| 
+     
+    
+
+257A
+     
+  ___
+  ___
+  ___
+     
+
+257B
+     
+    
+ ||| 
+ ||| 
+ ||| 
+
+257C
+     
+  ___
+_____
+  ___
+     
+
+257D
+  |  
+  |  
+ ||| 
+ ||| 
+ ||| 
+
+257E
+     
+___  
+_____
+___  
+     
+
+257F
+ ||| 
+ ||| 
+ ||| 
+  |  
+  |  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Pty.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,320 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "Pty.h"
+
+// System
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+#include <termios.h>
+
+// Qt
+#include <QtCore>
+
+// KDE
+//#include <KStandardDirs>
+//#include <KLocale>
+//#include <KDebug>
+#include "kpty.h"
+
+using namespace Konsole;
+
+void Pty::donePty()
+{
+  emit done(exitStatus());
+}
+
+void Pty::setWindowSize(int lines, int cols)
+{
+  _windowColumns = cols;
+  _windowLines = lines;
+
+  if (pty()->masterFd() >= 0)
+    pty()->setWinSize(lines, cols);
+}
+QSize Pty::windowSize() const
+{
+    return QSize(_windowColumns,_windowLines);
+}
+
+void Pty::setXonXoff(bool enable)
+{
+  _xonXoff = enable;
+
+  if (pty()->masterFd() >= 0)
+  {
+    struct ::termios ttmode;
+    pty()->tcGetAttr(&ttmode);
+    if (!enable)
+      ttmode.c_iflag &= ~(IXOFF | IXON);
+    else
+      ttmode.c_iflag |= (IXOFF | IXON);
+    if (!pty()->tcSetAttr(&ttmode))
+      qWarning("Unable to set terminal attributes.");
+  }
+}
+
+void Pty::setUtf8Mode(bool enable)
+{
+#ifdef IUTF8 // XXX not a reasonable place to check it.
+  _utf8 = enable;
+
+  if (pty()->masterFd() >= 0)
+  {
+    struct ::termios ttmode;
+    pty()->tcGetAttr(&ttmode);
+    if (!enable)
+      ttmode.c_iflag &= ~IUTF8;
+    else
+      ttmode.c_iflag |= IUTF8;
+    if (!pty()->tcSetAttr(&ttmode))
+      qWarning("Unable to set terminal attributes.");
+  }
+#endif
+}
+
+void Pty::setErase(char erase)
+{
+  _eraseChar = erase;
+  
+  if (pty()->masterFd() >= 0)
+  {
+    struct ::termios ttmode;
+
+    pty()->tcGetAttr(&ttmode);
+
+    ttmode.c_cc[VERASE] = erase;
+
+    if (!pty()->tcSetAttr(&ttmode))
+      qWarning("Unable to set terminal attributes.");
+  }  
+}
+
+char Pty::erase() const
+{
+	if (pty()->masterFd() >= 0)
+	{
+		qDebug() << "Getting erase char";
+		struct ::termios ttyAttributes;
+		pty()->tcGetAttr(&ttyAttributes);
+		return ttyAttributes.c_cc[VERASE];
+	}
+
+	return _eraseChar;
+}
+
+void Pty::addEnvironmentVariables(const QStringList& environment)
+{
+    QListIterator<QString> iter(environment);
+    while (iter.hasNext())
+    {
+        QString pair = iter.next();
+
+        // split on the first '=' character
+        int pos = pair.indexOf('=');
+        
+        if ( pos >= 0 )
+        {
+            QString variable = pair.left(pos);
+            QString value = pair.mid(pos+1);
+
+            //kDebug() << "Setting environment pair" << variable <<
+            //    " set to " << value;
+
+            setEnvironment(variable,value);
+        }
+    }
+}
+
+int Pty::start(const QString& program, 
+               const QStringList& programArguments, 
+               const QStringList& environment, 
+               ulong winid, 
+               bool addToUtmp
+//               const QString& dbusService, 
+//               const QString& dbusSession)
+		)
+{
+  clearArguments();
+
+  setBinaryExecutable(program.toLatin1());
+
+  addEnvironmentVariables(environment);
+
+  QStringListIterator it( programArguments );
+  while (it.hasNext())
+    arguments.append( it.next().toUtf8() );
+
+//  if ( !dbusService.isEmpty() )
+//     setEnvironment("KONSOLE_DBUS_SERVICE",dbusService);
+//  if ( !dbusSession.isEmpty() )
+//     setEnvironment("KONSOLE_DBUS_SESSION", dbusSession);
+
+  setEnvironment("WINDOWID", QString::number(winid));
+
+  // unless the LANGUAGE environment variable has been set explicitly
+  // set it to a null string
+  // this fixes the problem where KCatalog sets the LANGUAGE environment
+  // variable during the application's startup to something which
+  // differs from LANG,LC_* etc. and causes programs run from
+  // the terminal to display mesages in the wrong language
+  //
+  // this can happen if LANG contains a language which KDE
+  // does not have a translation for
+  //
+  // BR:149300
+  if (!environment.contains("LANGUAGE"))
+      setEnvironment("LANGUAGE",QString());
+
+  setUsePty(All, addToUtmp);
+
+  pty()->open();
+  
+  struct ::termios ttmode;
+  pty()->tcGetAttr(&ttmode);
+  if (!_xonXoff)
+    ttmode.c_iflag &= ~(IXOFF | IXON);
+  else
+    ttmode.c_iflag |= (IXOFF | IXON);
+#ifdef IUTF8 // XXX not a reasonable place to check it.
+  if (!_utf8)
+    ttmode.c_iflag &= ~IUTF8;
+  else
+    ttmode.c_iflag |= IUTF8;
+#endif
+
+  if (_eraseChar != 0)
+  	ttmode.c_cc[VERASE] = _eraseChar;
+  
+  if (!pty()->tcSetAttr(&ttmode))
+    qWarning("Unable to set terminal attributes.");
+  
+  pty()->setWinSize(_windowLines, _windowColumns);
+
+  if ( K3Process::start(NotifyOnExit, (Communication) (Stdin | Stdout)) == false )
+     return -1;
+
+  resume(); // Start...
+  return 0;
+
+}
+
+void Pty::setWriteable(bool writeable)
+{
+  struct stat sbuf;
+  stat(pty()->ttyName(), &sbuf);
+  if (writeable)
+    chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP);
+  else
+    chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP|S_IWOTH));
+}
+
+Pty::Pty()
+    : _bufferFull(false),
+      _windowColumns(0),
+      _windowLines(0),
+      _eraseChar(0),
+      _xonXoff(true),
+      _utf8(true)
+{
+  connect(this, SIGNAL(receivedStdout(K3Process *, char *, int )),
+	  this, SLOT(dataReceived(K3Process *,char *, int)));
+  connect(this, SIGNAL(processExited(K3Process *)),
+          this, SLOT(donePty()));
+  connect(this, SIGNAL(wroteStdin(K3Process *)),
+          this, SLOT(writeReady()));
+  _pty = new KPty;
+
+  setUsePty(All, false); // utmp will be overridden later
+}
+
+Pty::~Pty()
+{
+    delete _pty;
+}
+
+void Pty::writeReady()
+{
+  _pendingSendJobs.erase(_pendingSendJobs.begin());
+  _bufferFull = false;
+  doSendJobs();
+}
+
+void Pty::doSendJobs() {
+  if(_pendingSendJobs.isEmpty())
+  {
+     emit bufferEmpty(); 
+     return;
+  }
+  
+  SendJob& job = _pendingSendJobs.first();
+
+  
+  if (!writeStdin( job.data(), job.length() ))
+  {
+    qWarning("Pty::doSendJobs - Could not send input data to terminal process.");
+    return;
+  }
+  _bufferFull = true;
+}
+
+void Pty::appendSendJob(const char* s, int len)
+{
+  _pendingSendJobs.append(SendJob(s,len));
+}
+
+void Pty::sendData(const char* s, int len)
+{
+  appendSendJob(s,len);
+  if (!_bufferFull)
+     doSendJobs();
+}
+
+void Pty::dataReceived(K3Process *,char *buf, int len)
+{
+  emit receivedData(buf,len);
+}
+
+void Pty::lockPty(bool lock)
+{
+  if (lock)
+    suspend();
+  else
+    resume();
+}
+
+int Pty::foregroundProcessGroup() const
+{
+    int pid = tcgetpgrp(pty()->masterFd());
+
+    if ( pid != -1 )
+    {
+        return pid;
+    } 
+
+    return 0;
+}
+
+//#include "moc_Pty.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Pty.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,243 @@
+/*
+    This file is part of Konsole, KDE's terminal emulator. 
+    
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 PTY_H
+#define PTY_H
+
+// Qt
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+#include <QtCore/QList>
+#include <QtCore>
+
+#include "k3process.h"
+
+
+namespace Konsole
+{
+
+/**
+ * The Pty class is used to start the terminal process, 
+ * send data to it, receive data from it and manipulate 
+ * various properties of the pseudo-teletype interface
+ * used to communicate with the process.
+ *
+ * To use this class, construct an instance and connect
+ * to the sendData slot and receivedData signal to
+ * send data to or receive data from the process.
+ *
+ * To start the terminal process, call the start() method
+ * with the program name and appropriate arguments. 
+ */
+class Pty: public K3Process
+{
+Q_OBJECT
+
+  public:
+    
+    /** 
+     * Constructs a new Pty.
+     * 
+     * Connect to the sendData() slot and receivedData() signal to prepare
+     * for sending and receiving data from the terminal process.
+     *
+     * To start the terminal process, call the run() method with the 
+     * name of the program to start and appropriate arguments.
+     */
+    Pty();
+    ~Pty();
+
+    /**
+     * Starts the terminal process.  
+     *
+     * Returns 0 if the process was started successfully or non-zero
+     * otherwise.
+     *
+     * @param program Path to the program to start
+     * @param arguments Arguments to pass to the program being started
+     * @param environment A list of key=value pairs which will be added
+     * to the environment for the new process.  At the very least this
+     * should include an assignment for the TERM environment variable.
+     * @param winid Specifies the value of the WINDOWID environment variable
+     * in the process's environment.
+     * @param addToUtmp Specifies whether a utmp entry should be created for
+     * the pty used.  See K3Process::setUsePty() 
+     * @param dbusService Specifies the value of the KONSOLE_DBUS_SERVICE 
+     * environment variable in the process's environment.
+     * @param dbusSession Specifies the value of the KONSOLE_DBUS_SESSION
+     * environment variable in the process's environment. 
+     */
+    int start( const QString& program, 
+               const QStringList& arguments, 
+               const QStringList& environment, 
+               ulong winid, 
+               bool addToUtmp
+//               const QString& dbusService,
+//               const QString& dbusSession
+             );
+
+    /** TODO: Document me */
+    void setWriteable(bool writeable);
+
+    /** 
+     * Enables or disables Xon/Xoff flow control.
+     */
+    void setXonXoff(bool on);
+
+    /** 
+     * Sets the size of the window (in lines and columns of characters) 
+     * used by this teletype.
+     */
+    void setWindowSize(int lines, int cols);
+    
+    /** Returns the size of the window used by this teletype.  See setWindowSize() */
+    QSize windowSize() const;
+
+    /** TODO Document me */
+    void setErase(char erase);
+
+	/** */
+	char erase() const;
+
+    /**
+     * Returns the process id of the teletype's current foreground
+     * process.  This is the process which is currently reading
+     * input sent to the terminal via. sendData()
+     *
+     * If there is a problem reading the foreground process group,
+     * 0 will be returned.
+     */
+    int foregroundProcessGroup() const;
+   
+    /**
+     * Returns whether the buffer used to send data to the
+     * terminal process is full.
+     */
+    bool bufferFull() const { return _bufferFull; }
+
+
+  public slots:
+
+    /**
+     * Put the pty into UTF-8 mode on systems which support it.
+     */
+    void setUtf8Mode(bool on);
+
+    /**
+     * Suspend or resume processing of data from the standard 
+     * output of the terminal process.
+     *
+     * See K3Process::suspend() and K3Process::resume()
+     *
+     * @param lock If true, processing of output is suspended,
+     * otherwise processing is resumed.
+     */
+    void lockPty(bool lock);
+    
+    /** 
+     * Sends data to the process currently controlling the 
+     * teletype ( whose id is returned by foregroundProcessGroup() )
+     *
+     * @param buffer Pointer to the data to send.
+     * @param length Length of @p buffer.
+     */
+    void sendData(const char* buffer, int length);
+
+  signals:
+
+    /**
+     * Emitted when the terminal process terminates.
+     *
+     * @param exitCode The status code which the process exited with.
+     */
+    void done(int exitCode);
+
+    /**
+     * Emitted when a new block of data is received from
+     * the teletype.
+     *
+     * @param buffer Pointer to the data received.
+     * @param length Length of @p buffer
+     */
+    void receivedData(const char* buffer, int length);
+    
+    /**
+     * Emitted when the buffer used to send data to the terminal
+     * process becomes empty, i.e. all data has been sent.
+     */
+    void bufferEmpty();
+    
+
+  private slots:
+    
+    // called when terminal process exits
+    void donePty();
+    // called when data is received from the terminal process 
+    void dataReceived(K3Process*, char* buffer, int length);
+    // sends the first enqueued buffer of data to the
+    // terminal process
+    void doSendJobs();
+    // called when the terminal process is ready to
+    // receive more data
+    void writeReady();
+
+  private:
+    // takes a list of key=value pairs and adds them
+    // to the environment for the process
+    void addEnvironmentVariables(const QStringList& environment);
+
+    // enqueues a buffer of data to be sent to the 
+    // terminal process
+    void appendSendJob(const char* buffer, int length);
+   
+    // a buffer of data in the queue to be sent to the 
+    // terminal process 
+    class SendJob {
+	public:
+      		SendJob() {}
+      		SendJob(const char* b, int len) : buffer(len)
+		{
+			memcpy( buffer.data() , b , len );
+        }
+	
+		const char* data() const { return buffer.constData(); }
+		int length() const { return buffer.size(); }	
+	private:
+      		QVector<char> buffer;
+    };
+
+    QList<SendJob> _pendingSendJobs;
+    bool _bufferFull;
+
+    int  _windowColumns; 
+    int  _windowLines;
+    char _eraseChar;
+    bool _xonXoff;
+    bool _utf8;
+    KPty *_pty;
+};
+
+}
+
+#endif // PTY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/README	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,7 @@
+lib.pro is a *.pro-file for qmake
+
+It produces static lib (libqtermwidget.a) only. 
+For creating shared lib (*.so) uncomment "dll" in "CONFIG" line in *.pro-file
+
+Library was tested both with HAVE_POSIX_OPENPT and HAVE_GETPT precompiler directives, 
+defined in "DEFINES" line. You should select variant which would be correct for your system.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Screen.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1567 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "Screen.h"
+
+// Standard
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+
+// Qt
+#include <QtCore/QTextStream>
+#include <QtCore/QDate>
+
+// Konsole
+#include "konsole_wcwidth.h"
+#include "TerminalCharacterDecoder.h"
+
+using namespace Konsole;
+
+//FIXME: this is emulation specific. Use false for xterm, true for ANSI.
+//FIXME: see if we can get this from terminfo.
+#define BS_CLEARS false
+
+//Macro to convert x,y position on screen to position within an image.
+//
+//Originally the image was stored as one large contiguous block of 
+//memory, so a position within the image could be represented as an
+//offset from the beginning of the block.  For efficiency reasons this
+//is no longer the case.  
+//Many internal parts of this class still use this representation for parameters and so on,
+//notably moveImage() and clearImage().
+//This macro converts from an X,Y position into an image offset.
+#ifndef loc
+#define loc(X,Y) ((Y)*columns+(X))
+#endif
+
+
+Character Screen::defaultChar = Character(' ',
+					  CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR),
+					  CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR),
+					  DEFAULT_RENDITION);
+
+//#define REVERSE_WRAPPED_LINES  // for wrapped line debug
+
+Screen::Screen(int l, int c)
+  : lines(l),
+    columns(c),
+    screenLines(new ImageLine[lines+1] ),
+    _scrolledLines(0),
+    _droppedLines(0),
+    hist(new HistoryScrollNone()),
+    cuX(0), cuY(0),
+    cu_re(0),
+    tmargin(0), bmargin(0),
+    tabstops(0),
+    sel_begin(0), sel_TL(0), sel_BR(0),
+    sel_busy(false),
+    columnmode(false),
+    ef_fg(CharacterColor()), ef_bg(CharacterColor()), ef_re(0),
+    sa_cuX(0), sa_cuY(0),
+    sa_cu_re(0),
+    lastPos(-1)
+{
+  lineProperties.resize(lines+1);
+  for (int i=0;i<lines+1;i++)
+          lineProperties[i]=LINE_DEFAULT;
+
+  initTabStops();
+  clearSelection();
+  reset();
+}
+
+/*! Destructor
+*/
+
+Screen::~Screen()
+{
+  delete[] screenLines;
+  delete[] tabstops;
+  delete hist;
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/* Normalized                    Screen Operations                           */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+// Cursor Setting --------------------------------------------------------------
+
+/*! \section Cursor
+
+    The `cursor' is a location within the screen that is implicitely used in
+    many operations. The operations within this section allow to manipulate
+    the cursor explicitly and to obtain it's value.
+
+    The position of the cursor is guarantied to be between (including) 0 and
+    `columns-1' and `lines-1'.
+*/
+
+/*!
+    Move the cursor up.
+
+    The cursor will not be moved beyond the top margin.
+*/
+
+void Screen::cursorUp(int n)
+//=CUU
+{
+  if (n == 0) n = 1; // Default
+  int stop = cuY < tmargin ? 0 : tmargin;
+  cuX = qMin(columns-1,cuX); // nowrap!
+  cuY = qMax(stop,cuY-n);
+}
+
+/*!
+    Move the cursor down.
+
+    The cursor will not be moved beyond the bottom margin.
+*/
+
+void Screen::cursorDown(int n)
+//=CUD
+{
+  if (n == 0) n = 1; // Default
+  int stop = cuY > bmargin ? lines-1 : bmargin;
+  cuX = qMin(columns-1,cuX); // nowrap!
+  cuY = qMin(stop,cuY+n);
+}
+
+/*!
+    Move the cursor left.
+
+    The cursor will not move beyond the first column.
+*/
+
+void Screen::cursorLeft(int n)
+//=CUB
+{
+  if (n == 0) n = 1; // Default
+  cuX = qMin(columns-1,cuX); // nowrap!
+  cuX = qMax(0,cuX-n);
+}
+
+/*!
+    Move the cursor left.
+
+    The cursor will not move beyond the rightmost column.
+*/
+
+void Screen::cursorRight(int n)
+//=CUF
+{
+  if (n == 0) n = 1; // Default
+  cuX = qMin(columns-1,cuX+n);
+}
+
+void Screen::setMargins(int top, int bot)
+//=STBM
+{
+  if (top == 0) top = 1;      // Default
+  if (bot == 0) bot = lines;  // Default
+  top = top - 1;              // Adjust to internal lineno
+  bot = bot - 1;              // Adjust to internal lineno
+  if ( !( 0 <= top && top < bot && bot < lines ) )
+  { qDebug()<<" setRegion("<<top<<","<<bot<<") : bad range.";
+    return;                   // Default error action: ignore
+  }
+  tmargin = top;
+  bmargin = bot;
+  cuX = 0;
+  cuY = getMode(MODE_Origin) ? top : 0;
+
+}
+
+int Screen::topMargin() const
+{
+    return tmargin;
+}
+int Screen::bottomMargin() const
+{
+    return bmargin;
+}
+
+void Screen::index()
+//=IND
+{
+  if (cuY == bmargin)
+  {
+    scrollUp(1);
+  }
+  else if (cuY < lines-1)
+    cuY += 1;
+}
+
+void Screen::reverseIndex()
+//=RI
+{
+  if (cuY == tmargin)
+     scrollDown(tmargin,1);
+  else if (cuY > 0)
+    cuY -= 1;
+}
+
+/*!
+    Move the cursor to the begin of the next line.
+
+    If cursor is on bottom margin, the region between the
+    actual top and bottom margin is scrolled up.
+*/
+
+void Screen::NextLine()
+//=NEL
+{
+  Return(); index();
+}
+
+void Screen::eraseChars(int n)
+{
+  if (n == 0) n = 1; // Default
+  int p = qMax(0,qMin(cuX+n-1,columns-1));
+  clearImage(loc(cuX,cuY),loc(p,cuY),' ');
+}
+
+void Screen::deleteChars(int n)
+{
+  Q_ASSERT( n >= 0 );
+
+  // always delete at least one char
+  if (n == 0) 
+      n = 1; 
+
+  // if cursor is beyond the end of the line there is nothing to do
+  if ( cuX >= screenLines[cuY].count() )
+      return;
+
+  if ( cuX+n >= screenLines[cuY].count() ) 
+       n = screenLines[cuY].count() - 1 - cuX;
+
+  Q_ASSERT( n >= 0 );
+  Q_ASSERT( cuX+n < screenLines[cuY].count() );
+
+  screenLines[cuY].remove(cuX,n);
+}
+
+void Screen::insertChars(int n)
+{
+  if (n == 0) n = 1; // Default
+
+  if ( screenLines[cuY].size() < cuX )
+    screenLines[cuY].resize(cuX);
+
+  screenLines[cuY].insert(cuX,n,' ');
+
+  if ( screenLines[cuY].count() > columns )
+      screenLines[cuY].resize(columns);
+}
+
+void Screen::deleteLines(int n)
+{
+  if (n == 0) n = 1; // Default
+  scrollUp(cuY,n);
+}
+
+/*! insert `n' lines at the cursor position.
+
+    The cursor is not moved by the operation.
+*/
+
+void Screen::insertLines(int n)
+{
+  if (n == 0) n = 1; // Default
+  scrollDown(cuY,n);
+}
+
+// Mode Operations -----------------------------------------------------------
+
+/*! Set a specific mode. */
+
+void Screen::setMode(int m)
+{
+  currParm.mode[m] = true;
+  switch(m)
+  {
+    case MODE_Origin : cuX = 0; cuY = tmargin; break; //FIXME: home
+  }
+}
+
+/*! Reset a specific mode. */
+
+void Screen::resetMode(int m)
+{
+  currParm.mode[m] = false;
+  switch(m)
+  {
+    case MODE_Origin : cuX = 0; cuY = 0; break; //FIXME: home
+  }
+}
+
+/*! Save a specific mode. */
+
+void Screen::saveMode(int m)
+{
+  saveParm.mode[m] = currParm.mode[m];
+}
+
+/*! Restore a specific mode. */
+
+void Screen::restoreMode(int m)
+{
+  currParm.mode[m] = saveParm.mode[m];
+}
+
+bool Screen::getMode(int m) const
+{
+  return currParm.mode[m];
+}
+
+void Screen::saveCursor()
+{
+  sa_cuX     = cuX;
+  sa_cuY     = cuY;
+  sa_cu_re   = cu_re;
+  sa_cu_fg   = cu_fg;
+  sa_cu_bg   = cu_bg;
+}
+
+void Screen::restoreCursor()
+{
+  cuX     = qMin(sa_cuX,columns-1);
+  cuY     = qMin(sa_cuY,lines-1);
+  cu_re   = sa_cu_re;
+  cu_fg   = sa_cu_fg;
+  cu_bg   = sa_cu_bg;
+  effectiveRendition();
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                             Screen Operations                             */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/*! Resize the screen image
+
+    The topmost left position is maintained, while lower lines
+    or right hand side columns might be removed or filled with
+    spaces to fit the new size.
+
+    The region setting is reset to the whole screen and the
+    tab positions reinitialized.
+
+    If the new image is narrower than the old image then text on lines
+    which extends past the end of the new image is preserved so that it becomes
+    visible again if the screen is later resized to make it larger.
+*/
+
+void Screen::resizeImage(int new_lines, int new_columns)
+{
+  if ((new_lines==lines) && (new_columns==columns)) return;
+
+  if (cuY > new_lines-1)
+  { // attempt to preserve focus and lines
+    bmargin = lines-1; //FIXME: margin lost
+    for (int i = 0; i < cuY-(new_lines-1); i++)
+    {
+      addHistLine(); scrollUp(0,1);
+    }
+  }
+
+  // create new screen lines and copy from old to new
+  
+   ImageLine* newScreenLines = new ImageLine[new_lines+1];
+   for (int i=0; i < qMin(lines-1,new_lines+1) ;i++)
+           newScreenLines[i]=screenLines[i];
+   for (int i=lines;(i > 0) && (i<new_lines+1);i++)
+           newScreenLines[i].resize( new_columns );
+   
+  lineProperties.resize(new_lines+1);
+  for (int i=lines;(i > 0) && (i<new_lines+1);i++)
+          lineProperties[i] = LINE_DEFAULT;
+
+  clearSelection();
+ 
+  delete[] screenLines; 
+  screenLines = newScreenLines;
+
+  lines = new_lines;
+  columns = new_columns;
+  cuX = qMin(cuX,columns-1);
+  cuY = qMin(cuY,lines-1);
+
+  // FIXME: try to keep values, evtl.
+  tmargin=0;
+  bmargin=lines-1;
+  initTabStops();
+  clearSelection();
+}
+
+void Screen::setDefaultMargins()
+{
+	tmargin = 0;
+	bmargin = lines-1;
+}
+
+
+/*
+   Clarifying rendition here and in the display.
+
+   currently, the display's color table is
+     0       1       2 .. 9    10 .. 17
+     dft_fg, dft_bg, dim 0..7, intensive 0..7
+
+   cu_fg, cu_bg contain values 0..8;
+   - 0    = default color
+   - 1..8 = ansi specified color
+
+   re_fg, re_bg contain values 0..17
+   due to the TerminalDisplay's color table
+
+   rendition attributes are
+
+      attr           widget screen
+      -------------- ------ ------
+      RE_UNDERLINE     XX     XX    affects foreground only
+      RE_BLINK         XX     XX    affects foreground only
+      RE_BOLD          XX     XX    affects foreground only
+      RE_REVERSE       --     XX
+      RE_TRANSPARENT   XX     --    affects background only
+      RE_INTENSIVE     XX     --    affects foreground only
+
+   Note that RE_BOLD is used in both widget
+   and screen rendition. Since xterm/vt102
+   is to poor to distinguish between bold
+   (which is a font attribute) and intensive
+   (which is a color attribute), we translate
+   this and RE_BOLD in falls eventually appart
+   into RE_BOLD and RE_INTENSIVE.
+*/
+
+void Screen::reverseRendition(Character& p) const
+{ 
+	CharacterColor f = p.foregroundColor; 
+	CharacterColor b = p.backgroundColor;
+  	
+	p.foregroundColor = b; 
+	p.backgroundColor = f; //p->r &= ~RE_TRANSPARENT;
+}
+
+void Screen::effectiveRendition()
+// calculate rendition
+{
+  //copy "current rendition" straight into "effective rendition", which is then later copied directly
+  //into the image[] array which holds the characters and their appearance properties.
+  //- The old version below filtered out all attributes other than underline and blink at this stage,
+  //so that they would not be copied into the image[] array and hence would not be visible by TerminalDisplay
+  //which actually paints the screen using the information from the image[] array.  
+  //I don't know why it did this, but I'm fairly sure it was the wrong thing to do.  The net result
+  //was that bold text wasn't printed in bold by Konsole.
+  ef_re = cu_re;
+  
+  //OLD VERSION:
+  //ef_re = cu_re & (RE_UNDERLINE | RE_BLINK);
+  
+  if (cu_re & RE_REVERSE)
+  {
+    ef_fg = cu_bg;
+    ef_bg = cu_fg;
+  }
+  else
+  {
+    ef_fg = cu_fg;
+    ef_bg = cu_bg;
+  }
+ 
+  if (cu_re & RE_BOLD)
+    ef_fg.toggleIntensive();
+}
+
+/*!
+    returns the image.
+
+    Get the size of the image by \sa getLines and \sa getColumns.
+
+    NOTE that the image returned by this function must later be
+    freed.
+
+*/
+
+void Screen::copyFromHistory(Character* dest, int startLine, int count) const
+{
+  Q_ASSERT( startLine >= 0 && count > 0 && startLine + count <= hist->getLines() );
+
+  for (int line = startLine; line < startLine + count; line++) 
+  {
+    const int length = qMin(columns,hist->getLineLen(line));
+    const int destLineOffset  = (line-startLine)*columns;
+
+    hist->getCells(line,0,length,dest + destLineOffset);
+
+    for (int column = length; column < columns; column++) 
+		dest[destLineOffset+column] = defaultChar;
+    
+	// invert selected text
+	if (sel_begin !=-1)
+	{
+    	for (int column = 0; column < columns; column++)
+    	{
+        	if (isSelected(column,line)) 
+			{
+          		reverseRendition(dest[destLineOffset + column]); 
+    		}
+  		}
+	}
+  }
+}
+
+void Screen::copyFromScreen(Character* dest , int startLine , int count) const
+{
+	Q_ASSERT( startLine >= 0 && count > 0 && startLine + count <= lines );
+
+    for (int line = startLine; line < (startLine+count) ; line++)
+    {
+       int srcLineStartIndex  = line*columns;
+	   int destLineStartIndex = (line-startLine)*columns;
+
+       for (int column = 0; column < columns; column++)
+       { 
+		 int srcIndex = srcLineStartIndex + column; 
+		 int destIndex = destLineStartIndex + column;
+
+         dest[destIndex] = screenLines[srcIndex/columns].value(srcIndex%columns,defaultChar);
+
+	     // invert selected text
+         if (sel_begin != -1 && isSelected(column,line + hist->getLines()))
+           reverseRendition(dest[destIndex]); 
+       }
+
+    }
+}
+
+void Screen::getImage( Character* dest, int size, int startLine, int endLine ) const
+{
+  Q_ASSERT( startLine >= 0 ); 
+  Q_ASSERT( endLine >= startLine && endLine < hist->getLines() + lines );
+
+  const int mergedLines = endLine - startLine + 1;
+
+  Q_ASSERT( size >= mergedLines * columns ); 
+
+  const int linesInHistoryBuffer = qBound(0,hist->getLines()-startLine,mergedLines);
+  const int linesInScreenBuffer = mergedLines - linesInHistoryBuffer;
+
+  // copy lines from history buffer
+  if (linesInHistoryBuffer > 0) {
+  	copyFromHistory(dest,startLine,linesInHistoryBuffer); 
+    }
+
+  // copy lines from screen buffer
+  if (linesInScreenBuffer > 0) {
+  	copyFromScreen(dest + linesInHistoryBuffer*columns,
+				   startLine + linesInHistoryBuffer - hist->getLines(),
+				   linesInScreenBuffer);
+    }				
+ 
+  // invert display when in screen mode
+  if (getMode(MODE_Screen))
+  {  
+    for (int i = 0; i < mergedLines*columns; i++)
+      reverseRendition(dest[i]); // for reverse display
+  }
+
+  // mark the character at the current cursor position
+  int cursorIndex = loc(cuX, cuY + linesInHistoryBuffer);
+  if(getMode(MODE_Cursor) && cursorIndex < columns*mergedLines)
+    dest[cursorIndex].rendition |= RE_CURSOR;
+}
+
+QVector<LineProperty> Screen::getLineProperties( int startLine , int endLine ) const
+{
+  Q_ASSERT( startLine >= 0 ); 
+  Q_ASSERT( endLine >= startLine && endLine < hist->getLines() + lines );
+
+	const int mergedLines = endLine-startLine+1;
+	const int linesInHistory = qBound(0,hist->getLines()-startLine,mergedLines);
+  const int linesInScreen = mergedLines - linesInHistory;
+
+  QVector<LineProperty> result(mergedLines);
+  int index = 0;
+
+  // copy properties for lines in history
+  for (int line = startLine; line < startLine + linesInHistory; line++) 
+  {
+		//TODO Support for line properties other than wrapped lines
+	  if (hist->isWrappedLine(line))
+	  {
+	  	result[index] = (LineProperty)(result[index] | LINE_WRAPPED);
+	  }
+    index++;
+  }
+  
+  // copy properties for lines in screen buffer
+  const int firstScreenLine = startLine + linesInHistory - hist->getLines();
+  for (int line = firstScreenLine; line < firstScreenLine+linesInScreen; line++)
+	{
+    result[index]=lineProperties[line];
+  	index++;
+	}
+
+  return result;
+}
+
+/*!
+*/
+
+void Screen::reset(bool clearScreen)
+{
+    setMode(MODE_Wrap  ); saveMode(MODE_Wrap  );  // wrap at end of margin
+  resetMode(MODE_Origin); saveMode(MODE_Origin);  // position refere to [1,1]
+  resetMode(MODE_Insert); saveMode(MODE_Insert);  // overstroke
+    setMode(MODE_Cursor);                         // cursor visible
+  resetMode(MODE_Screen);                         // screen not inverse
+  resetMode(MODE_NewLine);
+
+  tmargin=0;
+  bmargin=lines-1;
+
+  setDefaultRendition();
+  saveCursor();
+
+  if ( clearScreen )
+    clear();
+}
+
+/*! Clear the entire screen and home the cursor.
+*/
+
+void Screen::clear()
+{
+  clearEntireScreen();
+  home();
+}
+
+void Screen::BackSpace()
+{
+  cuX = qMin(columns-1,cuX); // nowrap!
+  cuX = qMax(0,cuX-1);
+ // if (BS_CLEARS) image[loc(cuX,cuY)].character = ' ';
+
+  if (screenLines[cuY].size() < cuX+1)
+          screenLines[cuY].resize(cuX+1);
+
+  if (BS_CLEARS) screenLines[cuY][cuX].character = ' ';
+}
+
+void Screen::Tabulate(int n)
+{
+  // note that TAB is a format effector (does not write ' ');
+  if (n == 0) n = 1;
+  while((n > 0) && (cuX < columns-1))
+  {
+    cursorRight(1); while((cuX < columns-1) && !tabstops[cuX]) cursorRight(1);
+    n--;
+  }
+}
+
+void Screen::backTabulate(int n)
+{
+  // note that TAB is a format effector (does not write ' ');
+  if (n == 0) n = 1;
+  while((n > 0) && (cuX > 0))
+  {
+     cursorLeft(1); while((cuX > 0) && !tabstops[cuX]) cursorLeft(1);
+     n--;
+  }
+}
+
+void Screen::clearTabStops()
+{
+  for (int i = 0; i < columns; i++) tabstops[i] = false;
+}
+
+void Screen::changeTabStop(bool set)
+{
+  if (cuX >= columns) return;
+  tabstops[cuX] = set;
+}
+
+void Screen::initTabStops()
+{
+  delete[] tabstops;
+  tabstops = new bool[columns];
+
+  // Arrg! The 1st tabstop has to be one longer than the other.
+  // i.e. the kids start counting from 0 instead of 1.
+  // Other programs might behave correctly. Be aware.
+  for (int i = 0; i < columns; i++) tabstops[i] = (i%8 == 0 && i != 0);
+}
+
+/*!
+   This behaves either as IND (Screen::Index) or as NEL (Screen::NextLine)
+   depending on the NewLine Mode (LNM). This mode also
+   affects the key sequence returned for newline ([CR]LF).
+*/
+
+void Screen::NewLine()
+{
+  if (getMode(MODE_NewLine)) Return();
+  index();
+}
+
+/*! put `c' literally onto the screen at the current cursor position.
+
+    VT100 uses the convention to produce an automatic newline (am)
+    with the *first* character that would fall onto the next line (xenl).
+*/
+
+void Screen::checkSelection(int from, int to)
+{
+  if (sel_begin == -1) return;
+  int scr_TL = loc(0, hist->getLines());
+  //Clear entire selection if it overlaps region [from, to]
+  if ( (sel_BR > (from+scr_TL) )&&(sel_TL < (to+scr_TL)) )
+  {
+    clearSelection();
+  }
+}
+
+void Screen::ShowCharacter(unsigned short c)
+{
+  // Note that VT100 does wrapping BEFORE putting the character.
+  // This has impact on the assumption of valid cursor positions.
+  // We indicate the fact that a newline has to be triggered by
+  // putting the cursor one right to the last column of the screen.
+
+  int w = konsole_wcwidth(c);
+
+  if (w <= 0)
+     return;
+
+  if (cuX+w > columns) {
+    if (getMode(MODE_Wrap)) {
+      lineProperties[cuY] = (LineProperty)(lineProperties[cuY] | LINE_WRAPPED);
+      NextLine();
+    }
+    else
+      cuX = columns-w;
+  }
+
+  // ensure current line vector has enough elements
+  int size = screenLines[cuY].size();
+  if (size == 0 && cuY > 0)
+  {
+          screenLines[cuY].resize( qMax(screenLines[cuY-1].size() , cuX+w) );
+  }
+  else
+  {
+    if (size < cuX+w)
+    {
+          screenLines[cuY].resize(cuX+w);
+    }
+  }
+
+  if (getMode(MODE_Insert)) insertChars(w);
+
+  lastPos = loc(cuX,cuY);
+
+  // check if selection is still valid.
+  checkSelection(cuX,cuY);
+
+  Character& currentChar = screenLines[cuY][cuX];
+
+  currentChar.character = c;
+  currentChar.foregroundColor = ef_fg;
+  currentChar.backgroundColor = ef_bg;
+  currentChar.rendition = ef_re;
+
+  int i = 0;
+  int newCursorX = cuX + w--;
+  while(w)
+  {
+     i++;
+   
+     if ( screenLines[cuY].size() < cuX + i + 1 )
+         screenLines[cuY].resize(cuX+i+1);
+     
+     Character& ch = screenLines[cuY][cuX + i];
+     ch.character = 0;
+     ch.foregroundColor = ef_fg;
+     ch.backgroundColor = ef_bg;
+     ch.rendition = ef_re;
+
+     w--;
+  }
+  cuX = newCursorX;
+}
+
+void Screen::compose(const QString& /*compose*/)
+{
+   Q_ASSERT( 0 /*Not implemented yet*/ );
+
+/*  if (lastPos == -1)
+     return;
+     
+  QChar c(image[lastPos].character);
+  compose.prepend(c);
+  //compose.compose(); ### FIXME!
+  image[lastPos].character = compose[0].unicode();*/
+}
+
+int Screen::scrolledLines() const
+{
+        return _scrolledLines;
+}
+int Screen::droppedLines() const
+{
+    return _droppedLines;
+}
+void Screen::resetDroppedLines()
+{
+    _droppedLines = 0;
+}
+void Screen::resetScrolledLines()
+{
+    //kDebug() << "scrolled lines reset";
+
+    _scrolledLines = 0;
+}
+
+// Region commands -------------------------------------------------------------
+
+void Screen::scrollUp(int n)
+{
+   if (n == 0) n = 1; // Default
+   if (tmargin == 0) addHistLine(); // hist.history
+   scrollUp(tmargin, n);
+}
+
+/*! scroll up `n' lines within current region.
+    The `n' new lines are cleared.
+    \sa setRegion \sa scrollDown
+*/
+
+QRect Screen::lastScrolledRegion() const
+{
+    return _lastScrolledRegion;
+}
+
+void Screen::scrollUp(int from, int n)
+{
+  if (n <= 0 || from + n > bmargin) return;
+
+  _scrolledLines -= n;
+  _lastScrolledRegion = QRect(0,tmargin,columns-1,(bmargin-tmargin));
+
+  //FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds.
+  moveImage(loc(0,from),loc(0,from+n),loc(columns-1,bmargin));
+  clearImage(loc(0,bmargin-n+1),loc(columns-1,bmargin),' ');
+}
+
+void Screen::scrollDown(int n)
+{
+   if (n == 0) n = 1; // Default
+   scrollDown(tmargin, n);
+}
+
+/*! scroll down `n' lines within current region.
+    The `n' new lines are cleared.
+    \sa setRegion \sa scrollUp
+*/
+
+void Screen::scrollDown(int from, int n)
+{
+
+  //kDebug() << "Screen::scrollDown( from: " << from << " , n: " << n << ")";
+  
+  _scrolledLines += n;
+
+//FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds.
+  if (n <= 0) return;
+  if (from > bmargin) return;
+  if (from + n > bmargin) n = bmargin - from;
+  moveImage(loc(0,from+n),loc(0,from),loc(columns-1,bmargin-n));
+  clearImage(loc(0,from),loc(columns-1,from+n-1),' ');
+}
+
+void Screen::setCursorYX(int y, int x)
+{
+  setCursorY(y); setCursorX(x);
+}
+
+void Screen::setCursorX(int x)
+{
+  if (x == 0) x = 1; // Default
+  x -= 1; // Adjust
+  cuX = qMax(0,qMin(columns-1, x));
+}
+
+void Screen::setCursorY(int y)
+{
+  if (y == 0) y = 1; // Default
+  y -= 1; // Adjust
+  cuY = qMax(0,qMin(lines  -1, y + (getMode(MODE_Origin) ? tmargin : 0) ));
+}
+
+void Screen::home()
+{
+  cuX = 0;
+  cuY = 0;
+}
+
+void Screen::Return()
+{
+  cuX = 0;
+}
+
+int Screen::getCursorX() const
+{
+  return cuX;
+}
+
+int Screen::getCursorY() const
+{
+  return cuY;
+}
+
+// Erasing ---------------------------------------------------------------------
+
+/*! \section Erasing
+
+    This group of operations erase parts of the screen contents by filling
+    it with spaces colored due to the current rendition settings.
+
+    Althought the cursor position is involved in most of these operations,
+    it is never modified by them.
+*/
+
+/*! fill screen between (including) `loca' (start) and `loce' (end) with spaces.
+
+    This is an internal helper functions. The parameter types are internal
+    addresses of within the screen image and make use of the way how the
+    screen matrix is mapped to the image vector.
+*/
+
+void Screen::clearImage(int loca, int loce, char c)
+{ 
+  int scr_TL=loc(0,hist->getLines());
+  //FIXME: check positions
+
+  //Clear entire selection if it overlaps region to be moved...
+  if ( (sel_BR > (loca+scr_TL) )&&(sel_TL < (loce+scr_TL)) )
+  {
+    clearSelection();
+  }
+
+  int topLine = loca/columns;
+  int bottomLine = loce/columns;
+
+  Character clearCh(c,cu_fg,cu_bg,DEFAULT_RENDITION);
+  
+  //if the character being used to clear the area is the same as the
+  //default character, the affected lines can simply be shrunk.
+  bool isDefaultCh = (clearCh == Character());
+
+  for (int y=topLine;y<=bottomLine;y++)
+  {
+        lineProperties[y] = 0;
+
+        int endCol = ( y == bottomLine) ? loce%columns : columns-1;
+        int startCol = ( y == topLine ) ? loca%columns : 0;
+
+        QVector<Character>& line = screenLines[y];
+
+        if ( isDefaultCh && endCol == columns-1 )
+        {
+            line.resize(startCol);
+        }
+        else
+        {
+            if (line.size() < endCol + 1)
+                line.resize(endCol+1);
+
+            Character* data = line.data();
+            for (int i=startCol;i<=endCol;i++)
+                data[i]=clearCh;
+        }
+  }
+}
+
+/*! move image between (including) `sourceBegin' and `sourceEnd' to 'dest'.
+    
+    The 'dest', 'sourceBegin' and 'sourceEnd' parameters can be generated using
+    the loc(column,line) macro.
+
+NOTE:  moveImage() can only move whole lines.
+
+    This is an internal helper functions. The parameter types are internal
+    addresses of within the screen image and make use of the way how the
+    screen matrix is mapped to the image vector.
+*/
+
+void Screen::moveImage(int dest, int sourceBegin, int sourceEnd)
+{
+  //kDebug() << "moving image from (" << (sourceBegin/columns) 
+  //    << "," << (sourceEnd/columns) << ") to " <<
+  //    (dest/columns);
+
+  Q_ASSERT( sourceBegin <= sourceEnd );
+ 
+  int lines=(sourceEnd-sourceBegin)/columns;
+
+  //move screen image and line properties:
+  //the source and destination areas of the image may overlap, 
+  //so it matters that we do the copy in the right order - 
+  //forwards if dest < sourceBegin or backwards otherwise.
+  //(search the web for 'memmove implementation' for details)
+  if (dest < sourceBegin)
+  {
+    for (int i=0;i<=lines;i++)
+    {
+        screenLines[ (dest/columns)+i ] = screenLines[ (sourceBegin/columns)+i ];
+        lineProperties[(dest/columns)+i]=lineProperties[(sourceBegin/columns)+i];
+    }
+  }
+  else
+  {
+    for (int i=lines;i>=0;i--)
+    {
+        screenLines[ (dest/columns)+i ] = screenLines[ (sourceBegin/columns)+i ];
+        lineProperties[(dest/columns)+i]=lineProperties[(sourceBegin/columns)+i];
+    }
+  }
+
+  if (lastPos != -1)
+  {
+     int diff = dest - sourceBegin; // Scroll by this amount
+     lastPos += diff;
+     if ((lastPos < 0) || (lastPos >= (lines*columns)))
+        lastPos = -1;
+  }
+     
+  // Adjust selection to follow scroll.
+  if (sel_begin != -1)
+  {
+     bool beginIsTL = (sel_begin == sel_TL);
+     int diff = dest - sourceBegin; // Scroll by this amount
+     int scr_TL=loc(0,hist->getLines());
+     int srca = sourceBegin+scr_TL; // Translate index from screen to global
+     int srce = sourceEnd+scr_TL; // Translate index from screen to global
+     int desta = srca+diff;
+     int deste = srce+diff;
+
+     if ((sel_TL >= srca) && (sel_TL <= srce))
+        sel_TL += diff;
+     else if ((sel_TL >= desta) && (sel_TL <= deste))
+        sel_BR = -1; // Clear selection (see below)
+
+     if ((sel_BR >= srca) && (sel_BR <= srce))
+        sel_BR += diff;
+     else if ((sel_BR >= desta) && (sel_BR <= deste))
+        sel_BR = -1; // Clear selection (see below)
+
+     if (sel_BR < 0)
+     {
+        clearSelection();
+     }
+     else
+     {
+        if (sel_TL < 0)
+           sel_TL = 0;
+     }
+
+     if (beginIsTL)
+        sel_begin = sel_TL;
+     else
+        sel_begin = sel_BR;
+  }
+}
+
+void Screen::clearToEndOfScreen()
+{
+  clearImage(loc(cuX,cuY),loc(columns-1,lines-1),' ');
+}
+
+void Screen::clearToBeginOfScreen()
+{
+  clearImage(loc(0,0),loc(cuX,cuY),' ');
+}
+
+void Screen::clearEntireScreen()
+{
+  // Add entire screen to history
+  for (int i = 0; i < (lines-1); i++)
+  {
+    addHistLine(); scrollUp(0,1);
+  }
+
+  clearImage(loc(0,0),loc(columns-1,lines-1),' ');
+}
+
+/*! fill screen with 'E'
+    This is to aid screen alignment
+*/
+
+void Screen::helpAlign()
+{
+  clearImage(loc(0,0),loc(columns-1,lines-1),'E');
+}
+
+void Screen::clearToEndOfLine()
+{
+  clearImage(loc(cuX,cuY),loc(columns-1,cuY),' ');
+}
+
+void Screen::clearToBeginOfLine()
+{
+  clearImage(loc(0,cuY),loc(cuX,cuY),' ');
+}
+
+void Screen::clearEntireLine()
+{
+  clearImage(loc(0,cuY),loc(columns-1,cuY),' ');
+}
+
+void Screen::setRendition(int re)
+{
+  cu_re |= re;
+  effectiveRendition();
+}
+
+void Screen::resetRendition(int re)
+{
+  cu_re &= ~re;
+  effectiveRendition();
+}
+
+void Screen::setDefaultRendition()
+{
+  setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR);
+  setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR);
+  cu_re   = DEFAULT_RENDITION;
+  effectiveRendition();
+}
+
+void Screen::setForeColor(int space, int color)
+{
+  cu_fg = CharacterColor(space, color);
+
+  if ( cu_fg.isValid() ) 
+    effectiveRendition();
+  else 
+    setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR);
+}
+
+void Screen::setBackColor(int space, int color)
+{
+  cu_bg = CharacterColor(space, color);
+
+  if ( cu_bg.isValid() ) 
+    effectiveRendition();
+  else
+    setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR);
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                            Marking & Selection                            */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+void Screen::clearSelection()
+{
+  sel_BR = -1;
+  sel_TL = -1;
+  sel_begin = -1;
+}
+
+void Screen::getSelectionStart(int& column , int& line)
+{
+    if ( sel_TL != -1 )
+    {
+        column = sel_TL % columns;
+        line = sel_TL / columns; 
+    }
+    else
+    {
+        column = cuX + getHistLines();
+        line = cuY + getHistLines();
+    }
+}
+void Screen::getSelectionEnd(int& column , int& line)
+{
+    if ( sel_BR != -1 )
+    {
+        column = sel_BR % columns;
+        line = sel_BR / columns;
+    }
+    else
+    {
+        column = cuX + getHistLines();
+        line = cuY + getHistLines();
+    } 
+}
+void Screen::setSelectionStart(/*const ScreenCursor& viewCursor ,*/ const int x, const int y, const bool mode)
+{
+//  kDebug(1211) << "setSelBeginXY(" << x << "," << y << ")";
+  sel_begin = loc(x,y); //+histCursor) ;
+
+  /* FIXME, HACK to correct for x too far to the right... */
+  if (x == columns) sel_begin--;
+
+  sel_BR = sel_begin;
+  sel_TL = sel_begin;
+  columnmode = mode;
+}
+
+void Screen::setSelectionEnd( const int x, const int y)
+{
+//  kDebug(1211) << "setSelExtentXY(" << x << "," << y << ")";
+  if (sel_begin == -1) return;
+  int l =  loc(x,y); // + histCursor);
+
+  if (l < sel_begin)
+  {
+    sel_TL = l;
+    sel_BR = sel_begin;
+  }
+  else
+  {
+    /* FIXME, HACK to correct for x too far to the right... */
+    if (x == columns) l--;
+
+    sel_TL = sel_begin;
+    sel_BR = l;
+  }
+}
+
+bool Screen::isSelected( const int x,const int y) const
+{
+  if (columnmode) {
+    int sel_Left,sel_Right;
+    if ( sel_TL % columns < sel_BR % columns ) {
+      sel_Left = sel_TL; sel_Right = sel_BR;
+    } else {
+      sel_Left = sel_BR; sel_Right = sel_TL;
+    }
+    return ( x >= sel_Left % columns ) && ( x <= sel_Right % columns ) &&
+           ( y >= sel_TL / columns ) && ( y <= sel_BR / columns );
+            //( y+histCursor >= sel_TL / columns ) && ( y+histCursor <= sel_BR / columns );
+  }
+  else {
+  //int pos = loc(x,y+histCursor);
+  int pos = loc(x,y);
+  return ( pos >= sel_TL && pos <= sel_BR );
+  }
+}
+
+QString Screen::selectedText(bool preserveLineBreaks)
+{
+  QString result;
+  QTextStream stream(&result, QIODevice::ReadWrite);
+  
+  PlainTextDecoder decoder;
+  decoder.begin(&stream);
+  writeSelectionToStream(&decoder , preserveLineBreaks);
+  decoder.end();
+  
+  return result;
+}
+
+bool Screen::isSelectionValid() const
+{
+    return ( sel_TL >= 0 && sel_BR >= 0 );
+}
+
+void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , 
+                                    bool preserveLineBreaks)
+{
+    // do nothing if selection is invalid
+    if ( !isSelectionValid() )
+        return;
+
+	int top = sel_TL / columns;	
+	int left = sel_TL % columns;
+
+	int bottom = sel_BR / columns;
+	int right = sel_BR % columns;
+
+    Q_ASSERT( top >= 0 && left >= 0 && bottom >= 0 && right >= 0 );
+
+    //kDebug() << "sel_TL = " << sel_TL;
+    //kDebug() << "columns = " << columns;
+
+	for (int y=top;y<=bottom;y++)
+	{
+			int start = 0;
+			if ( y == top || columnmode ) start = left;
+		
+			int count = -1;
+			if ( y == bottom || columnmode ) count = right - start + 1;
+
+            const bool appendNewLine = ( y != bottom );
+			copyLineToStream( y,
+                              start,
+                              count,
+                              decoder, 
+                              appendNewLine,
+                              preserveLineBreaks );
+	}	
+}
+
+
+void Screen::copyLineToStream(int line , 
+                              int start, 
+                              int count,
+                              TerminalCharacterDecoder* decoder,
+                              bool appendNewLine,
+                              bool preserveLineBreaks)
+{
+		//buffer to hold characters for decoding
+		//the buffer is static to avoid initialising every 
+        //element on each call to copyLineToStream
+		//(which is unnecessary since all elements will be overwritten anyway)
+		static const int MAX_CHARS = 1024;
+		static Character characterBuffer[MAX_CHARS];
+		
+		assert( count < MAX_CHARS );
+
+        LineProperty currentLineProperties = 0;
+
+		//determine if the line is in the history buffer or the screen image
+		if (line < hist->getLines())
+		{
+            const int lineLength = hist->getLineLen(line);
+
+            // ensure that start position is before end of line
+            start = qMin(start,qMax(0,lineLength-1));
+
+			//retrieve line from history buffer
+			if (count == -1)
+            {
+					count = lineLength-start;
+            }
+			else
+            {
+					count = qMin(start+count,lineLength)-start;
+            }
+
+            // safety checks
+            assert( start >= 0 );
+            assert( count >= 0 );    
+            assert( (start+count) <= hist->getLineLen(line) );
+
+			hist->getCells(line,start,count,characterBuffer);
+
+            if ( hist->isWrappedLine(line) )
+                currentLineProperties |= LINE_WRAPPED;
+		}
+		else
+		{
+			if ( count == -1 )
+					count = columns - start;
+
+            assert( count >= 0 );
+
+            const int screenLine = line-hist->getLines();
+
+            Character* data = screenLines[screenLine].data();
+            int length = screenLines[screenLine].count();
+
+			//retrieve line from screen image
+			for (int i=start;i < qMin(start+count,length);i++)
+			{
+			    characterBuffer[i-start] = data[i];
+            }
+
+            // count cannot be any greater than length
+			count = qBound(0,count,length-start);
+
+            Q_ASSERT( screenLine < lineProperties.count() );
+            currentLineProperties |= lineProperties[screenLine]; 
+		}
+
+		//do not decode trailing whitespace characters
+		for (int i=count-1 ; i >= 0; i--)
+				if (QChar(characterBuffer[i].character).isSpace())
+						count--;
+				else
+						break;
+
+        // add new line character at end
+        const bool omitLineBreak = (currentLineProperties & LINE_WRAPPED) ||
+                                   !preserveLineBreaks;
+
+        if ( !omitLineBreak && appendNewLine && (count+1 < MAX_CHARS) )
+        {
+            characterBuffer[count] = '\n';
+            count++;
+        }
+
+		//decode line and write to text stream	
+		decoder->decodeLine( (Character*) characterBuffer , 
+                             count, currentLineProperties );
+}
+
+// Method below has been removed because of its reliance on 'histCursor'
+// and I want to restrict the methods which have knowledge of the scroll position
+// to just those which deal with selection and supplying final screen images.
+//
+/*void Screen::writeToStream(QTextStream* stream , TerminalCharacterDecoder* decoder) {
+  sel_begin = 0;
+  sel_BR = sel_begin;
+  sel_TL = sel_begin;
+  setSelectionEnd(columns-1,lines-1+hist->getLines()-histCursor);
+  
+  writeSelectionToStream(stream,decoder);
+  
+  clearSelection();
+}*/
+
+void Screen::writeToStream(TerminalCharacterDecoder* decoder, int from, int to)
+{
+	sel_begin = loc(0,from);
+	sel_TL = sel_begin;
+	sel_BR = loc(columns-1,to);
+	writeSelectionToStream(decoder);
+	clearSelection();
+}
+
+QString Screen::getHistoryLine(int no)
+{
+  sel_begin = loc(0,no);
+  sel_TL = sel_begin;
+  sel_BR = loc(columns-1,no);
+  return selectedText(false);
+}
+
+void Screen::addHistLine()
+{
+  // add line to history buffer
+  // we have to take care about scrolling, too...
+
+  if (hasScroll())
+  {
+    int oldHistLines = hist->getLines();
+
+    hist->addCellsVector(screenLines[0]);
+    hist->addLine( lineProperties[0] & LINE_WRAPPED );
+
+    int newHistLines = hist->getLines();
+
+    bool beginIsTL = (sel_begin == sel_TL);
+
+    // If the history is full, increment the count
+    // of dropped lines
+    if ( newHistLines == oldHistLines )
+        _droppedLines++;
+
+    // Adjust selection for the new point of reference
+    if (newHistLines > oldHistLines)
+    {
+       if (sel_begin != -1)
+       {
+          sel_TL += columns;
+          sel_BR += columns;
+       }
+    }
+
+    if (sel_begin != -1)
+    {
+       // Scroll selection in history up
+       int top_BR = loc(0, 1+newHistLines);
+
+       if (sel_TL < top_BR)
+          sel_TL -= columns;
+
+       if (sel_BR < top_BR)
+          sel_BR -= columns;
+
+       if (sel_BR < 0)
+       {
+          clearSelection();
+       }
+       else
+       {
+          if (sel_TL < 0)
+             sel_TL = 0;
+       }
+
+       if (beginIsTL)
+          sel_begin = sel_TL;
+       else
+          sel_begin = sel_BR;
+    }
+  }
+
+}
+
+int Screen::getHistLines()
+{
+  return hist->getLines();
+}
+
+void Screen::setScroll(const HistoryType& t , bool copyPreviousScroll)
+{
+  clearSelection();
+
+  if ( copyPreviousScroll )
+    hist = t.scroll(hist);
+  else
+  {
+      HistoryScroll* oldScroll = hist;
+      hist = t.scroll(0);
+      delete oldScroll;
+  }
+}
+
+bool Screen::hasScroll()
+{
+  return hist->hasScroll();
+}
+
+const HistoryType& Screen::getScroll()
+{
+  return hist->getType();
+}
+
+void Screen::setLineProperty(LineProperty property , bool enable)
+{
+	if ( enable )
+	{
+		lineProperties[cuY] = (LineProperty)(lineProperties[cuY] | property);
+	}
+	else
+	{
+		lineProperties[cuY] = (LineProperty)(lineProperties[cuY] & ~property);
+	}
+}
+void Screen::fillWithDefaultChar(Character* dest, int count)
+{
+	for (int i=0;i<count;i++)
+		dest[i] = defaultChar;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Screen.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,662 @@
+/*
+    This file is part of Konsole, KDE's terminal.
+
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 SCREEN_H
+#define SCREEN_H
+
+// Qt
+#include <QtCore/QRect>
+#include <QtCore/QTextStream>
+#include <QtCore/QVarLengthArray>
+
+// Konsole
+#include "Character.h"
+#include "History.h"
+
+#define MODE_Origin    0
+#define MODE_Wrap      1
+#define MODE_Insert    2
+#define MODE_Screen    3
+#define MODE_Cursor    4
+#define MODE_NewLine   5
+#define MODES_SCREEN   6
+
+namespace Konsole
+{
+
+/*!
+*/
+struct ScreenParm
+{
+  int mode[MODES_SCREEN];
+};
+
+class TerminalCharacterDecoder;
+
+/**
+    \brief An image of characters with associated attributes.
+
+    The terminal emulation ( Emulation ) receives a serial stream of
+    characters from the program currently running in the terminal.
+    From this stream it creates an image of characters which is ultimately
+    rendered by the display widget ( TerminalDisplay ).  Some types of emulation
+    may have more than one screen image. 
+
+    getImage() is used to retrieve the currently visible image
+    which is then used by the display widget to draw the output from the
+    terminal. 
+
+    The number of lines of output history which are kept in addition to the current
+    screen image depends on the history scroll being used to store the output.  
+    The scroll is specified using setScroll()
+    The output history can be retrieved using writeToStream()
+
+    The screen image has a selection associated with it, specified using 
+    setSelectionStart() and setSelectionEnd().  The selected text can be retrieved
+    using selectedText().  When getImage() is used to retrieve the the visible image,
+    characters which are part of the selection have their colours inverted.   
+*/
+class Screen
+{
+public:
+    /** Construct a new screen image of size @p lines by @p columns. */
+    Screen(int lines, int columns);
+    ~Screen();
+
+    // VT100/2 Operations 
+    // Cursor Movement
+    
+    /** Move the cursor up by @p n lines. */
+    void cursorUp    (int n);
+    /** Move the cursor down by @p n lines. */
+    void cursorDown  (int n);
+    /** Move the cursor to the left by @p n columns. */
+    void cursorLeft  (int n);
+    /** Move the cursor to the right by @p n columns. */
+    void cursorRight (int n);
+    /** Position the cursor on line @p y. */
+    void setCursorY  (int y);
+    /** Position the cursor at column @p x. */
+    void setCursorX  (int x);
+    /** Position the cursor at line @p y, column @p x. */
+    void setCursorYX (int y, int x);
+    /**
+     * Sets the margins for scrolling the screen.
+     *
+     * @param topLine The top line of the new scrolling margin. 
+     * @param bottomLine The bottom line of the new scrolling margin. 
+     */
+    void setMargins  (int topLine , int bottomLine);
+    /** Returns the top line of the scrolling region. */ 
+    int topMargin() const;
+    /** Returns the bottom line of the scrolling region. */
+    int bottomMargin() const;
+
+    /** 
+     * Resets the scrolling margins back to the top and bottom lines
+     * of the screen.
+     */
+    void setDefaultMargins();
+    
+    /** 
+     * Moves the cursor down one line, if the MODE_NewLine mode 
+     * flag is enabled then the cursor is returned to the leftmost
+     * column first.
+     *
+     * Equivalent to NextLine() if the MODE_NewLine flag is set
+     * or index() otherwise. 
+     */
+    void NewLine     ();
+    /**
+     * Moves the cursor down one line and positions it at the beginning
+     * of the line.
+     */
+    void NextLine    ();
+
+    /** 
+     * Move the cursor down one line.  If the cursor is on the bottom
+     * line of the scrolling region (as returned by bottomMargin()) the
+     * scrolling region is scrolled up by one line instead.
+     */
+    void index       ();
+    /**
+     * Move the cursor up one line.  If the cursor is on the top line
+     * of the scrolling region (as returned by topMargin()) the scrolling
+     * region is scrolled down by one line instead.
+     */
+    void reverseIndex();
+    
+    /** 
+     * Scroll the scrolling region of the screen up by @p n lines. 
+     * The scrolling region is initially the whole screen, but can be changed 
+     * using setMargins()
+     */ 
+    void scrollUp(int n);
+    /**
+     * Scroll the scrolling region of the screen down by @p n lines.
+     * The scrolling region is initially the whole screen, but can be changed
+     * using setMargins()
+     */
+    void scrollDown(int n);
+    
+    /** 
+     * Moves the cursor to the beginning of the current line. 
+     * Equivalent to setCursorX(0)
+     */
+    void Return      ();
+    /** 
+     * Moves the cursor one column to the left and erases the character
+     * at the new cursor position.
+     */
+    void BackSpace   ();
+    /** 
+     * Moves the cursor @p n tab-stops to the right.
+     */
+    void Tabulate    (int n = 1);
+    /** 
+     * Moves the cursor @p n tab-stops to the left. 
+     */
+    void backTabulate(int n);
+    
+    // Editing
+    
+    /** 
+     * Erase @p n characters beginning from the current cursor position. 
+     * This is equivalent to over-writing @p n characters starting with the current
+     * cursor position with spaces.
+     * If @p n is 0 then one character is erased. 
+     */
+    void eraseChars  (int n);
+    /** 
+     * Delete @p n characters beginning from the current cursor position. 
+     * If @p n is 0 then one character is deleted. 
+     */
+    void deleteChars (int n);
+    /**
+     * Insert @p n blank characters beginning from the current cursor position.
+     * The position of the cursor is not altered.  
+     * If @p n is 0 then one character is inserted.
+     */
+    void insertChars (int n);
+    /** 
+     * Removes @p n lines beginning from the current cursor position.
+     * The position of the cursor is not altered.
+     * If @p n is 0 then one line is removed.
+     */
+    void deleteLines (int n);
+    /**
+     * Inserts @p lines beginning from the current cursor position.
+     * The position of the cursor is not altered.
+     * If @p n is 0 then one line is inserted.
+     */
+    void insertLines (int n);
+    /** Clears all the tab stops. */
+    void clearTabStops();
+    /**  Sets or removes a tab stop at the cursor's current column. */ 
+    void changeTabStop(bool set);
+   
+    /** Resets (clears) the specified screen @p mode. */
+    void resetMode   (int mode);
+    /** Sets (enables) the specified screen @p mode. */
+    void setMode     (int mode);
+    /** 
+     * Saves the state of the specified screen @p mode.  It can be restored
+     * using restoreMode()
+     */
+    void saveMode    (int mode);
+    /** Restores the state of a screen @p mode saved by calling saveMode() */
+    void restoreMode (int mode);
+    /** Returns whether the specified screen @p mode is enabled or not .*/
+    bool getMode     (int mode) const;
+   
+    /** 
+     * Saves the current position and appearence (text color and style) of the cursor. 
+     * It can be restored by calling restoreCursor() 
+     */ 
+    void saveCursor  ();
+    /** Restores the position and appearence of the cursor.  See saveCursor() */
+    void restoreCursor();
+   
+    /** Clear the whole screen, moving the current screen contents into the history first. */ 
+    void clearEntireScreen();
+    /** 
+     * Clear the area of the screen from the current cursor position to the end of 
+     * the screen.
+     */
+    void clearToEndOfScreen();
+    /**
+     * Clear the area of the screen from the current cursor position to the start
+     * of the screen.
+     */
+    void clearToBeginOfScreen();
+    /** Clears the whole of the line on which the cursor is currently positioned. */
+    void clearEntireLine();
+    /** Clears from the current cursor position to the end of the line. */
+    void clearToEndOfLine();
+    /** Clears from the current cursor position to the beginning of the line. */
+    void clearToBeginOfLine();
+    
+    /** Fills the entire screen with the letter 'E' */
+    void helpAlign   ();
+       
+    /** 
+     * Enables the given @p rendition flag.  Rendition flags control the appearence 
+     * of characters on the screen.
+     *
+     * @see Character::rendition
+     */  
+    void setRendition  (int rendition);
+    /**
+     * Disables the given @p rendition flag.  Rendition flags control the appearence
+     * of characters on the screen.
+     *
+     * @see Character::rendition
+     */
+    void resetRendition(int rendition);
+    
+    /** 
+     * Sets the cursor's foreground color.
+     * @param space The color space used by the @p color argument
+     * @param color The new foreground color.  The meaning of this depends on
+     * the color @p space used.
+     *
+     * @see CharacterColor
+     */
+    void setForeColor  (int space, int color);
+    /**
+     * Sets the cursor's background color.
+     * @param space The color space used by the @p color argumnet.
+     * @param color The new background color.  The meaning of this depends on
+     * the color @p space used.
+     *
+     * @see CharacterColor
+     */
+    void setBackColor  (int space, int color);
+    /** 
+     * Resets the cursor's color back to the default and sets the 
+     * character's rendition flags back to the default settings.
+     */
+    void setDefaultRendition();
+    
+    /** Returns the column which the cursor is positioned at. */
+    int  getCursorX() const;
+    /** Returns the line which the cursor is positioned on. */
+    int  getCursorY() const;
+   
+	/** TODO Document me */ 
+	void clear();
+    /** 
+     * Sets the position of the cursor to the 'home' position at the top-left
+     * corner of the screen (0,0) 
+     */
+    void home();
+    /**
+     * Resets the state of the screen.  This resets the various screen modes
+     * back to their default states.  The cursor style and colors are reset
+     * (as if setDefaultRendition() had been called)
+     *
+     * <ul>
+     * <li>Line wrapping is enabled.</li>
+     * <li>Origin mode is disabled.</li>
+     * <li>Insert mode is disabled.</li>
+     * <li>Cursor mode is enabled.  TODO Document me</li>
+     * <li>Screen mode is disabled. TODO Document me</li>
+     * <li>New line mode is disabled.  TODO Document me</li>
+     * </ul>
+     *
+     * If @p clearScreen is true then the screen contents are erased entirely, 
+     * otherwise they are unaltered.
+     */
+    void reset(bool clearScreen = true);
+   
+    /** 
+     * Displays a new character at the current cursor position. 
+     * 
+     * If the cursor is currently positioned at the right-edge of the screen and
+     * line wrapping is enabled then the character is added at the start of a new 
+     * line below the current one.
+     *
+     * If the MODE_Insert screen mode is currently enabled then the character 
+     * is inserted at the current cursor position, otherwise it will replace the 
+     * character already at the current cursor position.  
+     */ 
+    void ShowCharacter(unsigned short c);
+    
+    // Do composition with last shown character FIXME: Not implemented yet for KDE 4
+    void compose(const QString& compose);
+    
+    /** 
+     * Resizes the image to a new fixed size of @p new_lines by @p new_columns.  
+     * In the case that @p new_columns is smaller than the current number of columns,
+     * existing lines are not truncated.  This prevents characters from being lost
+     * if the terminal display is resized smaller and then larger again.
+     *
+     * (note that in versions of Konsole prior to KDE 4, existing lines were
+     *  truncated when making the screen image smaller)
+     */
+    void resizeImage(int new_lines, int new_columns);
+    
+    /**
+     * Returns the current screen image.  
+     * The result is an array of Characters of size [getLines()][getColumns()] which
+     * must be freed by the caller after use.
+     *
+     * @param dest Buffer to copy the characters into
+     * @param size Size of @p dest in Characters
+     * @param startLine Index of first line to copy
+     * @param endLine Index of last line to copy
+     */
+    void getImage( Character* dest , int size , int startLine , int endLine ) const;
+
+    /** 
+     * Returns the additional attributes associated with lines in the image.
+     * The most important attribute is LINE_WRAPPED which specifies that the 
+     * line is wrapped,
+     * other attributes control the size of characters in the line.
+     */
+    QVector<LineProperty> getLineProperties( int startLine , int endLine ) const;
+	
+
+    /** Return the number of lines. */
+    int  getLines()   { return lines; }
+    /** Return the number of columns. */
+    int  getColumns() { return columns; }
+    /** Return the number of lines in the history buffer. */
+    int  getHistLines ();
+    /** 
+     * Sets the type of storage used to keep lines in the history. 
+     * If @p copyPreviousScroll is true then the contents of the previous 
+     * history buffer are copied into the new scroll.
+     */
+    void setScroll(const HistoryType& , bool copyPreviousScroll = true);
+    /** Returns the type of storage used to keep lines in the history. */
+    const HistoryType& getScroll();
+    /** 
+     * Returns true if this screen keeps lines that are scrolled off the screen
+     * in a history buffer.
+     */
+    bool hasScroll();
+
+    /** 
+     * Sets the start of the selection.
+     *
+     * @param column The column index of the first character in the selection.
+     * @param line The line index of the first character in the selection.
+     * @param columnmode True if the selection is in column mode.
+     */
+    void setSelectionStart(const int column, const int line, const bool columnmode);
+    
+    /**
+     * Sets the end of the current selection.
+     *
+     * @param column The column index of the last character in the selection.
+     * @param line The line index of the last character in the selection. 
+     */ 
+    void setSelectionEnd(const int column, const int line);
+   
+    /**
+     * Retrieves the start of the selection or the cursor position if there
+     * is no selection.
+     */
+    void getSelectionStart(int& column , int& line);
+    
+    /**
+     * Retrieves the end of the selection or the cursor position if there
+     * is no selection.
+     */
+    void getSelectionEnd(int& column , int& line);
+
+    /** Clears the current selection */
+    void clearSelection();
+
+    void setBusySelecting(bool busy) { sel_busy = busy; }
+
+    /** 
+ 	 * 	Returns true if the character at (@p column, @p line) is part of the
+ 	 *  current selection. 
+ 	 */ 
+    bool isSelected(const int column,const int line) const;
+
+    /** 
+     * Convenience method.  Returns the currently selected text. 
+     * @param preserveLineBreaks Specifies whether new line characters should 
+     * be inserted into the returned text at the end of each terminal line.
+     */
+    QString selectedText(bool preserveLineBreaks);
+	    
+	/**
+	 * Copies part of the output to a stream.
+	 *
+	 * @param decoder A decoder which coverts terminal characters into text
+	 * @param from The first line in the history to retrieve
+	 * @param to The last line in the history to retrieve
+	 */
+	void writeToStream(TerminalCharacterDecoder* decoder, int from, int to);
+
+    /** 
+     * Sets the selection to line @p no in the history and returns
+     * the text of that line from the history buffer.
+     */
+    QString getHistoryLine(int no);
+
+	/**
+	 * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY
+	 * into a stream.
+	 *
+	 * @param decoder A decoder which converts terminal characters into text.  
+	 * PlainTextDecoder is the most commonly used decoder which coverts characters 
+	 * into plain text with no formatting.
+     * @param preserveLineBreaks Specifies whether new line characters should 
+     * be inserted into the returned text at the end of each terminal line. 
+	 */
+	void writeSelectionToStream(TerminalCharacterDecoder* decoder , bool
+                                preserveLineBreaks = true);
+
+    /** TODO Document me */
+    void checkSelection(int from, int to);
+
+	/** 
+	 * Sets or clears an attribute of the current line.
+	 * 
+	 * @param property The attribute to set or clear
+	 * Possible properties are:
+	 * LINE_WRAPPED:	 Specifies that the line is wrapped.
+	 * LINE_DOUBLEWIDTH: Specifies that the characters in the current line should be double the normal width.
+	 * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line should be double the normal height.
+     *                   Double-height lines are formed of two lines containing the same characters,
+     *                   with both having the LINE_DOUBLEHEIGHT attribute.  This allows other parts of the 
+     *                   code to work on the assumption that all lines are the same height.
+	 *
+	 * @param enable true to apply the attribute to the current line or false to remove it
+	 */
+	void setLineProperty(LineProperty property , bool enable);
+
+
+    /** 
+     * Returns the number of lines that the image has been scrolled up or down by,
+     * since the last call to resetScrolledLines().
+     *
+     * a positive return value indicates that the image has been scrolled up,
+     * a negative return value indicates that the image has been scrolled down. 
+     */
+    int scrolledLines() const;
+
+    /**
+     * Returns the region of the image which was last scrolled.
+     *
+     * This is the area of the image from the top margin to the 
+     * bottom margin when the last scroll occurred.
+     */
+    QRect lastScrolledRegion() const;
+
+    /** 
+     * Resets the count of the number of lines that the image has been scrolled up or down by,
+     * see scrolledLines()
+     */
+    void resetScrolledLines();
+
+    /**
+     * Returns the number of lines of output which have been
+     * dropped from the history since the last call
+     * to resetDroppedLines()
+     *
+     * If the history is not unlimited then it will drop
+     * the oldest lines of output if new lines are added when
+     * it is full.  
+     */
+    int droppedLines() const;
+
+    /**
+     * Resets the count of the number of lines dropped from
+     * the history.
+     */
+    void resetDroppedLines();
+
+	/** 
+ 	 * Fills the buffer @p dest with @p count instances of the default (ie. blank)
+ 	 * Character style.
+ 	 */
+	static void fillWithDefaultChar(Character* dest, int count);
+
+private: 
+
+	//copies a line of text from the screen or history into a stream using a 
+	//specified character decoder
+	//line - the line number to copy, from 0 (the earliest line in the history) up to 
+	//		 hist->getLines() + lines - 1
+	//start - the first column on the line to copy
+	//count - the number of characters on the line to copy
+	//decoder - a decoder which coverts terminal characters (an Character array) into text
+    //appendNewLine - if true a new line character (\n) is appended to the end of the line
+	void copyLineToStream(int line, 
+                          int start, 
+                          int count, 
+                          TerminalCharacterDecoder* decoder,
+                          bool appendNewLine,
+                          bool preserveLineBreaks);
+	
+    //fills a section of the screen image with the character 'c'
+    //the parameters are specified as offsets from the start of the screen image.
+    //the loc(x,y) macro can be used to generate these values from a column,line pair.
+    void clearImage(int loca, int loce, char c);
+
+    //move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'.
+    //the parameters are specified as offsets from the start of the screen image.
+    //the loc(x,y) macro can be used to generate these values from a column,line pair.
+    void moveImage(int dest, int sourceBegin, int sourceEnd);
+    
+    void scrollUp(int from, int i);
+    void scrollDown(int from, int i);
+
+    void addHistLine();
+
+    void initTabStops();
+
+    void effectiveRendition();
+    void reverseRendition(Character& p) const;
+
+    bool isSelectionValid() const;
+
+	// copies 'count' lines from the screen buffer into 'dest',
+	// starting from 'startLine', where 0 is the first line in the screen buffer
+	void copyFromScreen(Character* dest, int startLine, int count) const;
+	// copies 'count' lines from the history buffer into 'dest',
+	// starting from 'startLine', where 0 is the first line in the history
+	void copyFromHistory(Character* dest, int startLine, int count) const;
+
+
+    // screen image ----------------
+    int lines;
+    int columns;
+
+    typedef QVector<Character> ImageLine;      // [0..columns]
+    ImageLine*          screenLines;    // [lines]
+
+    int _scrolledLines;
+    QRect _lastScrolledRegion;
+
+    int _droppedLines;
+
+    QVarLengthArray<LineProperty,64> lineProperties;    
+	
+    // history buffer ---------------
+    HistoryScroll *hist;
+    
+    // cursor location
+    int cuX;
+    int cuY;
+
+    // cursor color and rendition info
+    CharacterColor cu_fg;      // foreground
+    CharacterColor cu_bg;      // background
+    quint8 cu_re;      // rendition
+
+    // margins ----------------
+    int tmargin;      // top margin
+    int bmargin;      // bottom margin
+
+    // states ----------------
+    ScreenParm currParm;
+
+    // ----------------------------
+
+    bool* tabstops;
+
+    // selection -------------------
+    int sel_begin; // The first location selected.
+    int sel_TL;    // TopLeft Location.
+    int sel_BR;    // Bottom Right Location.
+    bool sel_busy; // Busy making a selection.
+    bool columnmode;  // Column selection mode
+
+    // effective colors and rendition ------------
+    CharacterColor ef_fg;      // These are derived from
+    CharacterColor ef_bg;      // the cu_* variables above
+    quint8 ef_re;      // to speed up operation
+
+    //
+    // save cursor, rendition & states ------------
+    // 
+
+    // cursor location
+    int sa_cuX;
+    int sa_cuY;
+
+    // rendition info
+    quint8 sa_cu_re;
+    CharacterColor sa_cu_fg;
+    CharacterColor sa_cu_bg;
+    
+    // last position where we added a character
+    int lastPos;
+
+    // modes
+    ScreenParm saveParm;
+
+    static Character defaultChar;
+};
+
+}
+
+#endif // SCREEN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/ScreenWindow.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,296 @@
+/*
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "ScreenWindow.h"
+
+// Qt
+#include <QtCore>
+
+// Konsole
+#include "Screen.h"
+
+using namespace Konsole;
+
+ScreenWindow::ScreenWindow(QObject* parent)
+    : QObject(parent)
+	, _windowBuffer(0)
+	, _windowBufferSize(0)
+	, _bufferNeedsUpdate(true)
+	, _windowLines(1)
+    , _currentLine(0)
+    , _trackOutput(true)
+    , _scrollCount(0)
+{
+}
+ScreenWindow::~ScreenWindow()
+{
+	delete[] _windowBuffer;
+}
+void ScreenWindow::setScreen(Screen* screen)
+{
+    Q_ASSERT( screen );
+
+    _screen = screen;
+}
+
+Screen* ScreenWindow::screen() const
+{
+    return _screen;
+}
+
+Character* ScreenWindow::getImage()
+{
+	// reallocate internal buffer if the window size has changed
+	int size = windowLines() * windowColumns();
+	if (_windowBuffer == 0 || _windowBufferSize != size) 
+	{
+		delete[] _windowBuffer;
+		_windowBufferSize = size;
+		_windowBuffer = new Character[size];
+		_bufferNeedsUpdate = true;
+	}
+
+	 if (!_bufferNeedsUpdate)
+		return _windowBuffer;
+ 
+	_screen->getImage(_windowBuffer,size,
+					  currentLine(),endWindowLine());
+
+	// this window may look beyond the end of the screen, in which 
+	// case there will be an unused area which needs to be filled
+	// with blank characters
+	fillUnusedArea();
+
+	_bufferNeedsUpdate = false;
+	return _windowBuffer;
+}
+
+void ScreenWindow::fillUnusedArea()
+{
+	int screenEndLine = _screen->getHistLines() + _screen->getLines() - 1;
+	int windowEndLine = currentLine() + windowLines() - 1;
+
+	int unusedLines = windowEndLine - screenEndLine;
+	int charsToFill = unusedLines * windowColumns();
+
+	Screen::fillWithDefaultChar(_windowBuffer + _windowBufferSize - charsToFill,charsToFill); 
+}
+
+// return the index of the line at the end of this window, or if this window 
+// goes beyond the end of the screen, the index of the line at the end
+// of the screen.
+//
+// when passing a line number to a Screen method, the line number should
+// never be more than endWindowLine()
+//
+int ScreenWindow::endWindowLine() const
+{
+	return qMin(currentLine() + windowLines() - 1,
+				lineCount() - 1);
+}
+QVector<LineProperty> ScreenWindow::getLineProperties()
+{
+    QVector<LineProperty> result = _screen->getLineProperties(currentLine(),endWindowLine());
+	
+	if (result.count() != windowLines())
+		result.resize(windowLines());
+
+	return result;
+}
+
+QString ScreenWindow::selectedText( bool preserveLineBreaks ) const
+{
+    return _screen->selectedText( preserveLineBreaks );
+}
+
+void ScreenWindow::getSelectionStart( int& column , int& line )
+{
+    _screen->getSelectionStart(column,line);
+    line -= currentLine();
+}
+void ScreenWindow::getSelectionEnd( int& column , int& line )
+{
+    _screen->getSelectionEnd(column,line);
+    line -= currentLine();
+}
+void ScreenWindow::setSelectionStart( int column , int line , bool columnMode )
+{
+    _screen->setSelectionStart( column , qMin(line + currentLine(),endWindowLine())  , columnMode);
+	
+	_bufferNeedsUpdate = true;
+    emit selectionChanged();
+}
+
+void ScreenWindow::setSelectionEnd( int column , int line )
+{
+    _screen->setSelectionEnd( column , qMin(line + currentLine(),endWindowLine()) );
+
+	_bufferNeedsUpdate = true;
+    emit selectionChanged();
+}
+
+bool ScreenWindow::isSelected( int column , int line )
+{
+    return _screen->isSelected( column , qMin(line + currentLine(),endWindowLine()) );
+}
+
+void ScreenWindow::clearSelection()
+{
+    _screen->clearSelection();
+
+    emit selectionChanged();
+}
+
+void ScreenWindow::setWindowLines(int lines)
+{
+	Q_ASSERT(lines > 0);
+	_windowLines = lines;
+}
+int ScreenWindow::windowLines() const
+{
+	return _windowLines;		
+}
+
+int ScreenWindow::windowColumns() const
+{
+    return _screen->getColumns();
+}
+
+int ScreenWindow::lineCount() const
+{
+    return _screen->getHistLines() + _screen->getLines();
+}
+
+int ScreenWindow::columnCount() const
+{
+    return _screen->getColumns();
+}
+
+QPoint ScreenWindow::cursorPosition() const
+{
+    QPoint position;
+    
+    position.setX( _screen->getCursorX() );
+    position.setY( _screen->getCursorY() );
+
+    return position; 
+}
+
+int ScreenWindow::currentLine() const
+{
+    return qBound(0,_currentLine,lineCount()-windowLines());
+}
+
+void ScreenWindow::scrollBy( RelativeScrollMode mode , int amount )
+{
+    if ( mode == ScrollLines )
+    {
+        scrollTo( currentLine() + amount );
+    }
+    else if ( mode == ScrollPages )
+    {
+        scrollTo( currentLine() + amount * ( windowLines() / 2 ) ); 
+    }
+}
+
+bool ScreenWindow::atEndOfOutput() const
+{
+    return currentLine() == (lineCount()-windowLines());
+}
+
+void ScreenWindow::scrollTo( int line )
+{
+	int maxCurrentLineNumber = lineCount() - windowLines();
+	line = qBound(0,line,maxCurrentLineNumber);
+
+    const int delta = line - _currentLine;
+    _currentLine = line;
+
+    // keep track of number of lines scrolled by,
+    // this can be reset by calling resetScrollCount()
+    _scrollCount += delta;
+
+    _bufferNeedsUpdate = true;
+
+    emit scrolled(_currentLine);
+}
+
+void ScreenWindow::setTrackOutput(bool trackOutput)
+{
+    _trackOutput = trackOutput;
+}
+
+bool ScreenWindow::trackOutput() const
+{
+    return _trackOutput;
+}
+
+int ScreenWindow::scrollCount() const
+{
+    return _scrollCount;
+}
+
+void ScreenWindow::resetScrollCount() 
+{
+    _scrollCount = 0;
+}
+
+QRect ScreenWindow::scrollRegion() const
+{
+	bool equalToScreenSize = windowLines() == _screen->getLines();
+
+	if ( atEndOfOutput() && equalToScreenSize )
+    	return _screen->lastScrolledRegion();
+	else
+		return QRect(0,0,windowColumns(),windowLines());
+}
+
+void ScreenWindow::notifyOutputChanged()
+{
+    // move window to the bottom of the screen and update scroll count
+    // if this window is currently tracking the bottom of the screen
+    if ( _trackOutput )
+    { 
+        _scrollCount -= _screen->scrolledLines();
+        _currentLine = qMax(0,_screen->getHistLines() - (windowLines()-_screen->getLines()));
+    }
+    else
+    {
+        // if the history is not unlimited then it may 
+        // have run out of space and dropped the oldest
+        // lines of output - in this case the screen
+        // window's current line number will need to 
+        // be adjusted - otherwise the output will scroll
+        _currentLine = qMax(0,_currentLine - 
+                              _screen->droppedLines());
+
+        // ensure that the screen window's current position does
+        // not go beyond the bottom of the screen
+        _currentLine = qMin( _currentLine , _screen->getHistLines() );
+    }
+
+	_bufferNeedsUpdate = true;
+
+    emit outputChanged(); 
+}
+
+//#include "moc_ScreenWindow.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/ScreenWindow.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,256 @@
+/*
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 SCREENWINDOW_H
+#define SCREENWINDOW_H
+
+// Qt
+#include <QtCore/QObject>
+#include <QtCore/QPoint>
+#include <QtCore/QRect>
+
+// Konsole
+#include "Character.h"
+
+namespace Konsole
+{
+
+class Screen;
+
+/**
+ * Provides a window onto a section of a terminal screen.
+ * This window can then be rendered by a terminal display widget ( TerminalDisplay ).
+ *
+ * To use the screen window, create a new ScreenWindow() instance and associated it with 
+ * a terminal screen using setScreen().
+ * Use the scrollTo() method to scroll the window up and down on the screen.
+ * Call the getImage() method to retrieve the character image which is currently visible in the window.
+ *
+ * setTrackOutput() controls whether the window moves to the bottom of the associated screen when new
+ * lines are added to it.
+ *
+ * Whenever the output from the underlying screen is changed, the notifyOutputChanged() slot should
+ * be called.  This in turn will update the window's position and emit the outputChanged() signal
+ * if necessary.
+ */
+class ScreenWindow : public QObject
+{
+Q_OBJECT
+
+public:
+    /** 
+     * Constructs a new screen window with the given parent.
+     * A screen must be specified by calling setScreen() before calling getImage() or getLineProperties().
+     *
+     * You should not call this constructor directly, instead use the Emulation::createWindow() method
+     * to create a window on the emulation which you wish to view.  This allows the emulation
+     * to notify the window when the associated screen has changed and synchronize selection updates
+     * between all views on a session.
+     */
+    ScreenWindow(QObject* parent = 0);
+	virtual ~ScreenWindow();
+
+    /** Sets the screen which this window looks onto */
+    void setScreen(Screen* screen);
+    /** Returns the screen which this window looks onto */
+    Screen* screen() const;
+
+    /** 
+     * Returns the image of characters which are currently visible through this window
+     * onto the screen.
+     *
+     * The buffer is managed by the ScreenWindow instance and does not need to be
+     * deleted by the caller.
+     */
+    Character* getImage();
+
+    /**
+     * Returns the line attributes associated with the lines of characters which
+     * are currently visible through this window
+     */
+    QVector<LineProperty> getLineProperties();
+
+    /**
+     * Returns the number of lines which the region of the window
+     * specified by scrollRegion() has been scrolled by since the last call 
+     * to resetScrollCount().  scrollRegion() is in most cases the 
+     * whole window, but will be a smaller area in, for example, applications
+     * which provide split-screen facilities.
+     *
+     * This is not guaranteed to be accurate, but allows views to optimise
+     * rendering by reducing the amount of costly text rendering that
+     * needs to be done when the output is scrolled. 
+     */
+    int scrollCount() const;
+
+    /**
+     * Resets the count of scrolled lines returned by scrollCount()
+     */
+    void resetScrollCount();
+
+    /**
+     * Returns the area of the window which was last scrolled, this is 
+     * usually the whole window area.
+     *
+     * Like scrollCount(), this is not guaranteed to be accurate,
+     * but allows views to optimise rendering.
+     */
+    QRect scrollRegion() const;
+
+    /** 
+     * Sets the start of the selection to the given @p line and @p column within 
+     * the window.
+     */
+    void setSelectionStart( int column , int line , bool columnMode );
+    /**
+     * Sets the end of the selection to the given @p line and @p column within
+     * the window.
+     */
+    void setSelectionEnd( int column , int line ); 
+    /**
+     * Retrieves the start of the selection within the window.
+     */
+    void getSelectionStart( int& column , int& line );
+    /**
+     * Retrieves the end of the selection within the window.
+     */
+    void getSelectionEnd( int& column , int& line );
+    /**
+     * Returns true if the character at @p line , @p column is part of the selection.
+     */
+    bool isSelected( int column , int line );
+    /** 
+     * Clears the current selection
+     */
+    void clearSelection();
+
+	/** Sets the number of lines in the window */
+	void setWindowLines(int lines);
+    /** Returns the number of lines in the window */
+    int windowLines() const;
+    /** Returns the number of columns in the window */
+    int windowColumns() const;
+    
+    /** Returns the total number of lines in the screen */
+    int lineCount() const;
+    /** Returns the total number of columns in the screen */
+    int columnCount() const;
+
+    /** Returns the index of the line which is currently at the top of this window */
+    int currentLine() const;
+
+    /** 
+     * Returns the position of the cursor 
+     * within the window.
+     */
+    QPoint cursorPosition() const;
+
+    /** 
+     * Convenience method. Returns true if the window is currently at the bottom
+     * of the screen.
+     */
+    bool atEndOfOutput() const;
+
+    /** Scrolls the window so that @p line is at the top of the window */
+    void scrollTo( int line );
+
+    enum RelativeScrollMode
+    {
+        ScrollLines,
+        ScrollPages
+    };
+
+    /** 
+     * Scrolls the window relative to its current position on the screen.
+     *
+     * @param mode Specifies whether @p amount refers to the number of lines or the number
+     * of pages to scroll.    
+     * @param amount The number of lines or pages ( depending on @p mode ) to scroll by.  If
+     * this number is positive, the view is scrolled down.  If this number is negative, the view
+     * is scrolled up.
+     */
+    void scrollBy( RelativeScrollMode mode , int amount );
+
+    /** 
+     * Specifies whether the window should automatically move to the bottom
+     * of the screen when new output is added.
+     *
+     * If this is set to true, the window will be moved to the bottom of the associated screen ( see 
+     * screen() ) when the notifyOutputChanged() method is called.
+     */
+    void setTrackOutput(bool trackOutput);
+    /** 
+     * Returns whether the window automatically moves to the bottom of the screen as
+     * new output is added.  See setTrackOutput()
+     */
+    bool trackOutput() const;
+
+    /**
+     * Returns the text which is currently selected.
+     *
+     * @param preserveLineBreaks See Screen::selectedText()
+     */
+    QString selectedText( bool preserveLineBreaks ) const;
+
+public slots:
+    /** 
+     * Notifies the window that the contents of the associated terminal screen have changed.
+     * This moves the window to the bottom of the screen if trackOutput() is true and causes
+     * the outputChanged() signal to be emitted.
+     */
+    void notifyOutputChanged();
+
+signals:
+    /**
+     * Emitted when the contents of the associated terminal screen ( see screen() ) changes. 
+     */
+    void outputChanged();
+
+    /**
+     * Emitted when the screen window is scrolled to a different position.
+     * 
+     * @param line The line which is now at the top of the window.
+     */
+    void scrolled(int line);
+
+    /**
+     * Emitted when the selection is changed.
+     */
+    void selectionChanged();
+
+private:
+	int endWindowLine() const;
+	void fillUnusedArea();
+
+    Screen* _screen; // see setScreen() , screen()
+	Character* _windowBuffer;
+	int _windowBufferSize;
+	bool _bufferNeedsUpdate;
+
+	int  _windowLines;
+    int  _currentLine; // see scrollTo() , currentLine()
+    bool _trackOutput; // see setTrackOutput() , trackOutput() 
+    int  _scrollCount; // count of lines which the window has been scrolled by since
+                       // the last call to resetScrollCount()
+};
+
+}
+#endif // SCREENWINDOW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Session.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1021 @@
+/*
+    This file is part of Konsole
+
+    Copyright (C) 2006-2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "Session.h"
+
+// Standard
+#include <assert.h>
+#include <stdlib.h>
+
+// Qt
+#include <QtGui/QApplication>
+#include <QtCore/QByteRef>
+#include <QtCore/QDir>
+#include <QtCore/QFile>
+#include <QtCore/QRegExp>
+#include <QtCore/QStringList>
+#include <QtCore>
+
+#include "Pty.h"
+#include "TerminalDisplay.h"
+#include "ShellCommand.h"
+#include "Vt102Emulation.h"
+
+using namespace Konsole;
+
+int Session::lastSessionId = 0;
+
+Session::Session() :
+    _shellProcess(0)
+   , _emulation(0)
+   , _monitorActivity(false)
+   , _monitorSilence(false)
+   , _notifiedActivity(false)
+   , _autoClose(true)
+   , _wantedClose(false)
+   , _silenceSeconds(10)
+   , _addToUtmp(false)  // disabled by default because of a bug encountered on certain systems
+                        // which caused Konsole to hang when closing a tab and then opening a new
+                        // one.  A 'QProcess destroyed while still running' warning was being
+                        // printed to the terminal.  Likely a problem in KPty::logout() 
+                        // or KPty::login() which uses a QProcess to start /usr/bin/utempter 
+   , _flowControl(true)
+   , _fullScripting(false)
+   , _sessionId(0)
+//   , _zmodemBusy(false)
+//   , _zmodemProc(0)
+//   , _zmodemProgress(0)
+   , _hasDarkBackground(false)
+{
+    //prepare DBus communication
+//    new SessionAdaptor(this);
+    _sessionId = ++lastSessionId;
+//    QDBusConnection::sessionBus().registerObject(QLatin1String("/Sessions/")+QString::number(_sessionId), this);
+
+    //create teletype for I/O with shell process
+    _shellProcess = new Pty();
+
+    //create emulation backend
+    _emulation = new Vt102Emulation();
+
+    connect( _emulation, SIGNAL( titleChanged( int, const QString & ) ),
+           this, SLOT( setUserTitle( int, const QString & ) ) );
+    connect( _emulation, SIGNAL( stateSet(int) ),
+           this, SLOT( activityStateSet(int) ) );
+//    connect( _emulation, SIGNAL( zmodemDetected() ), this ,
+//            SLOT( fireZModemDetected() ) );
+    connect( _emulation, SIGNAL( changeTabTextColorRequest( int ) ),
+           this, SIGNAL( changeTabTextColorRequest( int ) ) );
+    connect( _emulation, SIGNAL(profileChangeCommandReceived(const QString&)),
+           this, SIGNAL( profileChangeCommandReceived(const QString&)) );
+    // TODO
+    // connect( _emulation,SIGNAL(imageSizeChanged(int,int)) , this ,
+    //        SLOT(onEmulationSizeChange(int,int)) );
+
+    //connect teletype to emulation backend
+    _shellProcess->setUtf8Mode(_emulation->utf8());
+
+    connect( _shellProcess,SIGNAL(receivedData(const char*,int)),this,
+            SLOT(onReceiveBlock(const char*,int)) );
+    connect( _emulation,SIGNAL(sendData(const char*,int)),_shellProcess,
+            SLOT(sendData(const char*,int)) );
+    connect( _emulation,SIGNAL(lockPtyRequest(bool)),_shellProcess,SLOT(lockPty(bool)) );
+    connect( _emulation,SIGNAL(useUtf8Request(bool)),_shellProcess,SLOT(setUtf8Mode(bool)) );
+
+
+    connect( _shellProcess,SIGNAL(done(int)), this, SLOT(done(int)) );
+
+    //setup timer for monitoring session activity
+    _monitorTimer = new QTimer(this);
+    _monitorTimer->setSingleShot(true);
+    connect(_monitorTimer, SIGNAL(timeout()), this, SLOT(monitorTimerDone()));
+}
+
+WId Session::windowId() const
+{
+    // Returns a window ID for this session which is used
+    // to set the WINDOWID environment variable in the shell
+    // process.
+    //
+    // Sessions can have multiple views or no views, which means
+    // that a single ID is not always going to be accurate.
+    //
+    // If there are no views, the window ID is just 0.  If
+    // there are multiple views, then the window ID for the
+    // top-level window which contains the first view is
+    // returned
+
+    if ( _views.count() == 0 )
+       return 0;
+    else
+    {
+        QWidget* window = _views.first();
+
+        Q_ASSERT( window );
+
+        while ( window->parentWidget() != 0 )
+            window = window->parentWidget();
+
+        return window->winId();
+    }
+}
+
+void Session::setDarkBackground(bool darkBackground)
+{
+    _hasDarkBackground = darkBackground;
+}
+bool Session::hasDarkBackground() const
+{
+    return _hasDarkBackground;
+}
+bool Session::isRunning() const
+{
+    return _shellProcess->isRunning();
+}
+
+void Session::setCodec(QTextCodec* codec)
+{
+    emulation()->setCodec(codec);
+}
+
+void Session::setProgram(const QString& program)
+{
+    _program = ShellCommand::expand(program);
+}
+void Session::setInitialWorkingDirectory(const QString& dir)
+{
+    _initialWorkingDir = ShellCommand::expand(dir);
+}
+void Session::setArguments(const QStringList& arguments)
+{
+    _arguments = ShellCommand::expand(arguments);
+}
+
+QList<TerminalDisplay*> Session::views() const
+{
+    return _views;
+}
+
+void Session::addView(TerminalDisplay* widget)
+{
+     Q_ASSERT( !_views.contains(widget) );
+
+    _views.append(widget);
+
+    if ( _emulation != 0 )
+    {
+        // connect emulation - view signals and slots
+        connect( widget , SIGNAL(keyPressedSignal(QKeyEvent*)) , _emulation ,
+               SLOT(sendKeyEvent(QKeyEvent*)) );
+        connect( widget , SIGNAL(mouseSignal(int,int,int,int)) , _emulation ,
+               SLOT(sendMouseEvent(int,int,int,int)) );
+        connect( widget , SIGNAL(sendStringToEmu(const char*)) , _emulation ,
+               SLOT(sendString(const char*)) );
+
+        // allow emulation to notify view when the foreground process
+        // indicates whether or not it is interested in mouse signals
+        connect( _emulation , SIGNAL(programUsesMouseChanged(bool)) , widget ,
+               SLOT(setUsesMouse(bool)) );
+
+        widget->setUsesMouse( _emulation->programUsesMouse() );
+
+        widget->setScreenWindow(_emulation->createWindow());
+    }
+
+    //connect view signals and slots
+    QObject::connect( widget ,SIGNAL(changedContentSizeSignal(int,int)),this,
+                    SLOT(onViewSizeChange(int,int)));
+
+    QObject::connect( widget ,SIGNAL(destroyed(QObject*)) , this ,
+                    SLOT(viewDestroyed(QObject*)) );
+//slot for close
+    QObject::connect(this, SIGNAL(finished()), widget, SLOT(close()));		    
+    
+}
+
+void Session::viewDestroyed(QObject* view)
+{
+    TerminalDisplay* display = (TerminalDisplay*)view;
+
+    Q_ASSERT( _views.contains(display) );
+
+    removeView(display);
+}
+
+void Session::removeView(TerminalDisplay* widget)
+{
+    _views.removeAll(widget);
+
+	disconnect(widget,0,this,0);
+
+    if ( _emulation != 0 )
+    {
+        // disconnect
+        //  - key presses signals from widget
+        //  - mouse activity signals from widget
+        //  - string sending signals from widget
+        //
+        //  ... and any other signals connected in addView()
+        disconnect( widget, 0, _emulation, 0);
+
+        // disconnect state change signals emitted by emulation
+        disconnect( _emulation , 0 , widget , 0);
+    }
+
+	// close the session automatically when the last view is removed
+	if ( _views.count() == 0 )
+	{
+		close();
+	}
+}
+
+void Session::run()
+{
+  //check that everything is in place to run the session
+  if (_program.isEmpty())
+      qDebug() << "Session::run() - program to run not set.";
+  if (_arguments.isEmpty())
+      qDebug() << "Session::run() - no command line arguments specified.";
+
+  // Upon a KPty error, there is no description on what that error was...
+  // Check to see if the given program is executable.
+  QString exec = QFile::encodeName(_program);
+
+  // if 'exec' is not specified, fall back to default shell.  if that 
+  // is not set then fall back to /bin/sh
+  if ( exec.isEmpty() )
+      exec = getenv("SHELL");
+  if ( exec.isEmpty() )
+  	  exec = "/bin/sh";
+
+  // if no arguments are specified, fall back to shell
+  QStringList arguments =  _arguments.join(QChar(' ')).isEmpty() ?
+                                    QStringList() << exec : _arguments;
+  QString pexec = exec;
+
+  if ( pexec.isEmpty() ) {
+    qDebug()<<"can not execute "<<exec<<endl;
+    QTimer::singleShot(1, this, SIGNAL(finished()));
+    return;
+  }
+
+  QString cwd_save = QDir::currentPath();
+  if (!_initialWorkingDir.isEmpty())
+    _shellProcess->setWorkingDirectory(_initialWorkingDir);
+  else
+    _shellProcess->setWorkingDirectory(QDir::homePath());
+
+  _shellProcess->setXonXoff(_flowControl);
+  _shellProcess->setErase(_emulation->getErase());
+
+  // this is not strictly accurate use of the COLORFGBG variable.  This does not
+  // tell the terminal exactly which colors are being used, but instead approximates
+  // the color scheme as "black on white" or "white on black" depending on whether
+  // the background color is deemed dark or not
+  QString backgroundColorHint = _hasDarkBackground ? "COLORFGBG=15;0" : "COLORFGBG=0;15";
+
+  int result = _shellProcess->start(QFile::encodeName(_program),
+                                  arguments,
+                                  _environment << backgroundColorHint,
+                                  windowId(),
+                                  _addToUtmp);
+
+  if (result < 0)
+  {
+    return;
+  }
+
+  _shellProcess->setWriteable(false);  // We are reachable via kwrited.
+
+  emit started();
+}
+
+void Session::setUserTitle( int what, const QString &caption )
+{
+    //set to true if anything is actually changed (eg. old _nameTitle != new _nameTitle )
+	bool modified = false;
+
+    // (btw: what=0 changes _userTitle and icon, what=1 only icon, what=2 only _nameTitle
+    if ((what == 0) || (what == 2)) 
+    {
+       	if ( _userTitle != caption ) {
+			_userTitle = caption;
+			modified = true;
+		}
+    }
+
+    if ((what == 0) || (what == 1))
+	{
+		if ( _iconText != caption ) {
+       		_iconText = caption;
+			modified = true;
+		}
+	}
+
+    if (what == 11) 
+    {
+      QString colorString = caption.section(';',0,0);
+      qDebug() << __FILE__ << __LINE__ << ": setting background colour to " << colorString;
+      QColor backColor = QColor(colorString);
+      if (backColor.isValid()){// change color via \033]11;Color\007
+          if (backColor != _modifiedBackground)
+          {
+              _modifiedBackground = backColor;
+
+              // bail out here until the code to connect the terminal display
+              // to the changeBackgroundColor() signal has been written
+              // and tested - just so we don't forget to do this.
+              Q_ASSERT( 0 );
+
+              emit changeBackgroundColorRequest(backColor);
+          }
+      }
+    }
+
+	if (what == 30) 
+    {
+		if ( _nameTitle != caption ) {
+       		setTitle(Session::NameRole,caption);
+			return;
+		}
+	}
+
+    if (what == 31) 
+    {
+       QString cwd=caption;
+       cwd=cwd.replace( QRegExp("^~"), QDir::homePath() );
+       emit openUrlRequest(cwd);
+	}
+
+    // change icon via \033]32;Icon\007
+    if (what == 32) 
+    { 
+    	if ( _iconName != caption ) {
+	   		_iconName = caption;
+
+			modified = true;
+		}
+    }
+
+    if (what == 50) 
+    {
+        emit profileChangeCommandReceived(caption);
+        return;
+    }
+
+	if ( modified )
+    	emit titleChanged();
+}
+
+QString Session::userTitle() const
+{
+    return _userTitle;
+}
+void Session::setTabTitleFormat(TabTitleContext context , const QString& format)
+{
+    if ( context == LocalTabTitle )
+        _localTabTitleFormat = format;
+    else if ( context == RemoteTabTitle )
+        _remoteTabTitleFormat = format;
+}
+QString Session::tabTitleFormat(TabTitleContext context) const
+{
+    if ( context == LocalTabTitle )
+        return _localTabTitleFormat;
+    else if ( context == RemoteTabTitle )
+        return _remoteTabTitleFormat;
+
+    return QString();
+}
+
+void Session::monitorTimerDone()
+{
+  //FIXME: The idea here is that the notification popup will appear to tell the user than output from
+  //the terminal has stopped and the popup will disappear when the user activates the session.
+  //
+  //This breaks with the addition of multiple views of a session.  The popup should disappear
+  //when any of the views of the session becomes active
+  
+
+  //FIXME: Make message text for this notification and the activity notification more descriptive.	
+  if (_monitorSilence) {
+//    KNotification::event("Silence", ("Silence in session '%1'", _nameTitle), QPixmap(),
+//                    QApplication::activeWindow(),
+//                    KNotification::CloseWhenWidgetActivated);
+    emit stateChanged(NOTIFYSILENCE);
+  }
+  else
+  {
+    emit stateChanged(NOTIFYNORMAL);
+  }
+
+  _notifiedActivity=false;
+}
+
+void Session::activityStateSet(int state)
+{
+  if (state==NOTIFYBELL)
+  {
+      QString s; s.sprintf("Bell in session '%s'",_nameTitle.toAscii().data());
+      
+      emit bellRequest( s );
+  }
+  else if (state==NOTIFYACTIVITY)
+  {
+    if (_monitorSilence) {
+      _monitorTimer->start(_silenceSeconds*1000);
+    }
+
+    if ( _monitorActivity ) {
+      //FIXME:  See comments in Session::monitorTimerDone()
+      if (!_notifiedActivity) {
+//        KNotification::event("Activity", ("Activity in session '%1'", _nameTitle), QPixmap(),
+//                        QApplication::activeWindow(),
+//        KNotification::CloseWhenWidgetActivated);
+        _notifiedActivity=true;
+      }
+    }
+  }
+
+  if ( state==NOTIFYACTIVITY && !_monitorActivity )
+          state = NOTIFYNORMAL;
+  if ( state==NOTIFYSILENCE && !_monitorSilence )
+          state = NOTIFYNORMAL;
+
+  emit stateChanged(state);
+}
+
+void Session::onViewSizeChange(int /*height*/, int /*width*/)
+{
+  updateTerminalSize();
+}
+void Session::onEmulationSizeChange(int lines , int columns)
+{
+  setSize( QSize(lines,columns) );
+}
+
+void Session::updateTerminalSize()
+{
+    QListIterator<TerminalDisplay*> viewIter(_views);
+
+    int minLines = -1;
+    int minColumns = -1;
+
+    // minimum number of lines and columns that views require for
+    // their size to be taken into consideration ( to avoid problems
+    // with new view widgets which haven't yet been set to their correct size )
+    const int VIEW_LINES_THRESHOLD = 2;
+    const int VIEW_COLUMNS_THRESHOLD = 2;
+
+    //select largest number of lines and columns that will fit in all visible views
+    while ( viewIter.hasNext() )
+    {
+        TerminalDisplay* view = viewIter.next();
+        if ( view->isHidden() == false &&
+             view->lines() >= VIEW_LINES_THRESHOLD &&
+             view->columns() >= VIEW_COLUMNS_THRESHOLD )
+        {
+            minLines = (minLines == -1) ? view->lines() : qMin( minLines , view->lines() );
+            minColumns = (minColumns == -1) ? view->columns() : qMin( minColumns , view->columns() );
+        }
+    }
+
+    // backend emulation must have a _terminal of at least 1 column x 1 line in size
+    if ( minLines > 0 && minColumns > 0 )
+    {
+        _emulation->setImageSize( minLines , minColumns );
+        _shellProcess->setWindowSize( minLines , minColumns );
+    }
+}
+
+void Session::refresh()
+{
+    // attempt to get the shell process to redraw the display
+    //
+    // this requires the program running in the shell
+    // to cooperate by sending an update in response to
+    // a window size change
+    //
+    // the window size is changed twice, first made slightly larger and then
+    // resized back to its normal size so that there is actually a change
+    // in the window size (some shells do nothing if the
+    // new and old sizes are the same)
+    //
+    // if there is a more 'correct' way to do this, please
+    // send an email with method or patches to konsole-devel@kde.org
+
+    const QSize existingSize = _shellProcess->windowSize();
+    _shellProcess->setWindowSize(existingSize.height(),existingSize.width()+1);
+    _shellProcess->setWindowSize(existingSize.height(),existingSize.width());
+}
+
+bool Session::sendSignal(int signal)
+{
+  return _shellProcess->kill(signal);
+}
+
+void Session::close()
+{
+  _autoClose = true;
+  _wantedClose = true;
+  if (!_shellProcess->isRunning() || !sendSignal(SIGHUP))
+  {
+     // Forced close.
+     QTimer::singleShot(1, this, SIGNAL(finished()));
+  }
+}
+
+void Session::sendText(const QString &text) const
+{
+  _emulation->sendText(text);
+}
+
+Session::~Session()
+{
+  delete _emulation;
+  delete _shellProcess;
+//  delete _zmodemProc;
+}
+
+void Session::setProfileKey(const QString& key)
+{
+    _profileKey = key;
+    emit profileChanged(key);
+}
+QString Session::profileKey() const { return _profileKey; }
+
+void Session::done(int exitStatus)
+{
+  if (!_autoClose)
+  {
+    _userTitle = ("<Finished>");
+    emit titleChanged();
+    return;
+  }
+  if (!_wantedClose && (exitStatus || _shellProcess->signalled()))
+  {
+    QString message;
+
+    if (_shellProcess->normalExit())
+      message.sprintf ("Session '%s' exited with status %d.", _nameTitle.toAscii().data(), exitStatus);
+    else if (_shellProcess->signalled())
+    {
+      if (_shellProcess->coreDumped())
+      {    
+
+        message.sprintf("Session '%s' exited with signal %d and dumped core.", _nameTitle.toAscii().data(), _shellProcess->exitSignal());
+      }
+      else { 
+        message.sprintf("Session '%s' exited with signal %d.", _nameTitle.toAscii().data(), _shellProcess->exitSignal());
+      }
+    }
+    else
+        message.sprintf ("Session '%s' exited unexpectedly.", _nameTitle.toAscii().data());
+
+    //FIXME: See comments in Session::monitorTimerDone()
+//    KNotification::event("Finished", message , QPixmap(),
+//                         QApplication::activeWindow(),
+//                         KNotification::CloseWhenWidgetActivated);
+  }
+  emit finished();
+}
+
+Emulation* Session::emulation() const
+{
+  return _emulation;
+}
+
+QString Session::keyBindings() const
+{
+  return _emulation->keyBindings();
+}
+
+QStringList Session::environment() const
+{
+  return _environment;
+}
+
+void Session::setEnvironment(const QStringList& environment)
+{
+    _environment = environment;
+}
+
+int Session::sessionId() const
+{
+  return _sessionId;
+}
+
+void Session::setKeyBindings(const QString &id)
+{
+  _emulation->setKeyBindings(id);
+}
+
+void Session::setTitle(TitleRole role , const QString& newTitle)
+{
+    if ( title(role) != newTitle )
+    {
+        if ( role == NameRole )
+            _nameTitle = newTitle;
+        else if ( role == DisplayedTitleRole )
+            _displayTitle = newTitle;
+
+        emit titleChanged();
+    }
+}
+
+QString Session::title(TitleRole role) const
+{
+    if ( role == NameRole )
+        return _nameTitle;
+    else if ( role == DisplayedTitleRole )
+        return _displayTitle;
+    else
+        return QString();
+}
+
+void Session::setIconName(const QString& iconName)
+{
+    if ( iconName != _iconName )
+    {
+        _iconName = iconName;
+        emit titleChanged();
+    }
+}
+
+void Session::setIconText(const QString& iconText)
+{
+  _iconText = iconText;
+  //kDebug(1211)<<"Session setIconText " <<  _iconText;
+}
+
+QString Session::iconName() const
+{
+  return _iconName;
+}
+
+QString Session::iconText() const
+{
+  return _iconText;
+}
+
+void Session::setHistoryType(const HistoryType &hType)
+{
+  _emulation->setHistory(hType);
+}
+
+const HistoryType& Session::historyType() const
+{
+  return _emulation->history();
+}
+
+void Session::clearHistory()
+{
+    _emulation->clearHistory();
+}
+
+QStringList Session::arguments() const
+{
+  return _arguments;
+}
+
+QString Session::program() const
+{
+  return _program;
+}
+
+// unused currently
+bool Session::isMonitorActivity() const { return _monitorActivity; }
+// unused currently
+bool Session::isMonitorSilence()  const { return _monitorSilence; }
+
+void Session::setMonitorActivity(bool _monitor)
+{
+  _monitorActivity=_monitor;
+  _notifiedActivity=false;
+
+  activityStateSet(NOTIFYNORMAL);
+}
+
+void Session::setMonitorSilence(bool _monitor)
+{
+  if (_monitorSilence==_monitor)
+    return;
+
+  _monitorSilence=_monitor;
+  if (_monitorSilence)
+  {
+    _monitorTimer->start(_silenceSeconds*1000);
+  }
+  else
+    _monitorTimer->stop();
+
+  activityStateSet(NOTIFYNORMAL);
+}
+
+void Session::setMonitorSilenceSeconds(int seconds)
+{
+  _silenceSeconds=seconds;
+  if (_monitorSilence) {
+    _monitorTimer->start(_silenceSeconds*1000);
+  }
+}
+
+void Session::setAddToUtmp(bool set)
+{
+  _addToUtmp = set;
+}
+
+void Session::setFlowControlEnabled(bool enabled)
+{
+  if (_flowControl == enabled)
+  	return;
+
+  _flowControl = enabled;
+
+  if (_shellProcess)  
+	_shellProcess->setXonXoff(_flowControl);
+  
+  emit flowControlEnabledChanged(enabled);
+}
+bool Session::flowControlEnabled() const
+{
+	return _flowControl;
+}
+//void Session::fireZModemDetected()
+//{
+//  if (!_zmodemBusy)
+//  {
+//    QTimer::singleShot(10, this, SIGNAL(zmodemDetected()));
+//    _zmodemBusy = true;
+//  }
+//}
+
+//void Session::cancelZModem()
+//{
+//  _shellProcess->sendData("\030\030\030\030", 4); // Abort
+//  _zmodemBusy = false;
+//}
+
+//void Session::startZModem(const QString &zmodem, const QString &dir, const QStringList &list)
+//{
+//  _zmodemBusy = true;
+//  _zmodemProc = new KProcess();
+//  _zmodemProc->setOutputChannelMode( KProcess::SeparateChannels );
+//
+//  *_zmodemProc << zmodem << "-v" << list;
+//
+//  if (!dir.isEmpty())
+//     _zmodemProc->setWorkingDirectory(dir);
+//
+//  _zmodemProc->start();
+//
+//  connect(_zmodemProc,SIGNAL (readyReadStandardOutput()),
+//          this, SLOT(zmodemReadAndSendBlock()));
+//  connect(_zmodemProc,SIGNAL (readyReadStandardError()),
+//          this, SLOT(zmodemReadStatus()));
+//  connect(_zmodemProc,SIGNAL (finished(int,QProcess::ExitStatus)),
+//          this, SLOT(zmodemFinished()));
+//
+//  disconnect( _shellProcess,SIGNAL(block_in(const char*,int)), this, SLOT(onReceiveBlock(const char*,int)) );
+//  connect( _shellProcess,SIGNAL(block_in(const char*,int)), this, SLOT(zmodemRcvBlock(const char*,int)) );
+//
+//  _zmodemProgress = new ZModemDialog(QApplication::activeWindow(), false,
+//                                    i18n("ZModem Progress"));
+//
+//  connect(_zmodemProgress, SIGNAL(user1Clicked()),
+//          this, SLOT(zmodemDone()));
+//
+//  _zmodemProgress->show();
+//}
+
+/*void Session::zmodemReadAndSendBlock()
+{
+  _zmodemProc->setReadChannel( QProcess::StandardOutput );
+  QByteArray data = _zmodemProc->readAll();
+
+  if ( data.count() == 0 )
+      return;
+
+  _shellProcess->sendData(data.constData(),data.count());
+}
+*/
+/*
+void Session::zmodemReadStatus()
+{
+  _zmodemProc->setReadChannel( QProcess::StandardError );
+  QByteArray msg = _zmodemProc->readAll();
+  while(!msg.isEmpty())
+  {
+     int i = msg.indexOf('\015');
+     int j = msg.indexOf('\012');
+     QByteArray txt;
+     if ((i != -1) && ((j == -1) || (i < j)))
+     {
+       msg = msg.mid(i+1);
+     }
+     else if (j != -1)
+     {
+       txt = msg.left(j);
+       msg = msg.mid(j+1);
+     }
+     else
+     {
+       txt = msg;
+       msg.truncate(0);
+     }
+     if (!txt.isEmpty())
+       _zmodemProgress->addProgressText(QString::fromLocal8Bit(txt));
+  }
+}
+*/
+/*
+void Session::zmodemRcvBlock(const char *data, int len)
+{
+  QByteArray ba( data, len );
+
+  _zmodemProc->write( ba );
+}
+*/
+/*
+void Session::zmodemFinished()
+{
+  if (_zmodemProc)
+  {
+    delete _zmodemProc;
+    _zmodemProc = 0;
+    _zmodemBusy = false;
+
+    disconnect( _shellProcess,SIGNAL(block_in(const char*,int)), this ,SLOT(zmodemRcvBlock(const char*,int)) );
+    connect( _shellProcess,SIGNAL(block_in(const char*,int)), this, SLOT(onReceiveBlock(const char*,int)) );
+
+    _shellProcess->sendData("\030\030\030\030", 4); // Abort
+    _shellProcess->sendData("\001\013\n", 3); // Try to get prompt back
+    _zmodemProgress->transferDone();
+  }
+}
+*/
+void Session::onReceiveBlock( const char* buf, int len )
+{
+    _emulation->receiveData( buf, len );
+    emit receivedData( QString::fromLatin1( buf, len ) );
+}
+
+QSize Session::size()
+{
+  return _emulation->imageSize();
+}
+
+void Session::setSize(const QSize& size)
+{
+  if ((size.width() <= 1) || (size.height() <= 1))
+     return;
+
+  emit resizeRequest(size);
+}
+int Session::foregroundProcessId() const
+{
+    return _shellProcess->foregroundProcessGroup();
+}
+int Session::processId() const
+{
+    return _shellProcess->pid();
+}
+
+SessionGroup::SessionGroup()
+    : _masterMode(0)
+{
+}
+SessionGroup::~SessionGroup()
+{
+    // disconnect all
+    connectAll(false);
+}
+int SessionGroup::masterMode() const { return _masterMode; }
+QList<Session*> SessionGroup::sessions() const { return _sessions.keys(); }
+bool SessionGroup::masterStatus(Session* session) const { return _sessions[session]; }
+
+void SessionGroup::addSession(Session* session)
+{
+    _sessions.insert(session,false);
+
+    QListIterator<Session*> masterIter(masters());
+
+    while ( masterIter.hasNext() )
+        connectPair(masterIter.next(),session);
+}
+void SessionGroup::removeSession(Session* session)
+{
+    setMasterStatus(session,false);
+
+    QListIterator<Session*> masterIter(masters());
+
+    while ( masterIter.hasNext() )
+        disconnectPair(masterIter.next(),session);
+
+    _sessions.remove(session);
+}
+void SessionGroup::setMasterMode(int mode)
+{
+   _masterMode = mode;
+
+   connectAll(false);
+   connectAll(true);
+}
+QList<Session*> SessionGroup::masters() const
+{
+    return _sessions.keys(true);
+}
+void SessionGroup::connectAll(bool connect)
+{
+    QListIterator<Session*> masterIter(masters());
+
+    while ( masterIter.hasNext() )
+    {
+        Session* master = masterIter.next();
+
+        QListIterator<Session*> otherIter(_sessions.keys());
+        while ( otherIter.hasNext() )
+        {
+            Session* other = otherIter.next();
+
+            if ( other != master )
+            {
+                if ( connect )
+                    connectPair(master,other);
+                else
+                    disconnectPair(master,other);
+            }
+        }
+    }
+}
+void SessionGroup::setMasterStatus(Session* session , bool master)
+{
+    bool wasMaster = _sessions[session];
+    _sessions[session] = master;
+
+    if (    !wasMaster && !master
+         || wasMaster && master )
+      return;
+
+    QListIterator<Session*> iter(_sessions.keys());
+    while ( iter.hasNext() )
+    {
+        Session* other = iter.next();
+
+        if ( other != session )
+        {
+            if ( master )
+                connectPair(session,other);
+            else
+                disconnectPair(session,other);
+        }
+    }
+}
+void SessionGroup::connectPair(Session* master , Session* other)
+{
+//    qDebug() << k_funcinfo;
+
+    if ( _masterMode & CopyInputToAll )
+    {
+        qDebug() << "Connection session " << master->nameTitle() << "to" << other->nameTitle();
+
+        connect( master->emulation() , SIGNAL(sendData(const char*,int)) , other->emulation() ,
+                 SLOT(sendString(const char*,int)) );
+    }
+}
+void SessionGroup::disconnectPair(Session* master , Session* other)
+{
+//    qDebug() << k_funcinfo;
+
+    if ( _masterMode & CopyInputToAll )
+    {
+        qDebug() << "Disconnecting session " << master->nameTitle() << "from" << other->nameTitle();
+
+        disconnect( master->emulation() , SIGNAL(sendData(const char*,int)) , other->emulation() ,
+                SLOT(sendString(const char*,int)) );
+    }
+}
+
+//#include "moc_Session.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Session.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,621 @@
+/*
+    This file is part of Konsole, an X terminal.
+
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 SESSION_H
+#define SESSION_H
+
+// Qt
+#include <QtCore/QStringList>
+#include <QtCore>
+#include <QWidget>
+
+// Konsole
+#include "History.h"
+
+class KProcess;
+
+namespace Konsole
+{
+
+class Emulation;
+class Pty;
+class TerminalDisplay;
+//class ZModemDialog;
+
+/**
+ * Represents a terminal session consisting of a pseudo-teletype and a terminal emulation.
+ * The pseudo-teletype (or PTY) handles I/O between the terminal process and Konsole.
+ * The terminal emulation ( Emulation and subclasses ) processes the output stream from the
+ * PTY and produces a character image which is then shown on views connected to the session.
+ *
+ * Each Session can be connected to one or more views by using the addView() method.
+ * The attached views can then display output from the program running in the terminal
+ * or send input to the program in the terminal in the form of keypresses and mouse
+ * activity.
+ */
+class Session : public QObject
+{
+Q_OBJECT
+
+public:
+  Q_PROPERTY(QString name READ nameTitle)
+  Q_PROPERTY(int processId READ processId)
+  Q_PROPERTY(QString keyBindings READ keyBindings WRITE setKeyBindings)
+  Q_PROPERTY(QSize size READ size WRITE setSize)
+
+  /**
+   * Constructs a new session.
+   *
+   * To start the terminal process, call the run() method,
+   * after specifying the program and arguments
+   * using setProgram() and setArguments()
+   *
+   * If no program or arguments are specified explicitly, the Session
+   * falls back to using the program specified in the SHELL environment
+   * variable.
+   */
+  Session();
+  ~Session();
+
+  /**
+   * Returns true if the session is currently running.  This will be true
+   * after run() has been called successfully.
+   */
+  bool isRunning() const;
+
+  /**
+   * Sets the profile associated with this session.
+   *
+   * @param profileKey A key which can be used to obtain the current
+   * profile settings from the SessionManager
+   */
+  void setProfileKey(const QString& profileKey);
+  /**
+   * Returns the profile key associated with this session.
+   * This can be passed to the SessionManager to obtain the current
+   * profile settings.
+   */
+  QString profileKey() const;
+
+  /**
+   * Adds a new view for this session.
+   *
+   * The viewing widget will display the output from the terminal and
+   * input from the viewing widget (key presses, mouse activity etc.)
+   * will be sent to the terminal.
+   *
+   * Views can be removed using removeView().  The session is automatically
+   * closed when the last view is removed.
+   */
+  void addView(TerminalDisplay* widget);
+  /**
+   * Removes a view from this session.  When the last view is removed,
+   * the session will be closed automatically.
+   *
+   * @p widget will no longer display output from or send input
+   * to the terminal
+   */
+  void removeView(TerminalDisplay* widget);
+
+  /**
+   * Returns the views connected to this session
+   */
+  QList<TerminalDisplay*> views() const;
+
+  /**
+   * Returns the terminal emulation instance being used to encode / decode
+   * characters to / from the process.
+   */
+  Emulation*  emulation() const;
+
+  /**
+   * Returns the environment of this session as a list of strings like
+   * VARIABLE=VALUE
+   */
+  QStringList environment() const;
+  /**
+   * Sets the environment for this session.
+   * @p environment should be a list of strings like
+   * VARIABLE=VALUE
+   */
+  void setEnvironment(const QStringList& environment);
+
+  /** Returns the unique ID for this session. */
+  int sessionId() const;
+
+  /**
+   * Return the session title set by the user (ie. the program running
+   * in the terminal), or an empty string if the user has not set a custom title
+   */
+  QString userTitle() const;
+
+  /**
+   * This enum describes the contexts for which separate
+   * tab title formats may be specified.
+   */
+  enum TabTitleContext
+  {
+    /** Default tab title format */
+    LocalTabTitle,
+    /**
+     * Tab title format used session currently contains
+     * a connection to a remote computer (via SSH)
+     */
+    RemoteTabTitle
+  };
+  /**
+   * Sets the format used by this session for tab titles.
+   *
+   * @param context The context whoose format should be set.
+   * @param format The tab title format.  This may be a mixture
+   * of plain text and dynamic elements denoted by a '%' character
+   * followed by a letter.  (eg. %d for directory).  The dynamic
+   * elements available depend on the @p context
+   */
+  void setTabTitleFormat(TabTitleContext context , const QString& format);
+  /** Returns the format used by this session for tab titles. */
+  QString tabTitleFormat(TabTitleContext context) const;
+
+
+  /** Returns the arguments passed to the shell process when run() is called. */
+  QStringList arguments() const;
+  /** Returns the program name of the shell process started when run() is called. */
+  QString program() const;
+
+  /**
+   * Sets the command line arguments which the session's program will be passed when
+   * run() is called.
+   */
+  void setArguments(const QStringList& arguments);
+  /** Sets the program to be executed when run() is called. */
+  void setProgram(const QString& program);
+
+  /** Returns the session's current working directory. */
+  QString initialWorkingDirectory() { return _initialWorkingDir; }
+
+  /**
+   * Sets the initial working directory for the session when it is run
+   * This has no effect once the session has been started.
+   */
+  void setInitialWorkingDirectory( const QString& dir );
+
+  /**
+   * Sets the type of history store used by this session.
+   * Lines of output produced by the terminal are added
+   * to the history store.  The type of history store
+   * used affects the number of lines which can be
+   * remembered before they are lost and the storage
+   * (in memory, on-disk etc.) used.
+   */
+  void setHistoryType(const HistoryType& type);
+  /**
+   * Returns the type of history store used by this session.
+   */
+  const HistoryType& historyType() const;
+  /**
+   * Clears the history store used by this session.
+   */
+  void clearHistory();
+
+  /**
+   * Enables monitoring for activity in the session.
+   * This will cause notifySessionState() to be emitted
+   * with the NOTIFYACTIVITY state flag when output is
+   * received from the terminal.
+   */
+  void setMonitorActivity(bool);
+  /** Returns true if monitoring for activity is enabled. */
+  bool isMonitorActivity() const;
+
+  /**
+   * Enables monitoring for silence in the session.
+   * This will cause notifySessionState() to be emitted
+   * with the NOTIFYSILENCE state flag when output is not
+   * received from the terminal for a certain period of
+   * time, specified with setMonitorSilenceSeconds()
+   */
+  void setMonitorSilence(bool);
+  /**
+   * Returns true if monitoring for inactivity (silence)
+   * in the session is enabled.
+   */
+  bool isMonitorSilence()  const;
+  /** See setMonitorSilence() */
+  void setMonitorSilenceSeconds(int seconds);
+
+  /**
+   * Sets the key bindings used by this session.  The bindings
+   * specify how input key sequences are translated into
+   * the character stream which is sent to the terminal.
+   *
+   * @param id The name of the key bindings to use.  The
+   * names of available key bindings can be determined using the
+   * KeyboardTranslatorManager class.
+   */
+  void setKeyBindings(const QString& id);
+  /** Returns the name of the key bindings used by this session. */
+  QString keyBindings() const;
+
+  /**
+   * This enum describes the available title roles.
+   */
+  enum TitleRole
+  {
+      /** The name of the session. */
+      NameRole,
+      /** The title of the session which is displayed in tabs etc. */
+      DisplayedTitleRole
+  };
+
+  /** Sets the session's title for the specified @p role to @p title. */
+  void setTitle(TitleRole role , const QString& title);
+  /** Returns the session's title for the specified @p role. */
+  QString title(TitleRole role) const;
+  /** Convenience method used to read the name property.  Returns title(Session::NameRole). */
+  QString nameTitle() const { return title(Session::NameRole); }
+
+  /** Sets the name of the icon associated with this session. */
+  void setIconName(const QString& iconName);
+  /** Returns the name of the icon associated with this session. */
+  QString iconName() const;
+
+  /** Sets the text of the icon associated with this session. */
+  void setIconText(const QString& iconText);
+  /** Returns the text of the icon associated with this session. */
+  QString iconText() const;
+
+  /** Specifies whether a utmp entry should be created for the pty used by this session. */
+  void setAddToUtmp(bool);
+
+  /** Sends the specified @p signal to the terminal process. */
+  bool sendSignal(int signal);
+
+  /**
+   * Specifies whether to close the session automatically when the terminal
+   * process terminates.
+   */
+  void setAutoClose(bool b) { _autoClose = b; }
+
+  /**
+   * Sets whether flow control is enabled for this terminal
+   * session.
+   */
+  void setFlowControlEnabled(bool enabled);
+
+  /** Returns whether flow control is enabled for this terminal session. */
+  bool flowControlEnabled() const;
+
+  /**
+   * Sends @p text to the current foreground terminal program.
+   */
+  void sendText(const QString& text) const;
+
+  /**
+   * Returns the process id of the terminal process.
+   * This is the id used by the system API to refer to the process.
+   */
+  int processId() const;
+
+  /**
+   * Returns the process id of the terminal's foreground process.
+   * This is initially the same as processId() but can change
+   * as the user starts other programs inside the terminal.
+   */
+  int foregroundProcessId() const;
+
+  /** Returns the terminal session's window size in lines and columns. */
+  QSize size();
+  /**
+   * Emits a request to resize the session to accommodate
+   * the specified window size.
+   *
+   * @param size The size in lines and columns to request.
+   */
+  void setSize(const QSize& size);
+
+  /** Sets the text codec used by this session's terminal emulation. */
+  void setCodec(QTextCodec* codec);
+
+  /**
+   * Sets whether the session has a dark background or not.  The session
+   * uses this information to set the COLORFGBG variable in the process's
+   * environment, which allows the programs running in the terminal to determine
+   * whether the background is light or dark and use appropriate colors by default.
+   *
+   * This has no effect once the session is running.
+   */
+  void setDarkBackground(bool darkBackground);
+  /**
+   * Returns true if the session has a dark background.
+   * See setDarkBackground()
+   */
+  bool hasDarkBackground() const;
+
+  /**
+   * Attempts to get the shell program to redraw the current display area.
+   * This can be used after clearing the screen, for example, to get the
+   * shell to redraw the prompt line.
+   */
+  void refresh();
+
+//  void startZModem(const QString &rz, const QString &dir, const QStringList &list);
+//  void cancelZModem();
+//  bool isZModemBusy() { return _zmodemBusy; }
+
+public slots:
+
+  /**
+   * Starts the terminal session.
+   *
+   * This creates the terminal process and connects the teletype to it.
+   */
+  void run();
+
+  /**
+   * Closes the terminal session.  This sends a hangup signal
+   * (SIGHUP) to the terminal process and causes the done(Session*)
+   * signal to be emitted.
+   */
+  void close();
+
+  /**
+   * Changes the session title or other customizable aspects of the terminal
+   * emulation display. For a list of what may be changed see the
+   * Emulation::titleChanged() signal.
+   */
+  void setUserTitle( int, const QString &caption );
+
+signals:
+
+  /** Emitted when the terminal process starts. */
+  void started();
+
+  /**
+   * Emitted when the terminal process exits.
+   */
+  void finished();
+
+  /**
+   * Emitted when output is received from the terminal process.
+   */
+  void receivedData( const QString& text );
+
+  /** Emitted when the session's title has changed. */
+  void titleChanged();
+
+  /** Emitted when the session's profile has changed. */
+  void profileChanged(const QString& profile);
+
+  /**
+   * Emitted when the activity state of this session changes.
+   *
+   * @param state The new state of the session.  This may be one
+   * of NOTIFYNORMAL, NOTIFYSILENCE or NOTIFYACTIVITY
+   */
+  void stateChanged(int state);
+
+  /** Emitted when a bell event occurs in the session. */
+  void bellRequest( const QString& message );
+
+  /**
+   * Requests that the color the text for any tabs associated with
+   * this session should be changed;
+   *
+   * TODO: Document what the parameter does
+   */
+  void changeTabTextColorRequest(int);
+
+  /**
+   * Requests that the background color of views on this session
+   * should be changed.
+   */
+  void changeBackgroundColorRequest(const QColor&);
+
+  /** TODO: Document me. */
+  void openUrlRequest(const QString& url);
+
+  /** TODO: Document me. */
+//  void zmodemDetected();
+
+  /**
+   * Emitted when the terminal process requests a change
+   * in the size of the terminal window.
+   *
+   * @param size The requested window size in terms of lines and columns.
+   */
+  void resizeRequest(const QSize& size);
+
+  /**
+   * Emitted when a profile change command is received from the terminal.
+   *
+   * @param text The text of the command.  This is a string of the form
+   * "PropertyName=Value;PropertyName=Value ..."
+   */
+  void profileChangeCommandReceived(const QString& text);
+
+ /**
+  * Emitted when the flow control state changes.
+  *
+  * @param enabled True if flow control is enabled or false otherwise.
+  */
+  void flowControlEnabledChanged(bool enabled);
+
+private slots:
+  void done(int);
+
+//  void fireZModemDetected();
+
+  void onReceiveBlock( const char* buffer, int len );
+  void monitorTimerDone();
+
+  void onViewSizeChange(int height, int width);
+  void onEmulationSizeChange(int lines , int columns);
+
+  void activityStateSet(int);
+
+  //automatically detach views from sessions when view is destroyed
+  void viewDestroyed(QObject* view);
+
+//  void zmodemReadStatus();
+//  void zmodemReadAndSendBlock();
+//  void zmodemRcvBlock(const char *data, int len);
+//  void zmodemFinished();
+
+private:
+
+  void updateTerminalSize();
+  WId windowId() const;
+
+  int            _uniqueIdentifier;
+
+  Pty*          _shellProcess;
+  Emulation*    _emulation;
+
+  QList<TerminalDisplay*> _views;
+
+  bool           _monitorActivity;
+  bool           _monitorSilence;
+  bool           _notifiedActivity;
+  bool           _masterMode;
+  bool           _autoClose;
+  bool           _wantedClose;
+  QTimer*        _monitorTimer;
+
+  int            _silenceSeconds;
+
+  QString        _nameTitle;
+  QString        _displayTitle;
+  QString        _userTitle;
+
+  QString        _localTabTitleFormat;
+  QString        _remoteTabTitleFormat;
+
+  QString        _iconName;
+  QString        _iconText; // as set by: echo -en '\033]1;IconText\007
+  bool           _addToUtmp;
+  bool           _flowControl;
+  bool           _fullScripting;
+
+  QString        _program;
+  QStringList    _arguments;
+
+  QStringList    _environment;
+  int            _sessionId;
+
+  QString        _initialWorkingDir;
+
+  // ZModem
+//  bool           _zmodemBusy;
+//  KProcess*      _zmodemProc;
+//  ZModemDialog*  _zmodemProgress;
+
+  // Color/Font Changes by ESC Sequences
+
+  QColor         _modifiedBackground; // as set by: echo -en '\033]11;Color\007
+
+  QString        _profileKey;
+
+  bool _hasDarkBackground;
+
+  static int lastSessionId;
+
+};
+
+/**
+ * Provides a group of sessions which is divided into master and slave sessions.
+ * Activity in master sessions can be propagated to all sessions within the group.
+ * The type of activity which is propagated and method of propagation is controlled
+ * by the masterMode() flags.
+ */
+class SessionGroup : public QObject
+{
+Q_OBJECT
+
+public:
+    /** Constructs an empty session group. */
+    SessionGroup();
+    /** Destroys the session group and removes all connections between master and slave sessions. */
+    ~SessionGroup();
+
+    /** Adds a session to the group. */
+    void addSession( Session* session );
+    /** Removes a session from the group. */
+    void removeSession( Session* session );
+
+    /** Returns the list of sessions currently in the group. */
+    QList<Session*> sessions() const;
+
+    /**
+     * Sets whether a particular session is a master within the group.
+     * Changes or activity in the group's master sessions may be propagated
+     * to all the sessions in the group, depending on the current masterMode()
+     *
+     * @param session The session whoose master status should be changed.
+     * @param master True to make this session a master or false otherwise
+     */
+    void setMasterStatus( Session* session , bool master );
+    /** Returns the master status of a session.  See setMasterStatus() */
+    bool masterStatus( Session* session ) const;
+
+    /**
+     * This enum describes the options for propagating certain activity or
+     * changes in the group's master sessions to all sessions in the group.
+     */
+    enum MasterMode
+    {
+        /**
+         * Any input key presses in the master sessions are sent to all
+         * sessions in the group.
+         */
+        CopyInputToAll = 1
+    };
+
+    /**
+     * Specifies which activity in the group's master sessions is propagated
+     * to all sessions in the group.
+     *
+     * @param mode A bitwise OR of MasterMode flags.
+     */
+    void setMasterMode( int mode );
+    /**
+     * Returns a bitwise OR of the active MasterMode flags for this group.
+     * See setMasterMode()
+     */
+    int masterMode() const;
+
+private:
+    void connectPair(Session* master , Session* other);
+    void disconnectPair(Session* master , Session* other);
+    void connectAll(bool connect);
+    QList<Session*> masters() const;
+
+    // maps sessions to their master status
+    QHash<Session*,bool> _sessions;
+
+    int _masterMode;
+};
+
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/ShellCommand.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,168 @@
+/*
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "ShellCommand.h"
+
+//some versions of gcc(4.3) require explicit include
+#include <cstdlib>
+
+
+using namespace Konsole;
+
+// expands environment variables in 'text'
+// function copied from kdelibs/kio/kio/kurlcompletion.cpp
+static bool expandEnv(QString& text);
+
+ShellCommand::ShellCommand(const QString& fullCommand)
+{
+    bool inQuotes = false;
+
+    QString builder;
+
+    for ( int i = 0 ; i < fullCommand.count() ; i++ )
+    {
+        QChar ch = fullCommand[i];
+
+        const bool isLastChar = ( i == fullCommand.count() - 1 );
+        const bool isQuote = ( ch == '\'' || ch == '\"' );
+
+        if ( !isLastChar && isQuote )
+            inQuotes = !inQuotes;
+        else
+        { 
+            if ( (!ch.isSpace() || inQuotes) && !isQuote )
+                builder.append(ch);
+
+            if ( (ch.isSpace() && !inQuotes) || ( i == fullCommand.count()-1 ) )
+            {
+                _arguments << builder;      
+                builder.clear(); 
+            }
+        }
+    }
+}
+ShellCommand::ShellCommand(const QString& command , const QStringList& arguments)
+{
+    _arguments = arguments;
+    
+    if ( !_arguments.isEmpty() )
+        _arguments[0] == command;
+}
+QString ShellCommand::fullCommand() const
+{
+    return _arguments.join(QChar(' '));
+}
+QString ShellCommand::command() const
+{
+    if ( !_arguments.isEmpty() )
+        return _arguments[0];
+    else
+        return QString();
+}
+QStringList ShellCommand::arguments() const
+{
+    return _arguments;
+}
+bool ShellCommand::isRootCommand() const
+{
+    Q_ASSERT(0); // not implemented yet
+    return false;
+}
+bool ShellCommand::isAvailable() const
+{
+    Q_ASSERT(0); // not implemented yet
+    return false; 
+}
+QStringList ShellCommand::expand(const QStringList& items)
+{
+    QStringList result;
+
+    foreach( QString item , items )
+        result << expand(item);
+
+    return result;
+}
+QString ShellCommand::expand(const QString& text)
+{
+    QString result = text;
+    expandEnv(result);
+    return result;
+}
+
+/*
+ * expandEnv
+ *
+ * Expand environment variables in text. Escaped '$' characters are ignored.
+ * Return true if any variables were expanded
+ */
+static bool expandEnv( QString &text )
+{
+	// Find all environment variables beginning with '$'
+	//
+	int pos = 0;
+
+	bool expanded = false;
+
+	while ( (pos = text.indexOf(QLatin1Char('$'), pos)) != -1 ) {
+
+		// Skip escaped '$'
+		//
+		if ( pos > 0 && text.at(pos-1) == QLatin1Char('\\') ) {
+			pos++;
+		}
+		// Variable found => expand
+		//
+		else {
+			// Find the end of the variable = next '/' or ' '
+			//
+			int pos2 = text.indexOf( QLatin1Char(' '), pos+1 );
+			int pos_tmp = text.indexOf( QLatin1Char('/'), pos+1 );
+
+			if ( pos2 == -1 || (pos_tmp != -1 && pos_tmp < pos2) )
+				pos2 = pos_tmp;
+
+			if ( pos2 == -1 )
+				pos2 = text.length();
+
+			// Replace if the variable is terminated by '/' or ' '
+			// and defined
+			//
+			if ( pos2 >= 0 ) {
+				int len	= pos2 - pos;
+				QString key	= text.mid( pos+1, len-1);
+				QString value =
+					QString::fromLocal8Bit( ::getenv(key.toLocal8Bit()) );
+
+				if ( !value.isEmpty() ) {
+					expanded = true;
+					text.replace( pos, len, value );
+					pos = pos + value.length();
+				}
+				else {
+					pos = pos2;
+				}
+			}
+		}
+	}
+
+	return expanded;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/ShellCommand.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,94 @@
+/*
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 SHELLCOMMAND_H
+#define SHELLCOMMAND_H
+
+// Qt
+#include <QtCore/QStringList>
+
+namespace Konsole
+{
+
+/** 
+ * A class to parse and extract information about shell commands. 
+ *
+ * ShellCommand can be used to:
+ *
+ * <ul>
+ *      <li>Take a command-line (eg "/bin/sh -c /path/to/my/script") and split it
+ *          into its component parts (eg. the command "/bin/sh" and the arguments
+ *          "-c","/path/to/my/script")
+ *      </li>
+ *      <li>Take a command and a list of arguments and combine them to 
+ *          form a complete command line.
+ *      </li>
+ *      <li>Determine whether the binary specified by a command exists in the
+ *          user's PATH.
+ *      </li>
+ *      <li>Determine whether a command-line specifies the execution of
+ *          another command as the root user using su/sudo etc.
+ *      </li>
+ * </ul> 
+ */
+class ShellCommand
+{
+public:
+    /**
+     * Constructs a ShellCommand from a command line.
+     *
+     * @param fullCommand The command line to parse.  
+     */
+    ShellCommand(const QString& fullCommand);
+    /**
+     * Constructs a ShellCommand with the specified @p command and @p arguments.
+     */
+    ShellCommand(const QString& command , const QStringList& arguments);
+
+    /** Returns the command. */
+    QString command() const;
+    /** Returns the arguments. */
+    QStringList arguments() const;
+
+    /** 
+     * Returns the full command line. 
+     */
+    QString fullCommand() const;
+
+    /** Returns true if this is a root command. */
+    bool isRootCommand() const;
+    /** Returns true if the program specified by @p command() exists. */
+    bool isAvailable() const;
+
+    /** Expands environment variables in @p text .*/
+    static QString expand(const QString& text);
+
+    /** Expands environment variables in each string in @p list. */
+    static QStringList expand(const QStringList& items);
+
+private:
+    QStringList _arguments;    
+};
+
+}
+
+#endif // SHELLCOMMAND_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/TerminalCharacterDecoder.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,227 @@
+/*
+    This file is part of Konsole, an X terminal.
+    
+    Copyright (C) 2006 by Robert Knight <robertknight@gmail.com>
+    
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser 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 Lesser 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.
+*/
+
+// Own
+#include "TerminalCharacterDecoder.h"
+
+// Qt
+#include <QtCore/QTextStream>
+
+
+using namespace Konsole;
+
+PlainTextDecoder::PlainTextDecoder()
+ : _output(0)
+ , _includeTrailingWhitespace(true)
+{
+
+}
+void PlainTextDecoder::setTrailingWhitespace(bool enable)
+{
+    _includeTrailingWhitespace = enable;
+}
+bool PlainTextDecoder::trailingWhitespace() const
+{
+    return _includeTrailingWhitespace;
+}
+void PlainTextDecoder::begin(QTextStream* output)
+{
+   _output = output; 
+}
+void PlainTextDecoder::end()
+{
+    _output = 0;
+}
+void PlainTextDecoder::decodeLine(const Character* const characters, int count, LineProperty /*properties*/
+							 )
+{
+    Q_ASSERT( _output );
+
+	//TODO should we ignore or respect the LINE_WRAPPED line property?
+
+	//note:  we build up a QString and send it to the text stream rather writing into the text
+	//stream a character at a time because it is more efficient.
+	//(since QTextStream always deals with QStrings internally anyway)
+	QString plainText;
+	plainText.reserve(count);
+   
+    int outputCount = count;
+
+    // if inclusion of trailing whitespace is disabled then find the end of the
+    // line
+    if ( !_includeTrailingWhitespace )
+    {
+        for (int i = count-1 ; i >= 0 ; i--)
+        {
+            if ( characters[i].character != ' '  )
+                break;
+            else
+                outputCount--;
+        }
+    }
+
+	for (int i=0;i<outputCount;i++)
+	{
+		plainText.append( QChar(characters[i].character) );
+	}
+
+	*_output << plainText;
+}
+
+HTMLDecoder::HTMLDecoder() :
+        _output(0)
+	   ,_colorTable(base_color_table)
+       ,_innerSpanOpen(false)
+       ,_lastRendition(DEFAULT_RENDITION)
+{
+	
+}
+
+void HTMLDecoder::begin(QTextStream* output)
+{
+    _output = output;
+
+    QString text;
+
+	//open monospace span
+    openSpan(text,"font-family:monospace");
+
+    *output << text;
+}
+
+void HTMLDecoder::end()
+{
+    Q_ASSERT( _output );
+
+    QString text;
+
+    closeSpan(text);
+
+    *_output << text;
+
+    _output = 0;
+
+}
+
+//TODO: Support for LineProperty (mainly double width , double height)
+void HTMLDecoder::decodeLine(const Character* const characters, int count, LineProperty /*properties*/
+							)
+{
+    Q_ASSERT( _output );
+
+	QString text;
+
+	int spaceCount = 0;
+		
+	for (int i=0;i<count;i++)
+	{
+		QChar ch(characters[i].character);
+
+		//check if appearance of character is different from previous char
+		if ( characters[i].rendition != _lastRendition  ||
+		     characters[i].foregroundColor != _lastForeColor  ||
+			 characters[i].backgroundColor != _lastBackColor )
+		{
+			if ( _innerSpanOpen )
+					closeSpan(text);
+
+			_lastRendition = characters[i].rendition;
+			_lastForeColor = characters[i].foregroundColor;
+			_lastBackColor = characters[i].backgroundColor;
+			
+			//build up style string
+			QString style;
+
+			if ( _lastRendition & RE_BOLD ||
+                             (_colorTable && characters[i].isBold(_colorTable)) )
+					style.append("font-weight:bold;");
+
+
+			if ( _lastRendition & RE_UNDERLINE )
+					style.append("font-decoration:underline;");
+		
+			//colours - a colour table must have been defined first
+			if ( _colorTable )	
+			{
+				style.append( QString("color:%1;").arg(_lastForeColor.color(_colorTable).name() ) );
+
+				if (!characters[i].isTransparent(_colorTable))
+				{
+					style.append( QString("background-color:%1;").arg(_lastBackColor.color(_colorTable).name() ) );
+				}
+			}
+		
+			//open the span with the current style	
+			openSpan(text,style);
+			_innerSpanOpen = true;
+		}
+
+		//handle whitespace
+		if (ch.isSpace())
+			spaceCount++;
+		else
+			spaceCount = 0;
+		
+
+		//output current character
+		if (spaceCount < 2)
+		{
+			//escape HTML tag characters and just display others as they are
+			if ( ch == '<' )
+				text.append("&lt;");
+			else if (ch == '>')
+					text.append("&gt;");
+			else	
+					text.append(ch);
+		}
+		else
+		{
+			text.append("&nbsp;"); //HTML truncates multiple spaces, so use a space marker instead
+		}
+		
+	}
+
+	//close any remaining open inner spans
+	if ( _innerSpanOpen )
+		closeSpan(text);
+
+	//start new line
+	text.append("<br>");
+	
+	*_output << text;
+}
+
+void HTMLDecoder::openSpan(QString& text , const QString& style)
+{
+	text.append( QString("<span style=\"%1\">").arg(style) );
+}
+
+void HTMLDecoder::closeSpan(QString& text)
+{
+	text.append("</span>");
+}
+
+void HTMLDecoder::setColorTable(const ColorEntry* table)
+{
+	_colorTable = table;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/TerminalCharacterDecoder.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,139 @@
+/*
+    This file is part of Konsole, an X terminal.
+    
+    Copyright (C) 2006-7 by Robert Knight <robertknight@gmail.com>
+    
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser 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 Lesser 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 TERMINAL_CHARACTER_DECODER_H
+#define TERMINAL_CHARACTER_DECODER_H
+
+#include "Character.h"
+
+class QTextStream;
+
+namespace Konsole
+{
+
+/**
+ * Base class for terminal character decoders
+ *
+ * The decoder converts lines of terminal characters which consist of a unicode character, foreground
+ * and background colours and other appearance-related properties into text strings.
+ *
+ * Derived classes may produce either plain text with no other colour or appearance information, or
+ * they may produce text which incorporates these additional properties. 
+ */
+class TerminalCharacterDecoder
+{
+public:
+	virtual ~TerminalCharacterDecoder() {}
+
+    /** Begin decoding characters.  The resulting text is appended to @p output. */
+    virtual void begin(QTextStream* output) = 0;
+    /** End decoding. */
+    virtual void end() = 0;
+
+	/**
+	 * Converts a line of terminal characters with associated properties into a text string
+	 * and writes the string into an output QTextStream.
+	 *
+	 * @param characters An array of characters of length @p count.
+	 * @param properties Additional properties which affect all characters in the line
+	 * @param output The output stream which receives the decoded text
+	 */
+	virtual void decodeLine(const Character* const characters, 
+							int count,
+							LineProperty properties) = 0; 
+};
+
+/**
+ * A terminal character decoder which produces plain text, ignoring colours and other appearance-related
+ * properties of the original characters.
+ */
+class PlainTextDecoder : public TerminalCharacterDecoder
+{
+public:
+	PlainTextDecoder(); 
+
+    /** 
+     * Set whether trailing whitespace at the end of lines should be included 
+     * in the output.
+     * Defaults to true.
+     */
+    void setTrailingWhitespace(bool enable);
+    /**
+     * Returns whether trailing whitespace at the end of lines is included
+     * in the output.
+     */
+    bool trailingWhitespace() const;
+
+    virtual void begin(QTextStream* output);
+    virtual void end();
+
+	virtual void decodeLine(const Character* const characters,
+							int count,
+							LineProperty properties);	
+
+    
+private:
+    QTextStream* _output;
+    bool _includeTrailingWhitespace;
+};
+
+/**
+ * A terminal character decoder which produces pretty HTML markup
+ */
+class HTMLDecoder : public TerminalCharacterDecoder
+{
+public:
+	/** 
+	 * Constructs an HTML decoder using a default black-on-white color scheme.
+	 */
+	HTMLDecoder();
+
+	/**
+	 * Sets the colour table which the decoder uses to produce the HTML colour codes in its
+	 * output
+	 */
+	void setColorTable( const ColorEntry* table );
+		
+	virtual void decodeLine(const Character* const characters,
+							int count,
+							LineProperty properties);
+
+    virtual void begin(QTextStream* output);
+    virtual void end();
+
+private:
+	void openSpan(QString& text , const QString& style);
+	void closeSpan(QString& text);
+
+    QTextStream* _output;
+	const ColorEntry* _colorTable;
+    bool _innerSpanOpen; 
+	quint8 _lastRendition;
+	CharacterColor _lastForeColor;
+	CharacterColor _lastBackColor;
+
+};
+
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/TerminalDisplay.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,2724 @@
+/*
+    This file is part of Konsole, a terminal emulator for KDE.
+    
+    Copyright (C) 2006-7 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+    
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "TerminalDisplay.h"
+
+// Qt
+#include <QtGui/QApplication>
+#include <QtGui/QBoxLayout>
+#include <QtGui/QClipboard>
+#include <QtGui/QKeyEvent>
+#include <QtCore/QEvent>
+#include <QtCore/QTime>
+#include <QtCore/QFile>
+#include <QtGui/QGridLayout>
+#include <QtGui/QLabel>
+#include <QtGui/QLayout>
+#include <QtGui/QPainter>
+#include <QtGui/QPixmap>
+#include <QtGui/QScrollBar>
+#include <QtGui/QStyle>
+#include <QtCore>
+#include <QtGui>
+
+#include "Filter.h"
+#include "konsole_wcwidth.h"
+#include "ScreenWindow.h"
+#include "TerminalCharacterDecoder.h"
+#include "ColorTables.h"
+
+using namespace Konsole;
+
+#ifndef loc
+#define loc(X,Y) ((Y)*_columns+(X))
+#endif
+
+#define yMouseScroll 1
+
+#define REPCHAR   "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
+                  "abcdefgjijklmnopqrstuvwxyz" \
+                  "0123456789./+@"
+
+// scroll increment used when dragging selection at top/bottom of window.
+
+// static
+bool TerminalDisplay::_antialiasText = true;
+bool TerminalDisplay::HAVE_TRANSPARENCY = false;
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                                Colors                                     */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb)
+
+   Code        0       1       2       3       4       5       6       7
+   ----------- ------- ------- ------- ------- ------- ------- ------- -------
+   ANSI  (bgr) Black   Red     Green   Yellow  Blue    Magenta Cyan    White
+   IBMPC (rgb) Black   Blue    Green   Cyan    Red     Magenta Yellow  White
+*/
+
+ScreenWindow* TerminalDisplay::screenWindow() const
+{
+    return _screenWindow;
+}
+void TerminalDisplay::setScreenWindow(ScreenWindow* window)
+{
+    // disconnect existing screen window if any
+    if ( _screenWindow )
+    {
+        disconnect( _screenWindow , 0 , this , 0 );
+    }
+
+    _screenWindow = window;
+
+    if ( window )
+    {
+//#warning "The order here is not specified - does it matter whether updateImage or updateLineProperties comes first?"
+        connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateLineProperties()) );
+        connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateImage()) );
+	window->setWindowLines(_lines);
+    }
+}
+
+const ColorEntry* TerminalDisplay::colorTable() const
+{
+  return _colorTable;
+}
+
+void TerminalDisplay::setColorTable(const ColorEntry table[])
+{
+  for (int i = 0; i < TABLE_COLORS; i++)
+      _colorTable[i] = table[i];
+
+  QPalette p = palette();
+  p.setColor( backgroundRole(), _colorTable[DEFAULT_BACK_COLOR].color );
+  setPalette( p );
+
+  // Avoid propagating the palette change to the scroll bar 
+  _scrollBar->setPalette( QApplication::palette() );  
+
+  update();
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                                   Font                                    */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/*
+   The VT100 has 32 special graphical characters. The usual vt100 extended
+   xterm fonts have these at 0x00..0x1f.
+
+   QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals
+   come in here as proper unicode characters.
+
+   We treat non-iso10646 fonts as VT100 extended and do the requiered mapping
+   from unicode to 0x00..0x1f. The remaining translation is then left to the
+   QCodec.
+*/
+
+static inline bool isLineChar(quint16 c) { return ((c & 0xFF80) == 0x2500);}
+static inline bool isLineCharString(const QString& string)
+{
+		return (string.length() > 0) && (isLineChar(string.at(0).unicode()));
+}
+						
+
+// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i.
+
+unsigned short Konsole::vt100_graphics[32] =
+{ // 0/8     1/9    2/10    3/11    4/12    5/13    6/14    7/15
+  0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0,
+  0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
+  0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534,
+  0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7
+};
+
+void TerminalDisplay::fontChange(const QFont&)
+{
+  QFontMetrics fm(font());
+  _fontHeight = fm.height() + _lineSpacing;
+
+
+  // waba TerminalDisplay 1.123:
+  // "Base character width on widest ASCII character. This prevents too wide
+  //  characters in the presence of double wide (e.g. Japanese) characters."
+  // Get the width from representative normal width characters
+  _fontWidth = qRound((double)fm.width(REPCHAR)/(double)strlen(REPCHAR));
+
+  _fixedFont = true;
+
+  int fw = fm.width(REPCHAR[0]);
+  for(unsigned int i=1; i< strlen(REPCHAR); i++)
+  {
+    if (fw != fm.width(REPCHAR[i]))
+    {
+      _fixedFont = false;
+      break;
+    }
+  }
+
+  if (_fontWidth < 1)
+    _fontWidth=1;
+
+  _fontAscent = fm.ascent();
+
+  emit changedFontMetricSignal( _fontHeight, _fontWidth );
+  propagateSize();
+  update();
+}
+
+void TerminalDisplay::setVTFont(const QFont& f)
+{
+  QFont font = f;
+
+  QFontMetrics metrics(font);
+
+  if ( metrics.height() < height() && metrics.maxWidth() < width() )
+  {
+    // hint that text should be drawn without anti-aliasing.  
+    // depending on the user's font configuration, this may not be respected
+    if (!_antialiasText)
+        font.setStyleStrategy( QFont::NoAntialias );
+ 
+    // experimental optimization.  Konsole assumes that the terminal is using a 
+    // mono-spaced font, in which case kerning information should have an effect.
+    // Disabling kerning saves some computation when rendering text. 
+    font.setKerning(false);
+
+    QWidget::setFont(font);
+    fontChange(font);
+  }
+}
+
+void TerminalDisplay::setFont(const QFont &)
+{
+  // ignore font change request if not coming from konsole itself
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                         Constructor / Destructor                          */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+TerminalDisplay::TerminalDisplay(QWidget *parent)
+:QWidget(parent)
+,_screenWindow(0)
+,_allowBell(true)
+,_gridLayout(0)
+,_fontHeight(1)
+,_fontWidth(1)
+,_fontAscent(1)
+,_lines(1)
+,_columns(1)
+,_usedLines(1)
+,_usedColumns(1)
+,_contentHeight(1)
+,_contentWidth(1)
+,_image(0)
+,_randomSeed(0)
+,_resizing(false)
+,_terminalSizeHint(false)
+,_terminalSizeStartup(true)
+,_bidiEnabled(false)
+,_actSel(0)
+,_wordSelectionMode(false)
+,_lineSelectionMode(false)
+,_preserveLineBreaks(false)
+,_columnSelectionMode(false)
+,_scrollbarLocation(NoScrollBar)
+,_wordCharacters(":@-./_~")
+,_bellMode(SystemBeepBell)
+,_blinking(false)
+,_cursorBlinking(false)
+,_hasBlinkingCursor(false)
+,_ctrlDrag(false)
+,_tripleClickMode(SelectWholeLine)
+,_isFixedSize(false)
+,_possibleTripleClick(false)
+,_resizeWidget(0)
+,_resizeTimer(0)
+,_flowControlWarningEnabled(false)
+,_outputSuspendedLabel(0)
+,_lineSpacing(0)
+,_colorsInverted(false)
+,_blendColor(qRgba(0,0,0,0xff))
+,_filterChain(new TerminalImageFilterChain())
+,_cursorShape(BlockCursor)
+{
+  // terminal applications are not designed with Right-To-Left in mind,
+  // so the layout is forced to Left-To-Right
+  setLayoutDirection(Qt::LeftToRight);
+
+  // The offsets are not yet calculated.
+  // Do not calculate these too often to be more smoothly when resizing
+  // konsole in opaque mode.
+  _topMargin = DEFAULT_TOP_MARGIN;
+  _leftMargin = DEFAULT_LEFT_MARGIN;
+
+  // create scroll bar for scrolling output up and down
+  // set the scroll bar's slider to occupy the whole area of the scroll bar initially
+  _scrollBar = new QScrollBar(this);
+  setScroll(0,0); 
+  _scrollBar->setCursor( Qt::ArrowCursor );
+  connect(_scrollBar, SIGNAL(valueChanged(int)), this, 
+  					  SLOT(scrollBarPositionChanged(int)));
+
+  // setup timers for blinking cursor and text
+  _blinkTimer   = new QTimer(this);
+  connect(_blinkTimer, SIGNAL(timeout()), this, SLOT(blinkEvent()));
+  _blinkCursorTimer   = new QTimer(this);
+  connect(_blinkCursorTimer, SIGNAL(timeout()), this, SLOT(blinkCursorEvent()));
+
+//  QCursor::setAutoHideCursor( this, true );
+  
+  setUsesMouse(true);
+  setColorTable(whiteonblack_color_table); 
+//  setColorTable(blackonlightyellow_color_table); 
+  setMouseTracking(true);
+
+  // Enable drag and drop 
+  setAcceptDrops(true); // attempt
+  dragInfo.state = diNone;
+
+  setFocusPolicy( Qt::WheelFocus );
+
+  // enable input method support
+  setAttribute(Qt::WA_InputMethodEnabled, true);
+
+  // this is an important optimization, it tells Qt
+  // that TerminalDisplay will handle repainting its entire area.
+  setAttribute(Qt::WA_OpaquePaintEvent);
+
+  _gridLayout = new QGridLayout(this);
+  _gridLayout->setMargin(0);
+
+  setLayout( _gridLayout ); 
+
+  //set up a warning message when the user presses Ctrl+S to avoid confusion
+  connect( this,SIGNAL(flowControlKeyPressed(bool)),this,SLOT(outputSuspended(bool)) );
+}
+
+TerminalDisplay::~TerminalDisplay()
+{
+  qApp->removeEventFilter( this );
+  
+  delete[] _image;
+
+  delete _gridLayout;
+  delete _outputSuspendedLabel;
+  delete _filterChain;
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                             Display Operations                            */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/**
+ A table for emulating the simple (single width) unicode drawing chars.
+ It represents the 250x - 257x glyphs. If it's zero, we can't use it.
+ if it's not, it's encoded as follows: imagine a 5x5 grid where the points are numbered
+ 0 to 24 left to top, top to bottom. Each point is represented by the corresponding bit.
+
+ Then, the pixels basically have the following interpretation:
+ _|||_
+ -...-
+ -...-
+ -...-
+ _|||_
+
+where _ = none
+      | = vertical line.
+      - = horizontal line.
+ */
+
+
+enum LineEncode
+{
+    TopL  = (1<<1),
+    TopC  = (1<<2),
+    TopR  = (1<<3),
+
+    LeftT = (1<<5),
+    Int11 = (1<<6),
+    Int12 = (1<<7),
+    Int13 = (1<<8),
+    RightT = (1<<9),
+
+    LeftC = (1<<10),
+    Int21 = (1<<11),
+    Int22 = (1<<12),
+    Int23 = (1<<13),
+    RightC = (1<<14),
+
+    LeftB = (1<<15),
+    Int31 = (1<<16),
+    Int32 = (1<<17),
+    Int33 = (1<<18),
+    RightB = (1<<19),
+
+    BotL  = (1<<21),
+    BotC  = (1<<22),
+    BotR  = (1<<23)
+};
+
+#include "LineFont.h"
+
+static void drawLineChar(QPainter& paint, int x, int y, int w, int h, uchar code)
+{
+    //Calculate cell midpoints, end points.
+    int cx = x + w/2;
+    int cy = y + h/2;
+    int ex = x + w - 1;
+    int ey = y + h - 1;
+
+    quint32 toDraw = LineChars[code];
+
+    //Top _lines:
+    if (toDraw & TopL)
+        paint.drawLine(cx-1, y, cx-1, cy-2);
+    if (toDraw & TopC)
+        paint.drawLine(cx, y, cx, cy-2);
+    if (toDraw & TopR)
+        paint.drawLine(cx+1, y, cx+1, cy-2);
+
+    //Bot _lines:
+    if (toDraw & BotL)
+        paint.drawLine(cx-1, cy+2, cx-1, ey);
+    if (toDraw & BotC)
+        paint.drawLine(cx, cy+2, cx, ey);
+    if (toDraw & BotR)
+        paint.drawLine(cx+1, cy+2, cx+1, ey);
+
+    //Left _lines:
+    if (toDraw & LeftT)
+        paint.drawLine(x, cy-1, cx-2, cy-1);
+    if (toDraw & LeftC)
+        paint.drawLine(x, cy, cx-2, cy);
+    if (toDraw & LeftB)
+        paint.drawLine(x, cy+1, cx-2, cy+1);
+
+    //Right _lines:
+    if (toDraw & RightT)
+        paint.drawLine(cx+2, cy-1, ex, cy-1);
+    if (toDraw & RightC)
+        paint.drawLine(cx+2, cy, ex, cy);
+    if (toDraw & RightB)
+        paint.drawLine(cx+2, cy+1, ex, cy+1);
+
+    //Intersection points.
+    if (toDraw & Int11)
+        paint.drawPoint(cx-1, cy-1);
+    if (toDraw & Int12)
+        paint.drawPoint(cx, cy-1);
+    if (toDraw & Int13)
+        paint.drawPoint(cx+1, cy-1);
+
+    if (toDraw & Int21)
+        paint.drawPoint(cx-1, cy);
+    if (toDraw & Int22)
+        paint.drawPoint(cx, cy);
+    if (toDraw & Int23)
+        paint.drawPoint(cx+1, cy);
+
+    if (toDraw & Int31)
+        paint.drawPoint(cx-1, cy+1);
+    if (toDraw & Int32)
+        paint.drawPoint(cx, cy+1);
+    if (toDraw & Int33)
+        paint.drawPoint(cx+1, cy+1);
+
+}
+
+void TerminalDisplay::drawLineCharString(	QPainter& painter, int x, int y, const QString& str, 
+									const Character* attributes)
+{
+		const QPen& currentPen = painter.pen();
+		
+		if ( attributes->rendition & RE_BOLD )
+		{
+			QPen boldPen(currentPen);
+			boldPen.setWidth(3);
+			painter.setPen( boldPen );
+		}	
+		
+		for (int i=0 ; i < str.length(); i++)
+		{
+			uchar code = str[i].cell();
+        	if (LineChars[code])
+            	drawLineChar(painter, x + (_fontWidth*i), y, _fontWidth, _fontHeight, code);
+		}
+
+		painter.setPen( currentPen );
+}
+
+void TerminalDisplay::setKeyboardCursorShape(KeyboardCursorShape shape)
+{
+    _cursorShape = shape;
+}
+TerminalDisplay::KeyboardCursorShape TerminalDisplay::keyboardCursorShape() const
+{
+    return _cursorShape;
+}
+void TerminalDisplay::setKeyboardCursorColor(bool useForegroundColor, const QColor& color)
+{
+    if (useForegroundColor)
+        _cursorColor = QColor(); // an invalid color means that
+                                 // the foreground color of the
+                                 // current character should
+                                 // be used
+
+    else
+        _cursorColor = color;
+}
+QColor TerminalDisplay::keyboardCursorColor() const
+{
+    return _cursorColor;
+}
+
+void TerminalDisplay::setOpacity(qreal opacity)
+{
+    QColor color(_blendColor);
+    color.setAlphaF(opacity);
+
+    // enable automatic background filling to prevent the display
+    // flickering if there is no transparency
+    if ( color.alpha() == 255 ) 
+    {
+        setAutoFillBackground(true);
+    }
+    else
+    {
+        setAutoFillBackground(false);
+    }
+
+    _blendColor = color.rgba();
+}
+
+void TerminalDisplay::drawBackground(QPainter& painter, const QRect& rect, const QColor& backgroundColor, bool useOpacitySetting )
+{
+        // the area of the widget showing the contents of the terminal display is drawn
+        // using the background color from the color scheme set with setColorTable()
+        //
+        // the area of the widget behind the scroll-bar is drawn using the background
+        // brush from the scroll-bar's palette, to give the effect of the scroll-bar
+        // being outside of the terminal display and visual consistency with other KDE
+        // applications.  
+        //
+        QRect scrollBarArea = _scrollBar->isVisible() ? 
+                                    rect.intersected(_scrollBar->geometry()) :
+                                    QRect();
+        QRegion contentsRegion = QRegion(rect).subtracted(scrollBarArea);
+        QRect contentsRect = contentsRegion.boundingRect();
+
+        if ( HAVE_TRANSPARENCY && qAlpha(_blendColor) < 0xff && useOpacitySetting ) 
+        {
+            QColor color(backgroundColor);
+            color.setAlpha(qAlpha(_blendColor));
+
+            painter.save();
+            painter.setCompositionMode(QPainter::CompositionMode_Source);
+            painter.fillRect(contentsRect, color);
+            painter.restore();
+        } 
+        else {
+	    painter.fillRect(contentsRect, backgroundColor);
+	}
+
+        painter.fillRect(scrollBarArea,_scrollBar->palette().background());
+}
+
+void TerminalDisplay::drawCursor(QPainter& painter, 
+                                 const QRect& rect,
+                                 const QColor& foregroundColor,
+                                 const QColor& /*backgroundColor*/,
+                                 bool& invertCharacterColor)
+{
+    QRect cursorRect = rect;
+    cursorRect.setHeight(_fontHeight - _lineSpacing - 1);
+    
+    if (!_cursorBlinking)
+    {
+       if ( _cursorColor.isValid() )
+           painter.setPen(_cursorColor);
+       else {
+    	    painter.setPen(foregroundColor);
+	}
+
+       if ( _cursorShape == BlockCursor )
+       {
+            // draw the cursor outline, adjusting the area so that
+            // it is draw entirely inside 'rect'
+            int penWidth = qMax(1,painter.pen().width());
+
+            painter.drawRect(cursorRect.adjusted(penWidth/2,
+                                                 penWidth/2,
+                                                 - penWidth/2 - penWidth%2,
+                                                 - penWidth/2 - penWidth%2));
+            if ( hasFocus() )
+            {
+                painter.fillRect(cursorRect, _cursorColor.isValid() ? _cursorColor : foregroundColor);
+	    
+                if ( !_cursorColor.isValid() )
+                {
+                    // invert the colour used to draw the text to ensure that the character at
+                    // the cursor position is readable
+                    invertCharacterColor = true;
+                }
+            }
+       }
+       else if ( _cursorShape == UnderlineCursor )
+            painter.drawLine(cursorRect.left(),
+                             cursorRect.bottom(),
+                             cursorRect.right(),
+                             cursorRect.bottom());
+       else if ( _cursorShape == IBeamCursor )
+            painter.drawLine(cursorRect.left(),
+                             cursorRect.top(),
+                             cursorRect.left(),
+                             cursorRect.bottom());
+    
+    }
+}
+
+void TerminalDisplay::drawCharacters(QPainter& painter,
+                                     const QRect& rect,
+                                     const QString& text,
+                                     const Character* style,
+                                     bool invertCharacterColor)
+{
+    // don't draw text which is currently blinking
+    if ( _blinking && (style->rendition & RE_BLINK) )
+            return;
+   
+    // setup bold and underline
+    bool useBold = style->rendition & RE_BOLD || style->isBold(_colorTable) || font().bold();
+    bool useUnderline = style->rendition & RE_UNDERLINE || font().underline();
+
+    QFont font = painter.font();
+    if (    font.bold() != useBold 
+         || font.underline() != useUnderline )
+    {
+       font.setBold(useBold);
+       font.setUnderline(useUnderline);
+       painter.setFont(font);
+    }
+
+    const CharacterColor& textColor = ( invertCharacterColor ? style->backgroundColor : style->foregroundColor );
+    const QColor color = textColor.color(_colorTable);
+
+    QPen pen = painter.pen();
+    if ( pen.color() != color )
+    {
+        pen.setColor(color);
+        painter.setPen(color);
+    }
+    // draw text
+    if ( isLineCharString(text) ) {
+	  	drawLineCharString(painter,rect.x(),rect.y(),text,style);
+    }
+    else
+	{
+		// the drawText(rect,flags,string) overload is used here with null flags
+		// instead of drawText(rect,string) because the (rect,string) overload causes 
+		// the application's default layout direction to be used instead of 
+		// the widget-specific layout direction, which should always be
+		// Qt::LeftToRight for this widget
+        painter.drawText(rect,0,text);
+	}
+}
+
+void TerminalDisplay::drawTextFragment(QPainter& painter , 
+                                       const QRect& rect,
+                                       const QString& text, 
+                                       const Character* style)
+{
+    painter.save();
+
+    // setup painter 
+    const QColor foregroundColor = style->foregroundColor.color(_colorTable);
+    const QColor backgroundColor = style->backgroundColor.color(_colorTable);
+    
+    // draw background if different from the display's background color
+    if ( backgroundColor != palette().background().color() )
+        drawBackground(painter,rect,backgroundColor, false /* do not use transparency */);
+
+    // draw cursor shape if the current character is the cursor
+    // this may alter the foreground and background colors
+    bool invertCharacterColor = false;
+
+    if ( style->rendition & RE_CURSOR )
+        drawCursor(painter,rect,foregroundColor,backgroundColor,invertCharacterColor);
+    // draw text
+    drawCharacters(painter,rect,text,style,invertCharacterColor);
+
+    painter.restore();
+}
+
+void TerminalDisplay::setRandomSeed(uint randomSeed) { _randomSeed = randomSeed; }
+uint TerminalDisplay::randomSeed() const { return _randomSeed; }
+
+#if 0
+/*!
+    Set XIM Position
+*/
+void TerminalDisplay::setCursorPos(const int curx, const int cury)
+{
+    QPoint tL  = contentsRect().topLeft();
+    int    tLx = tL.x();
+    int    tLy = tL.y();
+
+    int xpos, ypos;
+    ypos = _topMargin + tLy + _fontHeight*(cury-1) + _fontAscent;
+    xpos = _leftMargin + tLx + _fontWidth*curx;
+    //setMicroFocusHint(xpos, ypos, 0, _fontHeight); //### ???
+    // fprintf(stderr, "x/y = %d/%d\txpos/ypos = %d/%d\n", curx, cury, xpos, ypos);
+    _cursorLine = cury;
+    _cursorCol = curx;
+}
+#endif
+
+// scrolls the image by 'lines', down if lines > 0 or up otherwise.
+//
+// the terminal emulation keeps track of the scrolling of the character 
+// image as it receives input, and when the view is updated, it calls scrollImage() 
+// with the final scroll amount.  this improves performance because scrolling the 
+// display is much cheaper than re-rendering all the text for the 
+// part of the image which has moved up or down.  
+// Instead only new lines have to be drawn
+//
+// note:  it is important that the area of the display which is 
+// scrolled aligns properly with the character grid - 
+// which has a top left point at (_leftMargin,_topMargin) , 
+// a cell width of _fontWidth and a cell height of _fontHeight).    
+void TerminalDisplay::scrollImage(int lines , const QRect& screenWindowRegion)
+{
+	// if the flow control warning is enabled this will interfere with the 
+	// scrolling optimisations and cause artifacts.  the simple solution here
+	// is to just disable the optimisation whilst it is visible
+	if ( _outputSuspendedLabel && _outputSuspendedLabel->isVisible() ) {
+		return;
+	}
+
+    // constrain the region to the display
+    // the bottom of the region is capped to the number of lines in the display's
+    // internal image - 2, so that the height of 'region' is strictly less
+    // than the height of the internal image.
+    QRect region = screenWindowRegion;
+    region.setBottom( qMin(region.bottom(),this->_lines-2) ); 
+
+    if (    lines == 0 
+         || _image == 0
+         || !region.isValid() 
+         || (region.top() + abs(lines)) >= region.bottom() 
+         || this->_lines <= region.height() ) return;
+
+    QRect scrollRect;
+
+    void* firstCharPos = &_image[ region.top() * this->_columns ];
+    void* lastCharPos = &_image[ (region.top() + abs(lines)) * this->_columns ];
+
+    int top = _topMargin + (region.top() * _fontHeight);
+    int linesToMove = region.height() - abs(lines);
+    int bytesToMove = linesToMove * 
+                      this->_columns *
+                      sizeof(Character);
+
+    Q_ASSERT( linesToMove > 0 );
+    Q_ASSERT( bytesToMove > 0 );
+
+    //scroll internal image
+    if ( lines > 0 )
+    {
+        // check that the memory areas that we are going to move are valid
+        Q_ASSERT( (char*)lastCharPos + bytesToMove < 
+                  (char*)(_image + (this->_lines * this->_columns)) );
+        
+        Q_ASSERT( (lines*this->_columns) < _imageSize ); 
+
+        //scroll internal image down
+        memmove( firstCharPos , lastCharPos , bytesToMove ); 
+      
+        //set region of display to scroll, making sure that
+        //the region aligns correctly to the character grid 
+        scrollRect = QRect( _leftMargin , top, 
+                            this->_usedColumns * _fontWidth , 
+                            linesToMove * _fontHeight );
+    }
+    else
+    {
+        // check that the memory areas that we are going to move are valid
+        Q_ASSERT( (char*)firstCharPos + bytesToMove < 
+                  (char*)(_image + (this->_lines * this->_columns)) );
+
+        //scroll internal image up
+        memmove( lastCharPos , firstCharPos , bytesToMove ); 
+     
+        //set region of the display to scroll, making sure that
+        //the region aligns correctly to the character grid
+        QPoint topPoint( _leftMargin , top + abs(lines)*_fontHeight );
+
+        scrollRect = QRect( topPoint ,
+                     QSize( this->_usedColumns*_fontWidth , 
+                            linesToMove * _fontHeight ));
+    }
+
+    //scroll the display vertically to match internal _image
+    scroll( 0 , _fontHeight * (-lines) , scrollRect );
+}
+
+QRegion TerminalDisplay::hotSpotRegion() const 
+{
+	QRegion region;
+	foreach( Filter::HotSpot* hotSpot , _filterChain->hotSpots() )
+	{
+		QRect rect;
+		rect.setLeft(hotSpot->startColumn());
+		rect.setTop(hotSpot->startLine());
+		rect.setRight(hotSpot->endColumn());
+		rect.setBottom(hotSpot->endLine());
+
+		region |= imageToWidget(rect); 
+	}
+	return region;
+}
+
+void TerminalDisplay::processFilters() 
+{
+	if (!_screenWindow)
+		return;
+
+	QRegion preUpdateHotSpots = hotSpotRegion();
+
+	// use _screenWindow->getImage() here rather than _image because
+	// other classes may call processFilters() when this display's
+	// ScreenWindow emits a scrolled() signal - which will happen before
+	// updateImage() is called on the display and therefore _image is 
+	// out of date at this point
+	_filterChain->setImage( _screenWindow->getImage(),
+							_screenWindow->windowLines(),
+							_screenWindow->windowColumns(),
+							_screenWindow->getLineProperties() );
+    _filterChain->process();
+
+	QRegion postUpdateHotSpots = hotSpotRegion();
+
+	update( preUpdateHotSpots | postUpdateHotSpots );
+}
+
+void TerminalDisplay::updateImage() 
+{
+  if ( !_screenWindow )
+      return;
+
+  // optimization - scroll the existing image where possible and 
+  // avoid expensive text drawing for parts of the image that 
+  // can simply be moved up or down
+  scrollImage( _screenWindow->scrollCount() ,
+               _screenWindow->scrollRegion() );
+  _screenWindow->resetScrollCount();
+
+  Character* const newimg = _screenWindow->getImage();
+  int lines = _screenWindow->windowLines();
+  int columns = _screenWindow->windowColumns();
+
+  setScroll( _screenWindow->currentLine() , _screenWindow->lineCount() );
+
+  if (!_image)
+     updateImageSize(); // Create _image
+
+  Q_ASSERT( this->_usedLines <= this->_lines );
+  Q_ASSERT( this->_usedColumns <= this->_columns );
+
+  int y,x,len;
+
+  QPoint tL  = contentsRect().topLeft();
+
+  int    tLx = tL.x();
+  int    tLy = tL.y();
+  _hasBlinker = false;
+
+  CharacterColor cf;       // undefined
+  CharacterColor _clipboard;       // undefined
+  int cr  = -1;   // undefined
+
+  const int linesToUpdate = qMin(this->_lines, qMax(0,lines  ));
+  const int columnsToUpdate = qMin(this->_columns,qMax(0,columns));
+
+  QChar *disstrU = new QChar[columnsToUpdate];
+  char *dirtyMask = new char[columnsToUpdate+2]; 
+  QRegion dirtyRegion;
+
+  // debugging variable, this records the number of lines that are found to
+  // be 'dirty' ( ie. have changed from the old _image to the new _image ) and
+  // which therefore need to be repainted
+  int dirtyLineCount = 0;
+
+  for (y = 0; y < linesToUpdate; y++)
+  {
+    const Character*       currentLine = &_image[y*this->_columns];
+    const Character* const newLine = &newimg[y*columns];
+
+    bool updateLine = false;
+    
+    // The dirty mask indicates which characters need repainting. We also
+    // mark surrounding neighbours dirty, in case the character exceeds
+    // its cell boundaries
+    memset(dirtyMask, 0, columnsToUpdate+2);
+   
+    for( x = 0 ; x < columnsToUpdate ; x++)
+    {
+        if ( newLine[x] != currentLine[x] ) 
+        {
+            dirtyMask[x] = true;
+        }
+    }
+
+    if (!_resizing) // not while _resizing, we're expecting a paintEvent
+    for (x = 0; x < columnsToUpdate; x++)
+    {
+      _hasBlinker |= (newLine[x].rendition & RE_BLINK);
+    
+      // Start drawing if this character or the next one differs.
+      // We also take the next one into account to handle the situation
+      // where characters exceed their cell width.
+      if (dirtyMask[x])
+      {
+        quint16 c = newLine[x+0].character;
+        if ( !c )
+            continue;
+        int p = 0;
+        disstrU[p++] = c; //fontMap(c);
+        bool lineDraw = isLineChar(c);
+        bool doubleWidth = (x+1 == columnsToUpdate) ? false : (newLine[x+1].character == 0);
+        cr = newLine[x].rendition;
+        _clipboard = newLine[x].backgroundColor;
+        if (newLine[x].foregroundColor != cf) cf = newLine[x].foregroundColor;
+        int lln = columnsToUpdate - x;
+        for (len = 1; len < lln; len++)
+        {
+            const Character& ch = newLine[x+len];
+
+            if (!ch.character)
+                continue; // Skip trailing part of multi-col chars.
+
+			bool nextIsDoubleWidth = (x+len+1 == columnsToUpdate) ? false : (newLine[x+len+1].character == 0);
+
+            if (  ch.foregroundColor != cf || 
+                  ch.backgroundColor != _clipboard || 
+                  ch.rendition != cr ||
+                  !dirtyMask[x+len] || 
+                  isLineChar(c) != lineDraw || 
+                  nextIsDoubleWidth != doubleWidth )
+            break;
+
+          disstrU[p++] = c; //fontMap(c);
+        }
+
+        QString unistr(disstrU, p);
+
+        bool saveFixedFont = _fixedFont;
+        if (lineDraw)
+           _fixedFont = false;
+        if (doubleWidth)
+           _fixedFont = false;
+
+		updateLine = true;
+
+		_fixedFont = saveFixedFont;
+        x += len - 1;
+      }
+      
+    }
+
+	//both the top and bottom halves of double height _lines must always be redrawn
+	//although both top and bottom halves contain the same characters, only 
+    //the top one is actually 
+	//drawn.
+    if (_lineProperties.count() > y)
+        updateLine |= (_lineProperties[y] & LINE_DOUBLEHEIGHT);
+
+    // if the characters on the line are different in the old and the new _image
+    // then this line must be repainted.    
+    if (updateLine)
+    {
+        dirtyLineCount++;
+
+        // add the area occupied by this line to the region which needs to be
+        // repainted
+        QRect dirtyRect = QRect( _leftMargin+tLx , 
+                                 _topMargin+tLy+_fontHeight*y , 
+                                 _fontWidth * columnsToUpdate , 
+                                 _fontHeight ); 	
+
+        dirtyRegion |= dirtyRect;
+    }
+
+    // replace the line of characters in the old _image with the 
+    // current line of the new _image 
+    memcpy((void*)currentLine,(const void*)newLine,columnsToUpdate*sizeof(Character));
+  }
+
+  // if the new _image is smaller than the previous _image, then ensure that the area
+  // outside the new _image is cleared 
+  if ( linesToUpdate < _usedLines )
+  {
+    dirtyRegion |= QRect(   _leftMargin+tLx , 
+                            _topMargin+tLy+_fontHeight*linesToUpdate , 
+                            _fontWidth * this->_columns , 
+                            _fontHeight * (_usedLines-linesToUpdate) );
+  }
+  _usedLines = linesToUpdate;
+  
+  if ( columnsToUpdate < _usedColumns )
+  {
+    dirtyRegion |= QRect(   _leftMargin+tLx+columnsToUpdate*_fontWidth , 
+                            _topMargin+tLy , 
+                            _fontWidth * (_usedColumns-columnsToUpdate) , 
+                            _fontHeight * this->_lines );
+  }
+  _usedColumns = columnsToUpdate;
+
+  dirtyRegion |= _inputMethodData.previousPreeditRect;
+
+  // update the parts of the display which have changed
+  update(dirtyRegion);
+
+  if ( _hasBlinker && !_blinkTimer->isActive()) _blinkTimer->start( BLINK_DELAY ); 
+  if (!_hasBlinker && _blinkTimer->isActive()) { _blinkTimer->stop(); _blinking = false; }
+  delete[] dirtyMask;
+  delete[] disstrU;
+
+}
+
+void TerminalDisplay::showResizeNotification()
+{
+  if (_terminalSizeHint && isVisible())
+  {
+     if (_terminalSizeStartup) {
+       		_terminalSizeStartup=false;
+       return;
+     }
+     if (!_resizeWidget)
+     {
+        _resizeWidget = new QLabel(("Size: XXX x XXX"), this);
+        _resizeWidget->setMinimumWidth(_resizeWidget->fontMetrics().width(("Size: XXX x XXX")));
+        _resizeWidget->setMinimumHeight(_resizeWidget->sizeHint().height());
+		_resizeWidget->setAlignment(Qt::AlignCenter);
+
+        _resizeWidget->setStyleSheet("background-color:palette(window);border-style:solid;border-width:1px;border-color:palette(dark)");
+
+		_resizeTimer = new QTimer(this);
+		_resizeTimer->setSingleShot(true);
+        connect(_resizeTimer, SIGNAL(timeout()), _resizeWidget, SLOT(hide()));
+
+     }
+     QString sizeStr;
+     sizeStr.sprintf("Size: %d x %d", _columns, _lines);
+     _resizeWidget->setText(sizeStr);
+     _resizeWidget->move((width()-_resizeWidget->width())/2,
+                         (height()-_resizeWidget->height())/2+20);
+     _resizeWidget->show();
+     _resizeTimer->start(1000);
+  }
+}
+
+void TerminalDisplay::setBlinkingCursor(bool blink)
+{
+  _hasBlinkingCursor=blink;
+  
+  if (blink && !_blinkCursorTimer->isActive()) 
+      _blinkCursorTimer->start(BLINK_DELAY);
+  
+  if (!blink && _blinkCursorTimer->isActive()) 
+  {
+    _blinkCursorTimer->stop();
+    if (_cursorBlinking)
+      blinkCursorEvent();
+    else
+      _cursorBlinking = false;
+  }
+}
+
+void TerminalDisplay::paintEvent( QPaintEvent* pe )
+{
+//qDebug("%s %d paintEvent", __FILE__, __LINE__);
+  QPainter paint(this);
+
+  foreach (QRect rect, (pe->region() & contentsRect()).rects())
+  {
+    drawBackground(paint,rect,palette().background().color(),	true /* use opacity setting */);
+    drawContents(paint, rect);    
+  }
+//    drawBackground(paint,contentsRect(),palette().background().color(),	true /* use opacity setting */);
+//    drawContents(paint, contentsRect());    
+  drawInputMethodPreeditString(paint,preeditRect());
+  paintFilters(paint);
+
+  paint.end();
+}
+
+QPoint TerminalDisplay::cursorPosition() const
+{
+	if (_screenWindow)
+		return _screenWindow->cursorPosition();
+	else
+		return QPoint(0,0);
+}
+
+QRect TerminalDisplay::preeditRect() const
+{
+    const int preeditLength = string_width(_inputMethodData.preeditString);
+
+    if ( preeditLength == 0 )
+        return QRect();
+
+    return QRect(_leftMargin + _fontWidth*cursorPosition().x(),
+                 _topMargin + _fontHeight*cursorPosition().y(),
+                 _fontWidth*preeditLength,
+                 _fontHeight);
+}   
+
+void TerminalDisplay::drawInputMethodPreeditString(QPainter& painter , const QRect& rect)
+{
+    if ( _inputMethodData.preeditString.isEmpty() ) {
+        return;
+    }
+    const QPoint cursorPos = cursorPosition(); 
+
+    bool invertColors = false;
+    const QColor background = _colorTable[DEFAULT_BACK_COLOR].color;
+    const QColor foreground = _colorTable[DEFAULT_FORE_COLOR].color;
+    const Character* style = &_image[loc(cursorPos.x(),cursorPos.y())];
+
+    drawBackground(painter,rect,background,true);
+    drawCursor(painter,rect,foreground,background,invertColors);
+    drawCharacters(painter,rect,_inputMethodData.preeditString,style,invertColors);
+
+    _inputMethodData.previousPreeditRect = rect; 
+}
+
+FilterChain* TerminalDisplay::filterChain() const
+{
+    return _filterChain;
+}
+
+void TerminalDisplay::paintFilters(QPainter& painter)
+{
+//qDebug("%s %d paintFilters", __FILE__, __LINE__);
+
+    // get color of character under mouse and use it to draw
+    // lines for filters
+    QPoint cursorPos = mapFromGlobal(QCursor::pos());
+    int cursorLine;
+    int cursorColumn;
+    getCharacterPosition( cursorPos , cursorLine , cursorColumn );
+    Character cursorCharacter = _image[loc(cursorColumn,cursorLine)];
+
+    painter.setPen( QPen(cursorCharacter.foregroundColor.color(colorTable())) );
+
+    // iterate over hotspots identified by the display's currently active filters 
+    // and draw appropriate visuals to indicate the presence of the hotspot
+
+    QList<Filter::HotSpot*> spots = _filterChain->hotSpots();
+    QListIterator<Filter::HotSpot*> iter(spots);
+    while (iter.hasNext())
+    {
+        Filter::HotSpot* spot = iter.next();
+
+        for ( int line = spot->startLine() ; line <= spot->endLine() ; line++ )
+        {
+            int startColumn = 0;
+            int endColumn = _columns-1; // TODO use number of _columns which are actually 
+                                        // occupied on this line rather than the width of the 
+                                        // display in _columns
+
+            // ignore whitespace at the end of the lines
+            while ( QChar(_image[loc(endColumn,line)].character).isSpace() && endColumn > 0 )
+                endColumn--;
+              
+            // increment here because the column which we want to set 'endColumn' to
+            // is the first whitespace character at the end of the line
+            endColumn++;
+
+            if ( line == spot->startLine() )
+                startColumn = spot->startColumn();
+            if ( line == spot->endLine() )
+                endColumn = spot->endColumn();
+
+            // subtract one pixel from
+            // the right and bottom so that
+            // we do not overdraw adjacent
+            // hotspots
+            //
+            // subtracting one pixel from all sides also prevents an edge case where
+            // moving the mouse outside a link could still leave it underlined 
+            // because the check below for the position of the cursor
+            // finds it on the border of the target area
+            QRect r;
+            r.setCoords( startColumn*_fontWidth + 1, line*_fontHeight + 1,
+                             endColumn*_fontWidth - 1, (line+1)*_fontHeight - 1 ); 
+                                                                           
+            // Underline link hotspots 
+            if ( spot->type() == Filter::HotSpot::Link )
+            {
+                QFontMetrics metrics(font());
+        
+                // find the baseline (which is the invisible line that the characters in the font sit on,
+                // with some having tails dangling below)
+                int baseline = r.bottom() - metrics.descent();
+                // find the position of the underline below that
+                int underlinePos = baseline + metrics.underlinePos();
+
+                if ( r.contains( mapFromGlobal(QCursor::pos()) ) )
+                    painter.drawLine( r.left() , underlinePos , 
+                                      r.right() , underlinePos );
+            }
+            // Marker hotspots simply have a transparent rectanglular shape
+            // drawn on top of them
+            else if ( spot->type() == Filter::HotSpot::Marker )
+            {
+            //TODO - Do not use a hardcoded colour for this
+                painter.fillRect(r,QBrush(QColor(255,0,0,120)));
+            }
+        }
+    }
+}
+void TerminalDisplay::drawContents(QPainter &paint, const QRect &rect)
+{
+//qDebug("%s %d drawContents and rect x=%d y=%d w=%d h=%d", __FILE__, __LINE__, rect.x(), rect.y(),rect.width(),rect.height());
+
+  QPoint tL  = contentsRect().topLeft();
+//  int    tLx = tL.x();
+  int    tLy = tL.y();
+
+  int tLx = (_contentWidth - _usedColumns * _fontWidth)/2;
+//  int tLy = (_contentHeight - _usedLines * _fontHeight)/2; 
+//qDebug("%d %d %d %d", tLx, tLy, _contentWidth, _usedColumns * _fontWidth);  
+
+  int lux = qMin(_usedColumns-1, qMax(0,(rect.left()   - tLx - _leftMargin ) / _fontWidth));
+  int luy = qMin(_usedLines-1,  qMax(0, (rect.top()    - tLy - _topMargin  ) / _fontHeight));
+  int rlx = qMin(_usedColumns-1, qMax(0, (rect.right()  - tLx - _leftMargin ) / _fontWidth));
+  int rly = qMin(_usedLines-1,  qMax(0, (rect.bottom() - tLy - _topMargin  ) / _fontHeight));
+
+  const int bufferSize = _usedColumns;
+  QChar *disstrU = new QChar[bufferSize];
+  for (int y = luy; y <= rly; y++)
+  {
+    quint16 c = _image[loc(lux,y)].character;
+    int x = lux;
+    if(!c && x)
+      x--; // Search for start of multi-column character
+    for (; x <= rlx; x++)
+    {
+      int len = 1;
+      int p = 0;
+
+      // is this a single character or a sequence of characters ?
+      if ( _image[loc(x,y)].rendition & RE_EXTENDED_CHAR )
+      {
+        // sequence of characters
+        ushort extendedCharLength = 0;
+        ushort* chars = ExtendedCharTable::instance
+                            .lookupExtendedChar(_image[loc(x,y)].charSequence,extendedCharLength);
+        for ( int index = 0 ; index < extendedCharLength ; index++ ) 
+        {
+            Q_ASSERT( p < bufferSize );
+            disstrU[p++] = chars[index];
+        }
+      }
+      else
+      {
+        // single character
+        c = _image[loc(x,y)].character;
+        if (c)
+        {
+             Q_ASSERT( p < bufferSize );
+             disstrU[p++] = c; //fontMap(c);
+        }
+      }
+
+      bool lineDraw = isLineChar(c);
+      bool doubleWidth = (_image[ qMin(loc(x,y)+1,_imageSize) ].character == 0);
+      CharacterColor currentForeground = _image[loc(x,y)].foregroundColor;
+      CharacterColor currentBackground = _image[loc(x,y)].backgroundColor;
+      quint8 currentRendition = _image[loc(x,y)].rendition;
+	  
+      while (x+len <= rlx &&
+             _image[loc(x+len,y)].foregroundColor == currentForeground &&
+             _image[loc(x+len,y)].backgroundColor == currentBackground &&
+             _image[loc(x+len,y)].rendition == currentRendition &&
+             (_image[ qMin(loc(x+len,y)+1,_imageSize) ].character == 0) == doubleWidth &&
+             isLineChar( c = _image[loc(x+len,y)].character) == lineDraw) // Assignment!
+      {
+        if (c)
+          disstrU[p++] = c; //fontMap(c);
+        if (doubleWidth) // assert((_image[loc(x+len,y)+1].character == 0)), see above if condition
+          len++; // Skip trailing part of multi-column character
+        len++;
+      }
+      if ((x+len < _usedColumns) && (!_image[loc(x+len,y)].character))
+        len++; // Adjust for trailing part of multi-column character
+
+   	     bool save__fixedFont = _fixedFont;
+         if (lineDraw)
+            _fixedFont = false;
+         if (doubleWidth)
+            _fixedFont = false;
+         QString unistr(disstrU,p);
+		 
+		 if (y < _lineProperties.size())
+		 {
+			if (_lineProperties[y] & LINE_DOUBLEWIDTH) {
+				paint.scale(2,1);
+			}
+			
+			if (_lineProperties[y] & LINE_DOUBLEHEIGHT) {
+  		 		paint.scale(1,2);
+			}
+		 }
+
+		 //calculate the area in which the text will be drawn
+		 QRect textArea = QRect( _leftMargin+tLx+_fontWidth*x , 
+					_topMargin+tLy+_fontHeight*y , 
+					_fontWidth*len, 
+					_fontHeight);
+		
+		 //move the calculated area to take account of scaling applied to the painter.
+		 //the position of the area from the origin (0,0) is scaled 
+         //by the opposite of whatever
+		 //transformation has been applied to the painter.  this ensures that 
+		 //painting does actually start from textArea.topLeft() 
+         //(instead of textArea.topLeft() * painter-scale)	
+		 QMatrix inverted = paint.matrix().inverted();
+//		 textArea.moveTopLeft( inverted.map(textArea.topLeft()) );
+		 textArea.moveCenter( inverted.map(textArea.center()) );
+
+		 
+		 //paint text fragment
+         drawTextFragment(	paint,
+                		    textArea,
+                		    unistr, 
+					    	&_image[loc(x,y)] ); //, 
+						    //0, 
+						    //!_isPrinting );
+         
+		 _fixedFont = save__fixedFont;
+     
+		 //reset back to single-width, single-height _lines 
+		 paint.resetMatrix();
+
+		 if (y < _lineProperties.size()-1)
+		 {
+			//double-height _lines are represented by two adjacent _lines 
+            //containing the same characters
+			//both _lines will have the LINE_DOUBLEHEIGHT attribute.  
+            //If the current line has the LINE_DOUBLEHEIGHT attribute, 
+            //we can therefore skip the next line
+			if (_lineProperties[y] & LINE_DOUBLEHEIGHT)
+				y++;
+		 }
+		 
+	    x += len - 1;
+    }
+  }
+  delete [] disstrU;
+}
+
+void TerminalDisplay::blinkEvent()
+{
+  _blinking = !_blinking;
+
+  //TODO:  Optimise to only repaint the areas of the widget 
+  // where there is blinking text
+  // rather than repainting the whole widget.
+  update();
+}
+
+QRect TerminalDisplay::imageToWidget(const QRect& imageArea) const
+{
+//qDebug("%s %d imageToWidget", __FILE__, __LINE__);
+    QRect result;
+    result.setLeft( _leftMargin + _fontWidth * imageArea.left() );
+    result.setTop( _topMargin + _fontHeight * imageArea.top() );
+    result.setWidth( _fontWidth * imageArea.width() );
+    result.setHeight( _fontHeight * imageArea.height() );
+
+    return result;
+}
+
+void TerminalDisplay::blinkCursorEvent()
+{
+  _cursorBlinking = !_cursorBlinking;
+
+  QRect cursorRect = imageToWidget( QRect(cursorPosition(),QSize(1,1)) ); 
+
+  update(cursorRect);
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                                  Resizing                                 */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+void TerminalDisplay::resizeEvent(QResizeEvent*)
+{
+  updateImageSize();
+}
+
+void TerminalDisplay::propagateSize()
+{
+  if (_isFixedSize)
+  {
+     setSize(_columns, _lines);
+     QWidget::setFixedSize(sizeHint());
+     parentWidget()->adjustSize();
+     parentWidget()->setFixedSize(parentWidget()->sizeHint());
+     return;
+  }
+  if (_image)
+     updateImageSize();
+}
+
+void TerminalDisplay::updateImageSize()
+{
+//qDebug("%s %d updateImageSize", __FILE__, __LINE__);
+  Character* oldimg = _image;
+  int oldlin = _lines;
+  int oldcol = _columns;
+
+  makeImage();
+
+  
+  // copy the old image to reduce flicker
+  int lines = qMin(oldlin,_lines);
+  int columns = qMin(oldcol,_columns);
+
+  if (oldimg)
+  {
+    for (int line = 0; line < lines; line++) 
+    {
+      memcpy((void*)&_image[_columns*line],
+             (void*)&oldimg[oldcol*line],columns*sizeof(Character));
+    }
+    delete[] oldimg;
+  }
+
+  if (_screenWindow)
+  	_screenWindow->setWindowLines(_lines);
+
+  _resizing = (oldlin!=_lines) || (oldcol!=_columns);
+
+  if ( _resizing )
+  {
+  	showResizeNotification();
+    emit changedContentSizeSignal(_contentHeight, _contentWidth); // expose resizeEvent
+  }
+  
+  _resizing = false;
+}
+
+//showEvent and hideEvent are reimplemented here so that it appears to other classes that the 
+//display has been resized when the display is hidden or shown.
+//
+//this allows  
+//TODO: Perhaps it would be better to have separate signals for show and hide instead of using
+//the same signal as the one for a content size change 
+void TerminalDisplay::showEvent(QShowEvent*)
+{
+    emit changedContentSizeSignal(_contentHeight,_contentWidth);
+}
+void TerminalDisplay::hideEvent(QHideEvent*)
+{
+    emit changedContentSizeSignal(_contentHeight,_contentWidth);
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                                Scrollbar                                  */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+void TerminalDisplay::scrollBarPositionChanged(int)
+{
+  if ( !_screenWindow ) 
+      return;
+
+  _screenWindow->scrollTo( _scrollBar->value() );
+
+  // if the thumb has been moved to the bottom of the _scrollBar then set
+  // the display to automatically track new output, 
+  // that is, scroll down automatically
+  // to how new _lines as they are added
+  const bool atEndOfOutput = (_scrollBar->value() == _scrollBar->maximum());
+  _screenWindow->setTrackOutput( atEndOfOutput );
+
+  updateImage();
+}
+
+void TerminalDisplay::setScroll(int cursor, int slines)
+{
+//qDebug("%s %d setScroll", __FILE__, __LINE__);
+  // update _scrollBar if the range or value has changed,
+  // otherwise return
+  //
+  // setting the range or value of a _scrollBar will always trigger
+  // a repaint, so it should be avoided if it is not necessary
+  if ( _scrollBar->minimum() == 0                 &&
+       _scrollBar->maximum() == (slines - _lines) &&
+       _scrollBar->value()   == cursor )
+  {
+        return;
+  }
+
+  disconnect(_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarPositionChanged(int)));
+  _scrollBar->setRange(0,slines - _lines);
+  _scrollBar->setSingleStep(1);
+  _scrollBar->setPageStep(_lines);
+  _scrollBar->setValue(cursor);
+  connect(_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarPositionChanged(int)));
+}
+
+void TerminalDisplay::setScrollBarPosition(ScrollBarPosition position)
+{
+  if (_scrollbarLocation == position) {
+//      return; 
+  }
+ 
+  if ( position == NoScrollBar )
+     _scrollBar->hide();
+  else 
+     _scrollBar->show(); 
+
+  _topMargin = _leftMargin = 1;
+  _scrollbarLocation = position;
+  
+  propagateSize();
+  update();
+}
+
+void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
+{
+  if ( _possibleTripleClick && (ev->button()==Qt::LeftButton) ) {
+    mouseTripleClickEvent(ev);
+    return;
+  }
+
+  if ( !contentsRect().contains(ev->pos()) ) return;
+  
+  if ( !_screenWindow ) return;
+
+  int charLine;
+  int charColumn;
+  getCharacterPosition(ev->pos(),charLine,charColumn);
+  QPoint pos = QPoint(charColumn,charLine);
+
+  if ( ev->button() == Qt::LeftButton)
+  {
+    _lineSelectionMode = false;
+    _wordSelectionMode = false;
+
+    emit isBusySelecting(true); // Keep it steady...
+    // Drag only when the Control key is hold
+    bool selected = false;
+    
+    // The receiver of the testIsSelected() signal will adjust
+    // 'selected' accordingly.
+    //emit testIsSelected(pos.x(), pos.y(), selected);
+    
+    selected =  _screenWindow->isSelected(pos.x(),pos.y());
+
+    if ((!_ctrlDrag || ev->modifiers() & Qt::ControlModifier) && selected ) {
+      // The user clicked inside selected text
+      dragInfo.state = diPending;
+      dragInfo.start = ev->pos();
+    }
+    else {
+      // No reason to ever start a drag event
+      dragInfo.state = diNone;
+
+      _preserveLineBreaks = !( ( ev->modifiers() & Qt::ControlModifier ) && !(ev->modifiers() & Qt::AltModifier) );
+      _columnSelectionMode = (ev->modifiers() & Qt::AltModifier) && (ev->modifiers() & Qt::ControlModifier);
+
+      if (_mouseMarks || (ev->modifiers() & Qt::ShiftModifier))
+      {
+         _screenWindow->clearSelection();
+
+        //emit clearSelectionSignal();
+        pos.ry() += _scrollBar->value();
+        _iPntSel = _pntSel = pos;
+        _actSel = 1; // left mouse button pressed but nothing selected yet.
+        
+      }
+      else
+      {
+        emit mouseSignal( 0, charColumn + 1, charLine + 1 +_scrollBar->value() -_scrollBar->maximum() , 0);
+      }
+    }
+  }
+  else if ( ev->button() == Qt::MidButton )
+  {
+    if ( _mouseMarks || (!_mouseMarks && (ev->modifiers() & Qt::ShiftModifier)) )
+      emitSelection(true,ev->modifiers() & Qt::ControlModifier);
+    else
+      emit mouseSignal( 1, charColumn +1, charLine +1 +_scrollBar->value() -_scrollBar->maximum() , 0);
+  }
+  else if ( ev->button() == Qt::RightButton )
+  {
+    if (_mouseMarks || (ev->modifiers() & Qt::ShiftModifier)) 
+    {
+        emit configureRequest( this, 
+                               ev->modifiers() & (Qt::ShiftModifier|Qt::ControlModifier), 
+                               ev->pos()
+                             );
+    }
+    else
+      emit mouseSignal( 2, charColumn +1, charLine +1 +_scrollBar->value() -_scrollBar->maximum() , 0);
+  }
+}
+
+QList<QAction*> TerminalDisplay::filterActions(const QPoint& position)
+{
+  int charLine, charColumn;
+  getCharacterPosition(position,charLine,charColumn);
+
+  Filter::HotSpot* spot = _filterChain->hotSpotAt(charLine,charColumn);
+
+  return spot ? spot->actions() : QList<QAction*>();
+}
+
+void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev)
+{
+  int charLine = 0;
+  int charColumn = 0;
+
+  getCharacterPosition(ev->pos(),charLine,charColumn); 
+
+  // handle filters
+  // change link hot-spot appearance on mouse-over
+  Filter::HotSpot* spot = _filterChain->hotSpotAt(charLine,charColumn);
+  if ( spot && spot->type() == Filter::HotSpot::Link)
+  {
+    QRect previousHotspotArea = _mouseOverHotspotArea;
+    _mouseOverHotspotArea.setCoords( qMin(spot->startColumn() , spot->endColumn()) * _fontWidth,
+                                     spot->startLine() * _fontHeight,
+                                     qMax(spot->startColumn() , spot->endColumn()) * _fontHeight,
+                                     (spot->endLine()+1) * _fontHeight );
+
+    // display tooltips when mousing over links
+    // TODO: Extend this to work with filter types other than links
+    const QString& tooltip = spot->tooltip();
+    if ( !tooltip.isEmpty() )
+    {
+        QToolTip::showText( mapToGlobal(ev->pos()) , tooltip , this , _mouseOverHotspotArea );
+    }
+
+    update( _mouseOverHotspotArea | previousHotspotArea );
+  }
+  else if ( _mouseOverHotspotArea.isValid() )
+  {
+        update( _mouseOverHotspotArea );
+        // set hotspot area to an invalid rectangle
+        _mouseOverHotspotArea = QRect();
+  }
+  
+  // for auto-hiding the cursor, we need mouseTracking
+  if (ev->buttons() == Qt::NoButton ) return;
+
+  // if the terminal is interested in mouse movements 
+  // then emit a mouse movement signal, unless the shift
+  // key is being held down, which overrides this.
+  if (!_mouseMarks && !(ev->modifiers() & Qt::ShiftModifier))
+  {
+	int button = 3;
+	if (ev->buttons() & Qt::LeftButton)
+		button = 0;
+	if (ev->buttons() & Qt::MidButton)
+		button = 1;
+	if (ev->buttons() & Qt::RightButton)
+		button = 2;
+
+        
+        emit mouseSignal( button, 
+                        charColumn + 1,
+                        charLine + 1 +_scrollBar->value() -_scrollBar->maximum(),
+			 1 );
+      
+	return;
+  }
+      
+  if (dragInfo.state == diPending) 
+  {
+    // we had a mouse down, but haven't confirmed a drag yet
+    // if the mouse has moved sufficiently, we will confirm
+
+   int distance = 10; //KGlobalSettings::dndEventDelay();
+   if ( ev->x() > dragInfo.start.x() + distance || ev->x() < dragInfo.start.x() - distance ||
+        ev->y() > dragInfo.start.y() + distance || ev->y() < dragInfo.start.y() - distance) 
+   {
+      // we've left the drag square, we can start a real drag operation now
+      emit isBusySelecting(false); // Ok.. we can breath again.
+      
+       _screenWindow->clearSelection();
+      doDrag();
+    }
+    return;
+  } 
+  else if (dragInfo.state == diDragging) 
+  {
+    // this isn't technically needed because mouseMoveEvent is suppressed during
+    // Qt drag operations, replaced by dragMoveEvent
+    return;
+  }
+
+  if (_actSel == 0) return;
+
+ // don't extend selection while pasting
+  if (ev->buttons() & Qt::MidButton) return;
+
+  extendSelection( ev->pos() );
+}
+
+#if 0
+void TerminalDisplay::setSelectionEnd()
+{
+  extendSelection( _configureRequestPoint );
+}
+#endif
+
+void TerminalDisplay::extendSelection( const QPoint& position )
+{
+  QPoint pos = position;
+
+  if ( !_screenWindow )
+      return;
+
+  //if ( !contentsRect().contains(ev->pos()) ) return;
+  QPoint tL  = contentsRect().topLeft();
+  int    tLx = tL.x();
+  int    tLy = tL.y();
+  int    scroll = _scrollBar->value();
+
+  // we're in the process of moving the mouse with the left button pressed
+  // the mouse cursor will kept caught within the bounds of the text in
+  // this widget.
+
+  // Adjust position within text area bounds. See FIXME above.
+  QPoint oldpos = pos;
+  if ( pos.x() < tLx+_leftMargin )                  
+      pos.setX( tLx+_leftMargin );
+  if ( pos.x() > tLx+_leftMargin+_usedColumns*_fontWidth-1 ) 
+      pos.setX( tLx+_leftMargin+_usedColumns*_fontWidth );
+  if ( pos.y() < tLy+_topMargin )                   
+      pos.setY( tLy+_topMargin );
+  if ( pos.y() > tLy+_topMargin+_usedLines*_fontHeight-1 )    
+      pos.setY( tLy+_topMargin+_usedLines*_fontHeight-1 );
+
+  if ( pos.y() == tLy+_topMargin+_usedLines*_fontHeight-1 )
+  {
+    _scrollBar->setValue(_scrollBar->value()+yMouseScroll); // scrollforward
+  }
+  if ( pos.y() == tLy+_topMargin )
+  {
+    _scrollBar->setValue(_scrollBar->value()-yMouseScroll); // scrollback
+  }
+
+  int charColumn = 0;
+  int charLine = 0;
+  getCharacterPosition(pos,charLine,charColumn);
+
+  QPoint here = QPoint(charColumn,charLine); //QPoint((pos.x()-tLx-_leftMargin+(_fontWidth/2))/_fontWidth,(pos.y()-tLy-_topMargin)/_fontHeight);
+  QPoint ohere;
+  QPoint _iPntSelCorr = _iPntSel;
+  _iPntSelCorr.ry() -= _scrollBar->value();
+  QPoint _pntSelCorr = _pntSel;
+  _pntSelCorr.ry() -= _scrollBar->value();
+  bool swapping = false;
+
+  if ( _wordSelectionMode )
+  {
+    // Extend to word boundaries
+    int i;
+    int selClass;
+
+    bool left_not_right = ( here.y() < _iPntSelCorr.y() ||
+	   here.y() == _iPntSelCorr.y() && here.x() < _iPntSelCorr.x() );
+    bool old_left_not_right = ( _pntSelCorr.y() < _iPntSelCorr.y() ||
+	   _pntSelCorr.y() == _iPntSelCorr.y() && _pntSelCorr.x() < _iPntSelCorr.x() );
+    swapping = left_not_right != old_left_not_right;
+
+    // Find left (left_not_right ? from here : from start)
+    QPoint left = left_not_right ? here : _iPntSelCorr;
+    i = loc(left.x(),left.y());
+    if (i>=0 && i<=_imageSize) {
+      selClass = charClass(_image[i].character);
+      while ( ((left.x()>0) || (left.y()>0 && (_lineProperties[left.y()-1] & LINE_WRAPPED) )) 
+					  && charClass(_image[i-1].character) == selClass )
+      { i--; if (left.x()>0) left.rx()--; else {left.rx()=_usedColumns-1; left.ry()--;} }
+    }
+
+    // Find left (left_not_right ? from start : from here)
+    QPoint right = left_not_right ? _iPntSelCorr : here;
+    i = loc(right.x(),right.y());
+    if (i>=0 && i<=_imageSize) {
+      selClass = charClass(_image[i].character);
+      while( ((right.x()<_usedColumns-1) || (right.y()<_usedLines-1 && (_lineProperties[right.y()] & LINE_WRAPPED) )) 
+					  && charClass(_image[i+1].character) == selClass )
+      { i++; if (right.x()<_usedColumns-1) right.rx()++; else {right.rx()=0; right.ry()++; } }
+    }
+
+    // Pick which is start (ohere) and which is extension (here)
+    if ( left_not_right )
+    {
+      here = left; ohere = right;
+    }
+    else
+    {
+      here = right; ohere = left;
+    }
+    ohere.rx()++;
+  }
+
+  if ( _lineSelectionMode )
+  {
+    // Extend to complete line
+    bool above_not_below = ( here.y() < _iPntSelCorr.y() );
+
+    QPoint above = above_not_below ? here : _iPntSelCorr;
+    QPoint below = above_not_below ? _iPntSelCorr : here;
+
+    while (above.y()>0 && (_lineProperties[above.y()-1] & LINE_WRAPPED) )
+      above.ry()--;
+    while (below.y()<_usedLines-1 && (_lineProperties[below.y()] & LINE_WRAPPED) )
+      below.ry()++;
+
+    above.setX(0);
+    below.setX(_usedColumns-1);
+
+    // Pick which is start (ohere) and which is extension (here)
+    if ( above_not_below )
+    {
+      here = above; ohere = below;
+    }
+    else
+    {
+      here = below; ohere = above;
+    }
+
+    QPoint newSelBegin = QPoint( ohere.x(), ohere.y() );
+    swapping = !(_tripleSelBegin==newSelBegin);
+    _tripleSelBegin = newSelBegin;
+
+    ohere.rx()++;
+  }
+
+  int offset = 0;
+  if ( !_wordSelectionMode && !_lineSelectionMode )
+  {
+    int i;
+    int selClass;
+
+    bool left_not_right = ( here.y() < _iPntSelCorr.y() ||
+	   here.y() == _iPntSelCorr.y() && here.x() < _iPntSelCorr.x() );
+    bool old_left_not_right = ( _pntSelCorr.y() < _iPntSelCorr.y() ||
+	   _pntSelCorr.y() == _iPntSelCorr.y() && _pntSelCorr.x() < _iPntSelCorr.x() );
+    swapping = left_not_right != old_left_not_right;
+
+    // Find left (left_not_right ? from here : from start)
+    QPoint left = left_not_right ? here : _iPntSelCorr;
+
+    // Find left (left_not_right ? from start : from here)
+    QPoint right = left_not_right ? _iPntSelCorr : here;
+    if ( right.x() > 0 && !_columnSelectionMode )
+    {
+      i = loc(right.x(),right.y());
+      if (i>=0 && i<=_imageSize) {
+        selClass = charClass(_image[i-1].character);
+        if (selClass == ' ')
+        {
+          while ( right.x() < _usedColumns-1 && charClass(_image[i+1].character) == selClass && (right.y()<_usedLines-1) && 
+						  !(_lineProperties[right.y()] & LINE_WRAPPED))
+          { i++; right.rx()++; }
+          if (right.x() < _usedColumns-1)
+            right = left_not_right ? _iPntSelCorr : here;
+          else
+            right.rx()++;  // will be balanced later because of offset=-1;
+        }
+      }
+    }
+
+    // Pick which is start (ohere) and which is extension (here)
+    if ( left_not_right )
+    {
+      here = left; ohere = right; offset = 0;
+    }
+    else
+    {
+      here = right; ohere = left; offset = -1;
+    }
+  }
+
+  if ((here == _pntSelCorr) && (scroll == _scrollBar->value())) return; // not moved
+
+  if (here == ohere) return; // It's not left, it's not right.
+
+  if ( _actSel < 2 || swapping )
+  {
+    if ( _columnSelectionMode && !_lineSelectionMode && !_wordSelectionMode )
+    {
+        _screenWindow->setSelectionStart( ohere.x() , ohere.y() , true );
+    }
+    else
+    {
+        _screenWindow->setSelectionStart( ohere.x()-1-offset , ohere.y() , false );
+    }
+
+  }
+
+  _actSel = 2; // within selection
+  _pntSel = here;
+  _pntSel.ry() += _scrollBar->value();
+
+  if ( _columnSelectionMode && !_lineSelectionMode && !_wordSelectionMode )
+  {
+     _screenWindow->setSelectionEnd( here.x() , here.y() );
+  }
+  else
+  {
+     _screenWindow->setSelectionEnd( here.x()+offset , here.y() );
+  }
+
+}
+
+void TerminalDisplay::mouseReleaseEvent(QMouseEvent* ev)
+{
+    if ( !_screenWindow )
+        return;
+
+    int charLine;
+    int charColumn;
+    getCharacterPosition(ev->pos(),charLine,charColumn);
+
+  if ( ev->button() == Qt::LeftButton)
+  {
+    emit isBusySelecting(false); 
+    if(dragInfo.state == diPending)
+    {
+      // We had a drag event pending but never confirmed.  Kill selection
+       _screenWindow->clearSelection();
+      //emit clearSelectionSignal();
+    }
+    else
+    {
+      if ( _actSel > 1 )
+      {
+          setSelection(  _screenWindow->selectedText(_preserveLineBreaks)  );
+      }
+
+      _actSel = 0;
+
+      //FIXME: emits a release event even if the mouse is
+      //       outside the range. The procedure used in `mouseMoveEvent'
+      //       applies here, too.
+
+      if (!_mouseMarks && !(ev->modifiers() & Qt::ShiftModifier))
+        emit mouseSignal( 3, // release
+                        charColumn + 1,
+                        charLine + 1 +_scrollBar->value() -_scrollBar->maximum() , 0);
+    }
+    dragInfo.state = diNone;
+  }
+  
+  
+  if ( !_mouseMarks && 
+       ((ev->button() == Qt::RightButton && !(ev->modifiers() & Qt::ShiftModifier))
+                        || ev->button() == Qt::MidButton) ) 
+  {
+    emit mouseSignal( 3, 
+                      charColumn + 1, 
+                      charLine + 1 +_scrollBar->value() -_scrollBar->maximum() , 
+                      0);
+  }
+}
+
+void TerminalDisplay::getCharacterPosition(const QPoint& widgetPoint,int& line,int& column) const
+{
+
+    column = (widgetPoint.x() + _fontWidth/2 -contentsRect().left()-_leftMargin) / _fontWidth;
+    line = (widgetPoint.y()-contentsRect().top()-_topMargin) / _fontHeight;
+
+    if ( line < 0 )
+        line = 0;
+    if ( column < 0 )
+        column = 0;
+
+    if ( line >= _usedLines )
+        line = _usedLines-1;
+
+    // the column value returned can be equal to _usedColumns, which
+    // is the position just after the last character displayed in a line.
+    //
+    // this is required so that the user can select characters in the right-most
+    // column (or left-most for right-to-left input)
+    if ( column > _usedColumns )
+        column = _usedColumns;
+}
+
+void TerminalDisplay::updateLineProperties()
+{
+    if ( !_screenWindow ) 
+        return;
+
+    _lineProperties = _screenWindow->getLineProperties();    
+}
+
+void TerminalDisplay::mouseDoubleClickEvent(QMouseEvent* ev)
+{
+  if ( ev->button() != Qt::LeftButton) return;
+  if ( !_screenWindow ) return;
+
+  int charLine = 0;
+  int charColumn = 0;
+
+  getCharacterPosition(ev->pos(),charLine,charColumn);
+
+  QPoint pos(charColumn,charLine);
+
+  // pass on double click as two clicks.
+  if (!_mouseMarks && !(ev->modifiers() & Qt::ShiftModifier))
+  {
+    // Send just _ONE_ click event, since the first click of the double click
+    // was already sent by the click handler
+    emit mouseSignal( 0, 
+                      pos.x()+1, 
+                      pos.y()+1 +_scrollBar->value() -_scrollBar->maximum(),
+                      0 ); // left button
+    return;
+  }
+
+  _screenWindow->clearSelection();
+  QPoint bgnSel = pos;
+  QPoint endSel = pos;
+  int i = loc(bgnSel.x(),bgnSel.y());
+  _iPntSel = bgnSel;
+  _iPntSel.ry() += _scrollBar->value();
+
+  _wordSelectionMode = true;
+
+  // find word boundaries...
+  int selClass = charClass(_image[i].character);
+  {
+     // find the start of the word
+     int x = bgnSel.x();
+     while ( ((x>0) || (bgnSel.y()>0 && (_lineProperties[bgnSel.y()-1] & LINE_WRAPPED) )) 
+					 && charClass(_image[i-1].character) == selClass )
+     {  
+       i--; 
+       if (x>0) 
+           x--; 
+       else 
+       {
+           x=_usedColumns-1; 
+           bgnSel.ry()--;
+       } 
+     }
+
+     bgnSel.setX(x);
+     _screenWindow->setSelectionStart( bgnSel.x() , bgnSel.y() , false );
+
+     // find the end of the word
+     i = loc( endSel.x(), endSel.y() );
+     x = endSel.x();
+     while( ((x<_usedColumns-1) || (endSel.y()<_usedLines-1 && (_lineProperties[endSel.y()] & LINE_WRAPPED) )) 
+					 && charClass(_image[i+1].character) == selClass )
+     { 
+         i++; 
+         if (x<_usedColumns-1) 
+             x++; 
+         else 
+         {  
+             x=0; 
+             endSel.ry()++; 
+         } 
+     }
+
+     endSel.setX(x);
+
+     // In word selection mode don't select @ (64) if at end of word.
+     if ( ( QChar( _image[i].character ) == '@' ) && ( ( endSel.x() - bgnSel.x() ) > 0 ) )
+       endSel.setX( x - 1 );
+
+
+     _actSel = 2; // within selection
+     
+     _screenWindow->setSelectionEnd( endSel.x() , endSel.y() );
+    
+     setSelection( _screenWindow->selectedText(_preserveLineBreaks) ); 
+   }
+
+  _possibleTripleClick=true;
+
+  QTimer::singleShot(QApplication::doubleClickInterval(),this,
+                     SLOT(tripleClickTimeout()));
+}
+
+void TerminalDisplay::wheelEvent( QWheelEvent* ev )
+{
+  if (ev->orientation() != Qt::Vertical)
+    return;
+
+  if ( _mouseMarks )
+    _scrollBar->event(ev);
+  else
+  {
+    int charLine;
+    int charColumn;
+    getCharacterPosition( ev->pos() , charLine , charColumn );
+    
+    emit mouseSignal( ev->delta() > 0 ? 4 : 5, 
+                      charColumn + 1, 
+                      charLine + 1 +_scrollBar->value() -_scrollBar->maximum() , 
+                      0);
+  }
+}
+
+void TerminalDisplay::tripleClickTimeout()
+{
+  _possibleTripleClick=false;
+}
+
+void TerminalDisplay::mouseTripleClickEvent(QMouseEvent* ev)
+{
+  if ( !_screenWindow ) return;
+
+  int charLine;
+  int charColumn;
+  getCharacterPosition(ev->pos(),charLine,charColumn);
+  _iPntSel = QPoint(charColumn,charLine);
+
+  _screenWindow->clearSelection();
+
+  _lineSelectionMode = true;
+  _wordSelectionMode = false;
+
+  _actSel = 2; // within selection
+  emit isBusySelecting(true); // Keep it steady...
+
+  while (_iPntSel.y()>0 && (_lineProperties[_iPntSel.y()-1] & LINE_WRAPPED) )
+    _iPntSel.ry()--;
+  
+  if (_tripleClickMode == SelectForwardsFromCursor) {
+    // find word boundary start
+    int i = loc(_iPntSel.x(),_iPntSel.y());
+    int selClass = charClass(_image[i].character);
+    int x = _iPntSel.x();
+    
+    while ( ((x>0) || 
+             (_iPntSel.y()>0 && (_lineProperties[_iPntSel.y()-1] & LINE_WRAPPED) )
+            ) 
+            && charClass(_image[i-1].character) == selClass )
+    {
+        i--; 
+        if (x>0) 
+            x--; 
+        else 
+        {
+            x=_columns-1; 
+            _iPntSel.ry()--;
+        } 
+    }
+
+    _screenWindow->setSelectionStart( x , _iPntSel.y() , false );
+    _tripleSelBegin = QPoint( x, _iPntSel.y() );
+  }
+  else if (_tripleClickMode == SelectWholeLine) {
+    _screenWindow->setSelectionStart( 0 , _iPntSel.y() , false );
+    _tripleSelBegin = QPoint( 0, _iPntSel.y() );
+  }
+
+  while (_iPntSel.y()<_lines-1 && (_lineProperties[_iPntSel.y()] & LINE_WRAPPED) )
+    _iPntSel.ry()++;
+  
+  _screenWindow->setSelectionEnd( _columns - 1 , _iPntSel.y() );
+
+  setSelection(_screenWindow->selectedText(_preserveLineBreaks));
+
+  _iPntSel.ry() += _scrollBar->value();
+}
+
+
+bool TerminalDisplay::focusNextPrevChild( bool next )
+{
+  if (next)
+    return false; // This disables changing the active part in konqueror
+                  // when pressing Tab
+  return QWidget::focusNextPrevChild( next );
+}
+
+
+int TerminalDisplay::charClass(quint16 ch) const
+{
+    QChar qch=QChar(ch);
+    if ( qch.isSpace() ) return ' ';
+
+    if ( qch.isLetterOrNumber() || _wordCharacters.contains(qch, Qt::CaseInsensitive ) )
+    return 'a';
+
+    // Everything else is weird
+    return 1;
+}
+
+void TerminalDisplay::setWordCharacters(const QString& wc)
+{
+	_wordCharacters = wc;
+}
+
+void TerminalDisplay::setUsesMouse(bool on)
+{
+  _mouseMarks = on;
+  setCursor( _mouseMarks ? Qt::IBeamCursor : Qt::ArrowCursor );
+}
+bool TerminalDisplay::usesMouse() const
+{
+    return _mouseMarks;
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                               Clipboard                                   */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+#undef KeyPress
+
+void TerminalDisplay::emitSelection(bool useXselection,bool appendReturn)
+{
+  if ( !_screenWindow ) 
+      return;
+
+  // Paste Clipboard by simulating keypress events
+  QString text = QApplication::clipboard()->text(useXselection ? QClipboard::Selection :
+                                                                 QClipboard::Clipboard);
+  if(appendReturn)
+    text.append("\r");
+  if ( ! text.isEmpty() )
+  {
+    text.replace("\n", "\r");
+    QKeyEvent e(QEvent::KeyPress, 0, Qt::NoModifier, text);
+    emit keyPressedSignal(&e); // expose as a big fat keypress event
+    
+    _screenWindow->clearSelection();
+  }
+}
+
+void TerminalDisplay::setSelection(const QString& t)
+{
+  QApplication::clipboard()->setText(t, QClipboard::Selection);
+}
+
+void TerminalDisplay::copyClipboard()
+{
+  if ( !_screenWindow )
+      return;
+
+  QString text = _screenWindow->selectedText(_preserveLineBreaks);
+  QApplication::clipboard()->setText(text);
+}
+
+void TerminalDisplay::pasteClipboard()
+{
+  emitSelection(false,false);
+}
+
+void TerminalDisplay::pasteSelection()
+{
+  emitSelection(true,false);
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                                Keyboard                                   */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+void TerminalDisplay::setFlowControlWarningEnabled( bool enable )
+{
+	_flowControlWarningEnabled = enable;
+	
+	// if the dialog is currently visible and the flow control warning has 
+	// been disabled then hide the dialog
+	if (!enable)
+		outputSuspended(false);
+}
+
+void TerminalDisplay::keyPressEvent( QKeyEvent* event )
+{
+//qDebug("%s %d keyPressEvent and key is %d", __FILE__, __LINE__, event->key());
+
+    bool emitKeyPressSignal = true;
+
+    // XonXoff flow control
+    if (event->modifiers() & Qt::ControlModifier && _flowControlWarningEnabled)
+	{
+		if ( event->key() == Qt::Key_S ) {
+		//qDebug("%s %d keyPressEvent, output suspended", __FILE__, __LINE__);
+				emit flowControlKeyPressed(true /*output suspended*/);
+		}
+		else if ( event->key() == Qt::Key_Q ) {
+		//qDebug("%s %d keyPressEvent, output enabled", __FILE__, __LINE__);
+				emit flowControlKeyPressed(false /*output enabled*/);
+		}
+	}
+
+    // Keyboard-based navigation
+    if ( event->modifiers() == Qt::ShiftModifier )
+    {
+        bool update = true;
+
+        if ( event->key() == Qt::Key_PageUp )
+        {
+	    //qDebug("%s %d pageup", __FILE__, __LINE__);
+            _screenWindow->scrollBy( ScreenWindow::ScrollPages , -1 );
+        }
+        else if ( event->key() == Qt::Key_PageDown )
+        {
+	    //qDebug("%s %d pagedown", __FILE__, __LINE__);
+            _screenWindow->scrollBy( ScreenWindow::ScrollPages , 1 );
+        }
+        else if ( event->key() == Qt::Key_Up )
+        {
+	    //qDebug("%s %d keyup", __FILE__, __LINE__);	
+            _screenWindow->scrollBy( ScreenWindow::ScrollLines , -1 );
+        }
+        else if ( event->key() == Qt::Key_Down )
+        {
+	    //qDebug("%s %d keydown", __FILE__, __LINE__);	
+            _screenWindow->scrollBy( ScreenWindow::ScrollLines , 1 );
+        }
+        else {
+            update = false;
+	}
+
+        if ( update )
+        {
+	    //qDebug("%s %d updating", __FILE__, __LINE__);	
+            _screenWindow->setTrackOutput( _screenWindow->atEndOfOutput() );
+            
+            updateLineProperties();
+            updateImage();
+
+            // do not send key press to terminal
+            emitKeyPressSignal = false;
+        }
+    }
+    
+    _screenWindow->setTrackOutput( true );
+    
+    _actSel=0; // Key stroke implies a screen update, so TerminalDisplay won't
+              // know where the current selection is.
+
+    if (_hasBlinkingCursor) 
+    {
+      _blinkCursorTimer->start(BLINK_DELAY);
+      if (_cursorBlinking)
+        blinkCursorEvent();
+      else
+        _cursorBlinking = false;
+    }
+
+    if ( emitKeyPressSignal )
+        emit keyPressedSignal(event);
+
+    event->accept();
+}
+
+void TerminalDisplay::inputMethodEvent( QInputMethodEvent* event )
+{
+    QKeyEvent keyEvent(QEvent::KeyPress,0,Qt::NoModifier,event->commitString());
+    emit keyPressedSignal(&keyEvent);
+
+    _inputMethodData.preeditString = event->preeditString();
+    update(preeditRect() | _inputMethodData.previousPreeditRect);
+    
+    event->accept();
+}
+QVariant TerminalDisplay::inputMethodQuery( Qt::InputMethodQuery query ) const
+{
+    const QPoint cursorPos = _screenWindow ? _screenWindow->cursorPosition() : QPoint(0,0);
+    switch ( query ) 
+    {
+        case Qt::ImMicroFocus:
+                return imageToWidget(QRect(cursorPos.x(),cursorPos.y(),1,1));
+            break;
+        case Qt::ImFont:
+                return font();
+            break;
+        case Qt::ImCursorPosition:
+                // return the cursor position within the current line
+                return cursorPos.x();
+            break;
+        case Qt::ImSurroundingText:
+            {
+                // return the text from the current line
+                QString lineText;
+                QTextStream stream(&lineText);
+                PlainTextDecoder decoder;
+                decoder.begin(&stream);
+                decoder.decodeLine(&_image[loc(0,cursorPos.y())],_usedColumns,_lineProperties[cursorPos.y()]);
+                decoder.end();
+                return lineText;
+            }
+            break;
+        case Qt::ImCurrentSelection:
+                return QString();
+            break;
+    }
+
+    return QVariant();
+}
+
+bool TerminalDisplay::event( QEvent *e )
+{
+  if ( e->type() == QEvent::ShortcutOverride )
+  {
+    QKeyEvent* keyEvent = static_cast<QKeyEvent *>( e );
+
+    // a check to see if keyEvent->text() is empty is used
+    // to avoid intercepting the press of the modifier key on its own.
+    //
+    // this is important as it allows a press and release of the Alt key
+    // on its own to focus the menu bar, making it possible to
+    // work with the menu without using the mouse
+    if ( (keyEvent->modifiers() == Qt::AltModifier) && 
+         !keyEvent->text().isEmpty() )
+    {
+    	keyEvent->accept();
+      	return true;
+    }
+
+    // Override any of the following shortcuts because
+    // they are needed by the terminal
+    int keyCode = keyEvent->key() | keyEvent->modifiers();
+    switch ( keyCode )
+    {
+      // list is taken from the QLineEdit::event() code
+      case Qt::Key_Tab:
+      case Qt::Key_Delete:
+      case Qt::Key_Home:
+      case Qt::Key_End:
+      case Qt::Key_Backspace:
+      case Qt::Key_Left:
+      case Qt::Key_Right:
+        keyEvent->accept();
+        return true;
+    }
+  }
+  return QWidget::event( e );
+}
+
+void TerminalDisplay::setBellMode(int mode)
+{
+  _bellMode=mode;
+}
+
+void TerminalDisplay::enableBell()
+{
+    _allowBell = true;
+}
+
+void TerminalDisplay::bell(const QString&)
+{
+  if (_bellMode==NoBell) return;
+
+  //limit the rate at which bells can occur 
+  //...mainly for sound effects where rapid bells in sequence 
+  //produce a horrible noise
+  if ( _allowBell )
+  {
+    _allowBell = false;
+    QTimer::singleShot(500,this,SLOT(enableBell()));
+ 
+    if (_bellMode==SystemBeepBell) 
+    {
+//        KNotification::beep();
+    } 
+    else if (_bellMode==NotifyBell) 
+    {
+//        KNotification::event("BellVisible", message,QPixmap(),this);
+    } 
+    else if (_bellMode==VisualBell) 
+    {
+        swapColorTable();
+        QTimer::singleShot(200,this,SLOT(swapColorTable()));
+    }
+  }
+}
+
+void TerminalDisplay::swapColorTable()
+{
+  ColorEntry color = _colorTable[1];
+  _colorTable[1]=_colorTable[0];
+  _colorTable[0]= color;
+  _colorsInverted = !_colorsInverted;
+  update();
+}
+
+void TerminalDisplay::clearImage()
+{
+  // We initialize _image[_imageSize] too. See makeImage()
+  for (int i = 0; i <= _imageSize; i++)
+  {
+    _image[i].character = ' ';
+    _image[i].foregroundColor = CharacterColor(COLOR_SPACE_DEFAULT,
+                                               DEFAULT_FORE_COLOR);
+    _image[i].backgroundColor = CharacterColor(COLOR_SPACE_DEFAULT,
+                                               DEFAULT_BACK_COLOR);
+    _image[i].rendition = DEFAULT_RENDITION;
+  }
+}
+
+void TerminalDisplay::calcGeometry()
+{
+  _scrollBar->resize(QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent),
+                    contentsRect().height());
+  switch(_scrollbarLocation)
+  {
+    case NoScrollBar :
+     _leftMargin = DEFAULT_LEFT_MARGIN;
+     _contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN;
+     break;
+    case ScrollBarLeft :
+     _leftMargin = DEFAULT_LEFT_MARGIN + _scrollBar->width();
+     _contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN - _scrollBar->width();
+     _scrollBar->move(contentsRect().topLeft());
+     break;
+    case ScrollBarRight:
+     _leftMargin = DEFAULT_LEFT_MARGIN;
+     _contentWidth = contentsRect().width()  - 2 * DEFAULT_LEFT_MARGIN - _scrollBar->width();
+     _scrollBar->move(contentsRect().topRight() - QPoint(_scrollBar->width()-1,0));
+     break;
+  }
+
+  _topMargin = DEFAULT_TOP_MARGIN;
+  _contentHeight = contentsRect().height() - 2 * DEFAULT_TOP_MARGIN + /* mysterious */ 1;
+
+  if (!_isFixedSize)
+  {
+     // ensure that display is always at least one column wide
+     _columns = qMax(1,_contentWidth / _fontWidth);
+     _usedColumns = qMin(_usedColumns,_columns);
+     
+     // ensure that display is always at least one line high
+     _lines = qMax(1,_contentHeight / _fontHeight);
+     _usedLines = qMin(_usedLines,_lines);
+  }
+}
+
+void TerminalDisplay::makeImage()
+{
+//qDebug("%s %d makeImage", __FILE__, __LINE__);
+  calcGeometry();
+
+  // confirm that array will be of non-zero size, since the painting code 
+  // assumes a non-zero array length
+  Q_ASSERT( _lines > 0 && _columns > 0 );
+  Q_ASSERT( _usedLines <= _lines && _usedColumns <= _columns );
+
+  _imageSize=_lines*_columns;
+  
+  // We over-commit one character so that we can be more relaxed in dealing with
+  // certain boundary conditions: _image[_imageSize] is a valid but unused position
+  _image = new Character[_imageSize+1];
+
+  clearImage();
+}
+
+// calculate the needed size
+void TerminalDisplay::setSize(int columns, int lines)
+{
+  //FIXME - Not quite correct, a small amount of additional space
+  // will be used for margins, the scrollbar etc.
+  // we need to allow for this so that '_size' does allow
+  // enough room for the specified number of columns and lines to fit
+
+  QSize newSize = QSize( columns * _fontWidth  ,
+				 lines * _fontHeight   );
+
+  if ( newSize != size() )
+  {
+    _size = newSize;
+    updateGeometry();
+  }
+}
+
+void TerminalDisplay::setFixedSize(int cols, int lins)
+{
+  _isFixedSize = true;
+  
+  //ensure that display is at least one line by one column in size
+  _columns = qMax(1,cols);
+  _lines = qMax(1,lins);
+  _usedColumns = qMin(_usedColumns,_columns);
+  _usedLines = qMin(_usedLines,_lines);
+
+  if (_image)
+  {
+     delete[] _image;
+     makeImage();
+  }
+  setSize(cols, lins);
+  QWidget::setFixedSize(_size);
+}
+
+QSize TerminalDisplay::sizeHint() const
+{
+  return _size;
+}
+
+
+/* --------------------------------------------------------------------- */
+/*                                                                       */
+/* Drag & Drop                                                           */
+/*                                                                       */
+/* --------------------------------------------------------------------- */
+
+void TerminalDisplay::dragEnterEvent(QDragEnterEvent* event)
+{
+  if (event->mimeData()->hasFormat("text/plain"))
+      event->acceptProposedAction();
+}
+
+void TerminalDisplay::dropEvent(QDropEvent* event)
+{
+//  KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
+
+  QString dropText;
+/*  if (!urls.isEmpty()) 
+  {
+    for ( int i = 0 ; i < urls.count() ; i++ ) 
+    {
+        KUrl url = KIO::NetAccess::mostLocalUrl( urls[i] , 0 );
+        QString urlText;
+
+        if (url.isLocalFile())
+            urlText = url.path(); 
+        else
+            urlText = url.url();
+    
+        // in future it may be useful to be able to insert file names with drag-and-drop
+        // without quoting them (this only affects paths with spaces in) 
+        urlText = KShell::quoteArg(urlText);
+      
+        dropText += urlText;
+
+        if ( i != urls.count()-1 ) 
+            dropText += ' ';
+    }
+  }
+  else 
+  {
+    dropText = event->mimeData()->text();
+  }
+*/
+  if(event->mimeData()->hasFormat("text/plain")) 
+  {
+    emit sendStringToEmu(dropText.toLocal8Bit());
+  }
+}
+
+void TerminalDisplay::doDrag()
+{
+  dragInfo.state = diDragging;
+  dragInfo.dragObject = new QDrag(this);
+  QMimeData *mimeData = new QMimeData;
+  mimeData->setText(QApplication::clipboard()->text(QClipboard::Selection));
+  dragInfo.dragObject->setMimeData(mimeData);
+  dragInfo.dragObject->start(Qt::CopyAction);
+  // Don't delete the QTextDrag object.  Qt will delete it when it's done with it.
+}
+
+void TerminalDisplay::outputSuspended(bool suspended)
+{
+	//create the label when this function is first called
+	if (!_outputSuspendedLabel)
+	{
+            //This label includes a link to an English language website
+            //describing the 'flow control' (Xon/Xoff) feature found in almost 
+            //all terminal emulators.
+            //If there isn't a suitable article available in the target language the link
+            //can simply be removed.
+			_outputSuspendedLabel = new QLabel( ("<qt>Output has been "
+                                                "<a href=\"http://en.wikipedia.org/wiki/XON\">suspended</a>"
+                                                " by pressing Ctrl+S."
+											   "  Press <b>Ctrl+Q</b> to resume.</qt>"),
+											   this );
+
+            QPalette palette(_outputSuspendedLabel->palette());
+	    
+	    palette.setColor(QPalette::Normal, QPalette::WindowText, QColor(Qt::white));
+	    palette.setColor(QPalette::Normal, QPalette::Window, QColor(Qt::black));
+//            KColorScheme::adjustForeground(palette,KColorScheme::NeutralText);
+//		KColorScheme::adjustBackground(palette,KColorScheme::NeutralBackground);
+    	    _outputSuspendedLabel->setPalette(palette);
+	    _outputSuspendedLabel->setAutoFillBackground(true);
+	    _outputSuspendedLabel->setBackgroundRole(QPalette::Base);
+	    _outputSuspendedLabel->setFont(QApplication::font());
+            _outputSuspendedLabel->setMargin(5);
+
+            //enable activation of "Xon/Xoff" link in label
+            _outputSuspendedLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse | 
+                                                          Qt::LinksAccessibleByKeyboard);
+            _outputSuspendedLabel->setOpenExternalLinks(true);
+            _outputSuspendedLabel->setVisible(false);
+
+            _gridLayout->addWidget(_outputSuspendedLabel);       
+            _gridLayout->addItem( new QSpacerItem(0,0,QSizePolicy::Expanding,
+                                                      QSizePolicy::Expanding),
+                                 1,0);
+
+    }
+
+	_outputSuspendedLabel->setVisible(suspended);
+}
+
+uint TerminalDisplay::lineSpacing() const
+{
+  return _lineSpacing;
+}
+
+void TerminalDisplay::setLineSpacing(uint i)
+{
+  _lineSpacing = i;
+  setVTFont(font()); // Trigger an update.
+}
+
+//#include "moc_TerminalDisplay.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/TerminalDisplay.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,754 @@
+/*
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 TERMINALDISPLAY_H
+#define TERMINALDISPLAY_H
+
+// Qt
+#include <QtGui/QColor>
+#include <QtCore/QPointer>
+#include <QtGui/QWidget>
+
+// Konsole
+#include "Filter.h"
+#include "Character.h"
+#include "ColorTables.h"
+
+class QDrag;
+class QDragEnterEvent;
+class QDropEvent;
+class QLabel;
+class QTimer;
+class QEvent;
+class QFrame;
+class QGridLayout;
+class QKeyEvent;
+class QScrollBar;
+class QShowEvent;
+class QHideEvent;
+class QWidget;
+
+//class KMenu;
+
+namespace Konsole
+{
+
+extern unsigned short vt100_graphics[32];
+
+class ScreenWindow;
+
+/**
+ * A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
+ * to the terminal.
+ *
+ * When the terminal emulation receives new output from the program running in the terminal, 
+ * it will update the display by calling updateImage().
+ *
+ * TODO More documentation
+ */
+class TerminalDisplay : public QWidget
+{
+   Q_OBJECT
+
+public:
+    /** Constructs a new terminal display widget with the specified parent. */
+    TerminalDisplay(QWidget *parent=0);
+    virtual ~TerminalDisplay();
+
+    /** Returns the terminal color palette used by the display. */
+    const ColorEntry* colorTable() const;
+    /** Sets the terminal color palette used by the display. */
+    void setColorTable(const ColorEntry table[]);
+    /**
+     * Sets the seed used to generate random colors for the display
+     * (in color schemes that support them).
+     */
+    void setRandomSeed(uint seed);
+    /**
+     * Returns the seed used to generate random colors for the display
+     * (in color schemes that support them).
+     */
+    uint randomSeed() const;
+
+    /** Sets the opacity of the terminal display. */
+    void setOpacity(qreal opacity);
+
+    /** 
+     * This enum describes the location where the scroll bar is positioned in the display widget.
+     */
+    enum ScrollBarPosition 
+    { 
+        /** Do not show the scroll bar. */
+        NoScrollBar=0, 
+        /** Show the scroll bar on the left side of the display. */
+        ScrollBarLeft=1, 
+        /** Show the scroll bar on the right side of the display. */
+        ScrollBarRight=2 
+    };
+    /** 
+     * Specifies whether the terminal display has a vertical scroll bar, and if so whether it
+     * is shown on the left or right side of the display.
+     */
+    void setScrollBarPosition(ScrollBarPosition position);
+
+    /** 
+     * Sets the current position and range of the display's scroll bar.
+     *
+     * @param cursor The position of the scroll bar's thumb.
+     * @param lines The maximum value of the scroll bar.
+     */
+    void setScroll(int cursor, int lines);
+
+    /** 
+     * Returns the display's filter chain.  When the image for the display is updated,
+     * the text is passed through each filter in the chain.  Each filter can define
+     * hotspots which correspond to certain strings (such as URLs or particular words).
+     * Depending on the type of the hotspots created by the filter ( returned by Filter::Hotspot::type() )
+     * the view will draw visual cues such as underlines on mouse-over for links or translucent
+     * rectangles for markers.
+     *
+     * To add a new filter to the view, call:
+     *      viewWidget->filterChain()->addFilter( filterObject );
+     */
+    FilterChain* filterChain() const;
+
+    /** 
+     * Updates the filters in the display's filter chain.  This will cause
+     * the hotspots to be updated to match the current image.
+     *
+     * WARNING:  This function can be expensive depending on the 
+     * image size and number of filters in the filterChain()
+     *
+     * TODO - This API does not really allow efficient usage.  Revise it so
+     * that the processing can be done in a better way.
+     *
+     * eg:
+     *      - Area of interest may be known ( eg. mouse cursor hovering
+     *      over an area )
+     */  
+    void processFilters();
+
+    /** 
+     * Returns a list of menu actions created by the filters for the content
+     * at the given @p position.
+     */
+    QList<QAction*> filterActions(const QPoint& position);
+
+    /** Returns true if the cursor is set to blink or false otherwise. */
+    bool blinkingCursor() { return _hasBlinkingCursor; }
+    /** Specifies whether or not the cursor blinks. */
+    void setBlinkingCursor(bool blink);
+
+    void setCtrlDrag(bool enable) { _ctrlDrag=enable; }
+    bool ctrlDrag() { return _ctrlDrag; }
+
+	/** 
+     *  This enum describes the methods for selecting text when
+ 	 *  the user triple-clicks within the display. 
+ 	 */
+	enum TripleClickMode
+	{
+		/** Select the whole line underneath the cursor. */
+		SelectWholeLine,
+		/** Select from the current cursor position to the end of the line. */
+		SelectForwardsFromCursor
+	};
+    /** Sets how the text is selected when the user triple clicks within the display. */	
+    void setTripleClickMode(TripleClickMode mode) { _tripleClickMode = mode; }
+	/** See setTripleClickSelectionMode() */
+    TripleClickMode tripleClickMode() { return _tripleClickMode; }
+
+    void setLineSpacing(uint);
+    uint lineSpacing() const;
+
+    void emitSelection(bool useXselection,bool appendReturn);
+
+    /**
+     * This enum describes the available shapes for the keyboard cursor.
+     * See setKeyboardCursorShape()
+     */
+    enum KeyboardCursorShape
+    {
+        /** A rectangular block which covers the entire area of the cursor character. */
+        BlockCursor,
+        /** 
+         * A single flat line which occupies the space at the bottom of the cursor
+         * character's area.
+         */
+        UnderlineCursor,
+        /** 
+         * An cursor shaped like the capital letter 'I', similar to the IBeam 
+         * cursor used in Qt/KDE text editors.
+         */
+        IBeamCursor
+    };
+    /** 
+     * Sets the shape of the keyboard cursor.  This is the cursor drawn   
+     * at the position in the terminal where keyboard input will appear.
+     *
+     * In addition the terminal display widget also has a cursor for 
+     * the mouse pointer, which can be set using the QWidget::setCursor()
+     * method.
+     *
+     * Defaults to BlockCursor
+     */
+    void setKeyboardCursorShape(KeyboardCursorShape shape);
+    /**
+     * Returns the shape of the keyboard cursor.  See setKeyboardCursorShape()
+     */
+    KeyboardCursorShape keyboardCursorShape() const;
+
+    /**
+     * Sets the color used to draw the keyboard cursor.  
+     *
+     * The keyboard cursor defaults to using the foreground color of the character
+     * underneath it.
+     *
+     * @param useForegroundColor If true, the cursor color will change to match
+     * the foreground color of the character underneath it as it is moved, in this
+     * case, the @p color parameter is ignored and the color of the character
+     * under the cursor is inverted to ensure that it is still readable.
+     * @param color The color to use to draw the cursor.  This is only taken into
+     * account if @p useForegroundColor is false.
+     */
+    void setKeyboardCursorColor(bool useForegroundColor , const QColor& color);
+
+    /** 
+     * Returns the color of the keyboard cursor, or an invalid color if the keyboard
+     * cursor color is set to change according to the foreground color of the character
+     * underneath it. 
+     */
+    QColor keyboardCursorColor() const;
+
+    /**
+     * Returns the number of lines of text which can be displayed in the widget.
+     *
+     * This will depend upon the height of the widget and the current font.
+     * See fontHeight()
+     */
+    int  lines()   { return _lines;   }
+    /**
+     * Returns the number of characters of text which can be displayed on
+     * each line in the widget.
+     *
+     * This will depend upon the width of the widget and the current font.
+     * See fontWidth()
+     */
+    int  columns() { return _columns; }
+
+    /**
+     * Returns the height of the characters in the font used to draw the text in the display.
+     */
+    int  fontHeight()   { return _fontHeight;   }
+    /**
+     * Returns the width of the characters in the display.  
+     * This assumes the use of a fixed-width font.
+     */
+    int  fontWidth()    { return _fontWidth; }
+
+    void setSize(int cols, int lins);
+    void setFixedSize(int cols, int lins);
+    
+    // reimplemented
+    QSize sizeHint() const;
+
+    /**
+     * Sets which characters, in addition to letters and numbers, 
+     * are regarded as being part of a word for the purposes
+     * of selecting words in the display by double clicking on them.
+     *
+     * The word boundaries occur at the first and last characters which
+     * are either a letter, number, or a character in @p wc
+     *
+     * @param wc An array of characters which are to be considered parts
+     * of a word ( in addition to letters and numbers ).
+     */
+    void setWordCharacters(const QString& wc);
+    /** 
+     * Returns the characters which are considered part of a word for the 
+     * purpose of selecting words in the display with the mouse.
+     *
+     * @see setWordCharacters()
+     */
+    QString wordCharacters() { return _wordCharacters; }
+
+    /** 
+     * Sets the type of effect used to alert the user when a 'bell' occurs in the 
+     * terminal session.
+     *
+     * The terminal session can trigger the bell effect by calling bell() with
+     * the alert message.
+     */
+    void setBellMode(int mode);
+    /** 
+     * Returns the type of effect used to alert the user when a 'bell' occurs in
+     * the terminal session.
+     * 
+     * See setBellMode()
+     */
+    int bellMode() { return _bellMode; }
+
+    /**
+     * This enum describes the different types of sounds and visual effects which
+     * can be used to alert the user when a 'bell' occurs in the terminal
+     * session.
+     */
+    enum BellMode
+    { 
+        /** A system beep. */
+        SystemBeepBell=0, 
+        /** 
+         * KDE notification.  This may play a sound, show a passive popup
+         * or perform some other action depending on the user's settings.
+         */
+        NotifyBell=1, 
+        /** A silent, visual bell (eg. inverting the display's colors briefly) */
+        VisualBell=2, 
+        /** No bell effects */
+        NoBell=3 
+    };
+
+    void setSelection(const QString &t);
+
+    /** 
+     * Reimplemented.  Has no effect.  Use setVTFont() to change the font
+     * used to draw characters in the display.
+     */
+    virtual void setFont(const QFont &);
+
+    /** Returns the font used to draw characters in the display */
+    QFont getVTFont() { return font(); }
+
+    /** 
+     * Sets the font used to draw the display.  Has no effect if @p font
+     * is larger than the size of the display itself.    
+     */
+    void setVTFont(const QFont& font);
+
+    /**
+     * Specified whether anti-aliasing of text in the terminal display
+     * is enabled or not.  Defaults to enabled.
+     */
+    static void setAntialias( bool antialias ) { _antialiasText = antialias; }
+    /** 
+     * Returns true if anti-aliasing of text in the terminal is enabled.
+     */
+    static bool antialias()                 { return _antialiasText;   }
+    
+    /**
+     * Sets whether or not the current height and width of the 
+     * terminal in lines and columns is displayed whilst the widget
+     * is being resized.
+     */
+    void setTerminalSizeHint(bool on) { _terminalSizeHint=on; }
+    /** 
+     * Returns whether or not the current height and width of
+     * the terminal in lines and columns is displayed whilst the widget
+     * is being resized.
+     */
+    bool terminalSizeHint() { return _terminalSizeHint; }
+    /** 
+     * Sets whether the terminal size display is shown briefly
+     * after the widget is first shown.
+     *
+     * See setTerminalSizeHint() , isTerminalSizeHint()
+     */
+    void setTerminalSizeStartup(bool on) { _terminalSizeStartup=on; }
+
+    void setBidiEnabled(bool set) { _bidiEnabled=set; }
+    bool isBidiEnabled() { return _bidiEnabled; }
+
+    /**
+     * Sets the terminal screen section which is displayed in this widget.
+     * When updateImage() is called, the display fetches the latest character image from the
+     * the associated terminal screen window.
+     *
+     * In terms of the model-view paradigm, the ScreenWindow is the model which is rendered
+     * by the TerminalDisplay.
+     */
+    void setScreenWindow( ScreenWindow* window );
+    /** Returns the terminal screen section which is displayed in this widget.  See setScreenWindow() */
+    ScreenWindow* screenWindow() const;
+
+    static bool HAVE_TRANSPARENCY;
+
+public slots:
+
+    /** 
+     * Causes the terminal display to fetch the latest character image from the associated
+     * terminal screen ( see setScreenWindow() ) and redraw the display.
+     */
+    void updateImage(); 
+    /**
+     * Causes the terminal display to fetch the latest line status flags from the 
+     * associated terminal screen ( see setScreenWindow() ).  
+     */ 
+    void updateLineProperties();
+
+    /** Copies the selected text to the clipboard. */
+    void copyClipboard();
+    /** 
+     * Pastes the content of the clipboard into the 
+     * display.
+     */
+    void pasteClipboard();
+    /**
+     * Pastes the content of the selection into the
+     * display.
+     */
+    void pasteSelection();
+
+	/** 
+ 	  * Changes whether the flow control warning box should be shown when the flow control
+ 	  * stop key (Ctrl+S) are pressed.
+ 	  */
+	void setFlowControlWarningEnabled(bool enabled);
+	
+    /** 
+	 * Causes the widget to display or hide a message informing the user that terminal
+	 * output has been suspended (by using the flow control key combination Ctrl+S)
+	 *
+	 * @param suspended True if terminal output has been suspended and the warning message should
+	 *				 	be shown or false to indicate that terminal output has been resumed and that
+	 *				 	the warning message should disappear.
+	 */ 
+	void outputSuspended(bool suspended);
+
+    /**
+     * Sets whether the program whoose output is being displayed in the view
+     * is interested in mouse events.
+     *
+     * If this is set to true, mouse signals will be emitted by the view when the user clicks, drags
+     * or otherwise moves the mouse inside the view.
+     * The user interaction needed to create selections will also change, and the user will be required
+     * to hold down the shift key to create a selection or perform other mouse activities inside the 
+     * view area - since the program running in the terminal is being allowed to handle normal mouse
+     * events itself.
+     *
+     * @param usesMouse Set to true if the program running in the terminal is interested in mouse events
+     * or false otherwise.
+     */
+    void setUsesMouse(bool usesMouse);
+  
+    /** See setUsesMouse() */
+    bool usesMouse() const;
+
+    /** 
+     * Shows a notification that a bell event has occurred in the terminal.
+     * TODO: More documentation here
+     */
+    void bell(const QString& message);
+
+signals:
+
+    /**
+     * Emitted when the user presses a key whilst the terminal widget has focus.
+     */
+    void keyPressedSignal(QKeyEvent *e);
+
+    /**
+     * Emitted when the user presses the suspend or resume flow control key combinations 
+     * 
+     * @param suspend true if the user pressed Ctrl+S (the suspend output key combination) or
+     * false if the user pressed Ctrl+Q (the resume output key combination)
+     */
+    void flowControlKeyPressed(bool suspend);
+    
+    /** 
+     * A mouse event occurred.
+     * @param button The mouse button (0 for left button, 1 for middle button, 2 for right button, 3 for release)
+     * @param column The character column where the event occurred
+     * @param line The character row where the event occurred
+     * @param eventType The type of event.  0 for a mouse press / release or 1 for mouse motion
+     */
+    void mouseSignal(int button, int column, int line, int eventType);
+    void changedFontMetricSignal(int height, int width);
+    void changedContentSizeSignal(int height, int width);
+
+    /** 
+     * Emitted when the user right clicks on the display, or right-clicks with the Shift
+     * key held down if usesMouse() is true.
+     *
+     * This can be used to display a context menu.
+     */
+    void configureRequest( TerminalDisplay*, int state, const QPoint& position );
+
+   void isBusySelecting(bool);
+   void sendStringToEmu(const char*);
+
+protected:
+    virtual bool event( QEvent * );
+
+    virtual void paintEvent( QPaintEvent * );
+
+    virtual void showEvent(QShowEvent*);
+    virtual void hideEvent(QHideEvent*);
+    virtual void resizeEvent(QResizeEvent*);
+
+    virtual void fontChange(const QFont &font);
+
+    virtual void keyPressEvent(QKeyEvent* event);
+    virtual void mouseDoubleClickEvent(QMouseEvent* ev);
+    virtual void mousePressEvent( QMouseEvent* );
+    virtual void mouseReleaseEvent( QMouseEvent* );
+    virtual void mouseMoveEvent( QMouseEvent* );
+    virtual void extendSelection( const QPoint& pos );
+    virtual void wheelEvent( QWheelEvent* );
+
+    virtual bool focusNextPrevChild( bool next );
+    
+    // drag and drop
+    virtual void dragEnterEvent(QDragEnterEvent* event);
+    virtual void dropEvent(QDropEvent* event);
+    void doDrag();
+    enum DragState { diNone, diPending, diDragging };
+
+    struct _dragInfo {
+      DragState       state;
+      QPoint          start;
+      QDrag           *dragObject;
+    } dragInfo;
+
+    virtual int charClass(quint16) const;
+
+    void clearImage();
+
+    void mouseTripleClickEvent(QMouseEvent* ev);
+
+    // reimplemented
+    virtual void inputMethodEvent ( QInputMethodEvent* event );
+    virtual QVariant inputMethodQuery( Qt::InputMethodQuery query ) const;
+
+protected slots:
+
+    void scrollBarPositionChanged(int value);
+    void blinkEvent();
+    void blinkCursorEvent();
+    
+    //Renables bell noises and visuals.  Used to disable further bells for a short period of time
+    //after emitting the first in a sequence of bell events.
+    void enableBell();
+
+private slots:
+
+    void swapColorTable();
+    void tripleClickTimeout();  // resets possibleTripleClick
+
+private:
+
+    // -- Drawing helpers --
+
+    // divides the part of the display specified by 'rect' into
+    // fragments according to their colors and styles and calls
+    // drawTextFragment() to draw the fragments 
+    void drawContents(QPainter &paint, const QRect &rect);
+    // draws a section of text, all the text in this section
+    // has a common color and style
+    void drawTextFragment(QPainter& painter, const QRect& rect, 
+                          const QString& text, const Character* style); 
+    // draws the background for a text fragment
+    // if useOpacitySetting is true then the color's alpha value will be set to
+    // the display's transparency (set with setOpacity()), otherwise the background
+    // will be drawn fully opaque
+    void drawBackground(QPainter& painter, const QRect& rect, const QColor& color,
+						bool useOpacitySetting);
+    // draws the cursor character
+    void drawCursor(QPainter& painter, const QRect& rect , const QColor& foregroundColor, 
+                                       const QColor& backgroundColor , bool& invertColors);
+    // draws the characters or line graphics in a text fragment
+    void drawCharacters(QPainter& painter, const QRect& rect,  const QString& text, 
+                                           const Character* style, bool invertCharacterColor);
+    // draws a string of line graphics
+	void drawLineCharString(QPainter& painter, int x, int y, 
+                            const QString& str, const Character* attributes);
+
+    // draws the preedit string for input methods
+    void drawInputMethodPreeditString(QPainter& painter , const QRect& rect);
+
+    // --
+
+    // maps an area in the character image to an area on the widget 
+    QRect imageToWidget(const QRect& imageArea) const;
+
+    // maps a point on the widget to the position ( ie. line and column ) 
+    // of the character at that point.
+    void getCharacterPosition(const QPoint& widgetPoint,int& line,int& column) const;
+
+    // the area where the preedit string for input methods will be draw
+    QRect preeditRect() const;
+
+    // shows a notification window in the middle of the widget indicating the terminal's
+    // current size in columns and lines
+    void showResizeNotification();
+
+    // scrolls the image by a number of lines.  
+    // 'lines' may be positive ( to scroll the image down ) 
+    // or negative ( to scroll the image up )
+    // 'region' is the part of the image to scroll - currently only
+    // the top, bottom and height of 'region' are taken into account,
+    // the left and right are ignored.
+    void scrollImage(int lines , const QRect& region);
+
+    void calcGeometry();
+    void propagateSize();
+    void updateImageSize();
+    void makeImage();
+    
+    void paintFilters(QPainter& painter);
+
+	// returns a region covering all of the areas of the widget which contain
+	// a hotspot
+	QRegion hotSpotRegion() const;
+
+	// returns the position of the cursor in columns and lines
+	QPoint cursorPosition() const;
+
+    // the window onto the terminal screen which this display
+    // is currently showing.  
+    QPointer<ScreenWindow> _screenWindow;
+
+    bool _allowBell;
+
+    QGridLayout* _gridLayout;
+
+    bool _fixedFont; // has fixed pitch
+    int  _fontHeight;     // height
+    int  _fontWidth;     // width
+    int  _fontAscent;     // ascend
+
+    int _leftMargin;    // offset
+    int _topMargin;    // offset
+
+    int _lines;      // the number of lines that can be displayed in the widget
+    int _columns;    // the number of columns that can be displayed in the widget
+    
+    int _usedLines;  // the number of lines that are actually being used, this will be less
+                    // than 'lines' if the character image provided with setImage() is smaller
+                    // than the maximum image size which can be displayed
+
+    int _usedColumns; // the number of columns that are actually being used, this will be less
+                     // than 'columns' if the character image provided with setImage() is smaller
+                     // than the maximum image size which can be displayed
+    
+    int _contentHeight;
+    int _contentWidth;
+    Character* _image; // [lines][columns]
+               // only the area [usedLines][usedColumns] in the image contains valid data
+
+    int _imageSize;
+    QVector<LineProperty> _lineProperties;
+
+    ColorEntry _colorTable[TABLE_COLORS];
+    uint _randomSeed;
+
+    bool _resizing;
+    bool _terminalSizeHint;
+    bool _terminalSizeStartup;
+    bool _bidiEnabled;
+    bool _mouseMarks;
+
+    QPoint  _iPntSel; // initial selection point
+    QPoint  _pntSel; // current selection point
+    QPoint  _tripleSelBegin; // help avoid flicker
+    int     _actSel; // selection state
+    bool    _wordSelectionMode;
+    bool    _lineSelectionMode;
+    bool    _preserveLineBreaks;
+    bool    _columnSelectionMode;
+
+    QClipboard*  _clipboard;
+    QScrollBar* _scrollBar;
+    ScrollBarPosition _scrollbarLocation;
+    QString     _wordCharacters;
+    int         _bellMode;
+
+    bool _blinking;   // hide text in paintEvent
+    bool _hasBlinker; // has characters to blink
+    bool _cursorBlinking;     // hide cursor in paintEvent
+    bool _hasBlinkingCursor;  // has blinking cursor enabled
+    bool _ctrlDrag;           // require Ctrl key for drag
+    TripleClickMode _tripleClickMode;
+    bool _isFixedSize; //Columns / lines are locked.
+    QTimer* _blinkTimer;  // active when hasBlinker
+    QTimer* _blinkCursorTimer;  // active when hasBlinkingCursor
+
+//    KMenu* _drop;
+    QString _dropText;
+    int _dndFileCount;
+
+    bool _possibleTripleClick;  // is set in mouseDoubleClickEvent and deleted
+                               // after QApplication::doubleClickInterval() delay
+
+
+    QLabel* _resizeWidget;
+    QTimer* _resizeTimer;
+
+	bool _flowControlWarningEnabled;
+
+    //widgets related to the warning message that appears when the user presses Ctrl+S to suspend
+    //terminal output - informing them what has happened and how to resume output
+    QLabel* _outputSuspendedLabel; 
+    	
+    uint _lineSpacing;
+
+    bool _colorsInverted; // true during visual bell
+
+    QSize _size;
+	
+    QRgb _blendColor;
+
+    // list of filters currently applied to the display.  used for links and
+    // search highlight
+    TerminalImageFilterChain* _filterChain;
+    QRect _mouseOverHotspotArea;
+
+    KeyboardCursorShape _cursorShape;
+
+    // custom cursor color.  if this is invalid then the foreground
+    // color of the character under the cursor is used
+    QColor _cursorColor;  
+
+
+    struct InputMethodData
+    {
+        QString preeditString;
+        QRect previousPreeditRect;
+    };
+    InputMethodData _inputMethodData;
+
+    static bool _antialiasText;   // do we antialias or not
+
+    //the delay in milliseconds between redrawing blinking text
+    static const int BLINK_DELAY = 500;
+	static const int DEFAULT_LEFT_MARGIN = 1;
+	static const int DEFAULT_TOP_MARGIN = 1;
+
+public:
+    static void setTransparencyEnabled(bool enable)
+    {
+        HAVE_TRANSPARENCY = enable;
+    }
+};
+
+}
+
+#endif // TERMINALDISPLAY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Vt102Emulation.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1266 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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.
+*/
+
+// Own
+#include "Vt102Emulation.h"
+
+//#include <config-konsole.h>
+
+
+#if defined(__osf__) || defined(__APPLE__)
+#define AVOID_XKB
+#endif
+
+// this allows konsole to be compiled without XKB and XTEST extensions
+// even though it might be available on a particular system.
+#if defined(AVOID_XKB)
+#undef HAVE_XKB
+#endif
+
+// Standard 
+#include <stdio.h>
+#include <unistd.h>
+#include <assert.h>
+
+// Qt
+#include <QtCore/QEvent>
+#include <QtGui/QKeyEvent>
+#include <QtCore/QByteRef>
+
+// KDE
+//#include <kdebug.h>
+//#include <klocale.h>
+
+// Konsole
+#include "KeyboardTranslator.h"
+#include "Screen.h"
+
+#if defined(HAVE_XKB)
+void scrolllock_set_off();
+void scrolllock_set_on();
+#endif
+
+using namespace Konsole;
+
+/* VT102 Terminal Emulation
+
+   This class puts together the screens, the pty and the widget to a
+   complete terminal emulation. Beside combining it's componentes, it
+   handles the emulations's protocol.
+
+   This module consists of the following sections:
+
+   - Constructor/Destructor
+   - Incoming Bytes Event pipeline
+   - Outgoing Bytes
+     - Mouse Events
+     - Keyboard Events
+   - Modes and Charset State
+   - Diagnostics
+*/
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                       Constructor / Destructor                            */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+
+Vt102Emulation::Vt102Emulation() 
+    : Emulation(),
+     _titleUpdateTimer(new QTimer(this))
+{
+  _titleUpdateTimer->setSingleShot(true);
+
+  QObject::connect(_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle()));
+
+  initTokenizer();
+  reset();
+}
+
+Vt102Emulation::~Vt102Emulation()
+{
+}
+
+void Vt102Emulation::clearEntireScreen()
+{
+  _currentScreen->clearEntireScreen();
+
+  bufferedUpdate(); 
+}
+
+void Vt102Emulation::reset()
+{
+  //kDebug(1211)<<"Vt102Emulation::reset() resetToken()";
+  resetToken();
+  //kDebug(1211)<<"Vt102Emulation::reset() resetModes()";
+  resetModes();
+  //kDebug(1211)<<"Vt102Emulation::reset() resetCharSet()";
+  resetCharset(0);
+  //kDebug(1211)<<"Vt102Emulation::reset() reset screen0()";
+  _screen[0]->reset();
+  //kDebug(1211)<<"Vt102Emulation::reset() resetCharSet()";
+  resetCharset(1);
+  //kDebug(1211)<<"Vt102Emulation::reset() reset _screen 1";
+  _screen[1]->reset();
+  //kDebug(1211)<<"Vt102Emulation::reset() setCodec()";
+  setCodec(LocaleCodec);
+  //kDebug(1211)<<"Vt102Emulation::reset() done";
+ 
+  bufferedUpdate();
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                     Processing the incoming byte stream                   */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/* Incoming Bytes Event pipeline
+
+   This section deals with decoding the incoming character stream.
+   Decoding means here, that the stream is first separated into `tokens'
+   which are then mapped to a `meaning' provided as operations by the
+   `Screen' class or by the emulation class itself.
+
+   The pipeline proceeds as follows:
+
+   - Tokenizing the ESC codes (onReceiveChar)
+   - VT100 code page translation of plain characters (applyCharset)
+   - Interpretation of ESC codes (tau)
+
+   The escape codes and their meaning are described in the
+   technical reference of this program.
+*/
+
+// Tokens ------------------------------------------------------------------ --
+
+/*
+   Since the tokens are the central notion if this section, we've put them
+   in front. They provide the syntactical elements used to represent the
+   terminals operations as byte sequences.
+
+   They are encodes here into a single machine word, so that we can later
+   switch over them easily. Depending on the token itself, additional
+   argument variables are filled with parameter values.
+
+   The tokens are defined below:
+
+   - CHR        - Printable characters     (32..255 but DEL (=127))
+   - CTL        - Control characters       (0..31 but ESC (= 27), DEL)
+   - ESC        - Escape codes of the form <ESC><CHR but `[]()+*#'>
+   - ESC_DE     - Escape codes of the form <ESC><any of `()+*#%'> C
+   - CSI_PN     - Escape codes of the form <ESC>'['     {Pn} ';' {Pn} C
+   - CSI_PS     - Escape codes of the form <ESC>'['     {Pn} ';' ...  C
+   - CSI_PR     - Escape codes of the form <ESC>'[' '?' {Pn} ';' ...  C
+   - CSI_PE     - Escape codes of the form <ESC>'[' '!' {Pn} ';' ...  C
+   - VT52       - VT52 escape codes
+                  - <ESC><Chr>
+                  - <ESC>'Y'{Pc}{Pc}
+   - XTE_HA     - Xterm hacks              <ESC>`]' {Pn} `;' {Text} <BEL>
+                  note that this is handled differently
+
+   The last two forms allow list of arguments. Since the elements of
+   the lists are treated individually the same way, they are passed
+   as individual tokens to the interpretation. Further, because the
+   meaning of the parameters are names (althought represented as numbers),
+   they are includes within the token ('N').
+
+*/
+
+#define TY_CONSTR(T,A,N) ( ((((int)N) & 0xffff) << 16) | ((((int)A) & 0xff) << 8) | (((int)T) & 0xff) )
+
+#define TY_CHR(   )     TY_CONSTR(0,0,0)
+#define TY_CTL(A  )     TY_CONSTR(1,A,0)
+#define TY_ESC(A  )     TY_CONSTR(2,A,0)
+#define TY_ESC_CS(A,B)  TY_CONSTR(3,A,B)
+#define TY_ESC_DE(A  )  TY_CONSTR(4,A,0)
+#define TY_CSI_PS(A,N)  TY_CONSTR(5,A,N)
+#define TY_CSI_PN(A  )  TY_CONSTR(6,A,0)
+#define TY_CSI_PR(A,N)  TY_CONSTR(7,A,N)
+
+#define TY_VT52(A  )    TY_CONSTR(8,A,0)
+
+#define TY_CSI_PG(A  )  TY_CONSTR(9,A,0)
+
+#define TY_CSI_PE(A  )  TY_CONSTR(10,A,0)
+
+// Tokenizer --------------------------------------------------------------- --
+
+/* The tokenizers state
+
+   The state is represented by the buffer (pbuf, ppos),
+   and accompanied by decoded arguments kept in (argv,argc).
+   Note that they are kept internal in the tokenizer.
+*/
+
+void Vt102Emulation::resetToken()
+{
+  ppos = 0; argc = 0; argv[0] = 0; argv[1] = 0;
+}
+
+void Vt102Emulation::addDigit(int dig)
+{
+  argv[argc] = 10*argv[argc] + dig;
+}
+
+void Vt102Emulation::addArgument()
+{
+  argc = qMin(argc+1,MAXARGS-1);
+  argv[argc] = 0;
+}
+
+void Vt102Emulation::pushToToken(int cc)
+{
+  pbuf[ppos] = cc;
+  ppos = qMin(ppos+1,MAXPBUF-1);
+}
+
+// Character Classes used while decoding
+
+#define CTL  1
+#define CHR  2
+#define CPN  4
+#define DIG  8
+#define SCS 16
+#define GRP 32
+#define CPS 64
+
+void Vt102Emulation::initTokenizer()
+{ int i; quint8* s;
+  for(i =  0;                      i < 256; i++) tbl[ i]  = 0;
+  for(i =  0;                      i <  32; i++) tbl[ i] |= CTL;
+  for(i = 32;                      i < 256; i++) tbl[ i] |= CHR;
+  for(s = (quint8*)"@ABCDGHILMPSTXZcdfry"; *s; s++) tbl[*s] |= CPN;
+// resize = \e[8;<row>;<col>t
+  for(s = (quint8*)"t"; *s; s++) tbl[*s] |= CPS;
+  for(s = (quint8*)"0123456789"        ; *s; s++) tbl[*s] |= DIG;
+  for(s = (quint8*)"()+*%"             ; *s; s++) tbl[*s] |= SCS;
+  for(s = (quint8*)"()+*#[]%"          ; *s; s++) tbl[*s] |= GRP;
+  resetToken();
+}
+
+/* Ok, here comes the nasty part of the decoder.
+
+   Instead of keeping an explicit state, we deduce it from the
+   token scanned so far. It is then immediately combined with
+   the current character to form a scanning decision.
+
+   This is done by the following defines.
+
+   - P is the length of the token scanned so far.
+   - L (often P-1) is the position on which contents we base a decision.
+   - C is a character or a group of characters (taken from 'tbl').
+
+   Note that they need to applied in proper order.
+*/
+
+#define lec(P,L,C) (p == (P) &&                     s[(L)]         == (C))
+#define lun(     ) (p ==  1  &&                       cc           >= 32 )
+#define les(P,L,C) (p == (P) && s[L] < 256  && (tbl[s[(L)]] & (C)) == (C))
+#define eec(C)     (p >=  3  &&        cc                          == (C))
+#define ees(C)     (p >=  3  && cc < 256 &&    (tbl[  cc  ] & (C)) == (C))
+#define eps(C)     (p >=  3  && s[2] != '?' && s[2] != '!' && s[2] != '>' && cc < 256 && (tbl[  cc  ] & (C)) == (C))
+#define epp( )     (p >=  3  && s[2] == '?'                              )
+#define epe( )     (p >=  3  && s[2] == '!'                              )
+#define egt(     ) (p >=  3  && s[2] == '>'                              )
+#define Xpe        (ppos>=2  && pbuf[1] == ']'                           )
+#define Xte        (Xpe                        &&     cc           ==  7 )
+#define ces(C)     (            cc < 256 &&    (tbl[  cc  ] & (C)) == (C) && !Xte)
+
+#define ESC 27
+#define CNTL(c) ((c)-'@')
+
+// process an incoming unicode character
+
+void Vt102Emulation::receiveChar(int cc)
+{ 
+  int i;
+  if (cc == 127) return; //VT100: ignore.
+
+  if (ces(    CTL))
+  { // DEC HACK ALERT! Control Characters are allowed *within* esc sequences in VT100
+    // This means, they do neither a resetToken nor a pushToToken. Some of them, do
+    // of course. Guess this originates from a weakly layered handling of the X-on
+    // X-off protocol, which comes really below this level.
+    if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) resetToken(); //VT100: CAN or SUB
+    if (cc != ESC)    { tau( TY_CTL(cc+'@' ),   0,  0); return; }
+  }
+
+  pushToToken(cc); // advance the state
+
+  int* s = pbuf;
+  int  p = ppos;
+
+  if (getMode(MODE_Ansi)) // decide on proper action
+  {
+    if (lec(1,0,ESC)) {                                                       return; }
+    if (lec(1,0,ESC+128)) { s[0] = ESC; receiveChar('[');                   return; }
+    if (les(2,1,GRP)) {                                                       return; }
+    if (Xte         ) { XtermHack();                            resetToken(); return; }
+    if (Xpe         ) {                                                       return; }
+    if (lec(3,2,'?')) {                                                       return; }
+    if (lec(3,2,'>')) {                                                       return; }
+    if (lec(3,2,'!')) {                                                       return; }
+    if (lun(       )) { tau( TY_CHR(), applyCharset(cc), 0); resetToken(); return; }
+    if (lec(2,0,ESC)) { tau( TY_ESC(s[1]),   0,  0);       resetToken(); return; }
+    if (les(3,1,SCS)) { tau( TY_ESC_CS(s[1],s[2]),   0,  0);  resetToken(); return; }
+    if (lec(3,1,'#')) { tau( TY_ESC_DE(s[2]),   0,  0);       resetToken(); return; }
+    if (eps(    CPN)) { tau( TY_CSI_PN(cc), argv[0],argv[1]);   resetToken(); return; }
+
+// resize = \e[8;<row>;<col>t
+    if (eps(    CPS)) { tau( TY_CSI_PS(cc, argv[0]), argv[1], argv[2]);   resetToken(); return; }
+
+    if (epe(       )) { tau( TY_CSI_PE(cc),     0,  0);       resetToken(); return; }
+    if (ees(    DIG)) { addDigit(cc-'0');                                     return; }
+    if (eec(    ';')) { addArgument();                                        return; }
+    for (i=0;i<=argc;i++)
+    if ( epp(     ))  { tau( TY_CSI_PR(cc,argv[i]),   0,  0); }
+    else if(egt(    ))   { tau( TY_CSI_PG(cc     ),   0,  0); } // spec. case for ESC]>0c or ESC]>c
+    else if (cc == 'm' && argc - i >= 4 && (argv[i] == 38 || argv[i] == 48) && argv[i+1] == 2)
+    { // ESC[ ... 48;2;<red>;<green>;<blue> ... m -or- ESC[ ... 38;2;<red>;<green>;<blue> ... m
+      i += 2;
+      tau( TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_RGB, (argv[i] << 16) | (argv[i+1] << 8) | argv[i+2]);
+      i += 2;
+    }
+    else if (cc == 'm' && argc - i >= 2 && (argv[i] == 38 || argv[i] == 48) && argv[i+1] == 5)
+    { // ESC[ ... 48;5;<index> ... m -or- ESC[ ... 38;5;<index> ... m
+      i += 2;
+      tau( TY_CSI_PS(cc, argv[i-2]), COLOR_SPACE_256, argv[i]);
+    }
+    else              { tau( TY_CSI_PS(cc,argv[i]),   0,  0); }
+    resetToken();
+  }
+  else // mode VT52
+  {
+    if (lec(1,0,ESC))                                                      return;
+    if (les(1,0,CHR)) { tau( TY_CHR(       ), s[0],  0); resetToken(); return; }
+    if (lec(2,1,'Y'))                                                      return;
+    if (lec(3,1,'Y'))                                                      return;
+    if (p < 4)        { tau( TY_VT52(s[1]   ),   0,  0); resetToken(); return; }
+                        tau( TY_VT52(s[1]   ), s[2],s[3]); resetToken(); return;
+  }
+}
+
+void Vt102Emulation::XtermHack()
+{ int i,arg = 0;
+  for (i = 2; i < ppos && '0'<=pbuf[i] && pbuf[i]<'9' ; i++)
+    arg = 10*arg + (pbuf[i]-'0');
+  if (pbuf[i] != ';') { ReportErrorToken(); return; }
+  QChar *str = new QChar[ppos-i-2];
+  for (int j = 0; j < ppos-i-2; j++) str[j] = pbuf[i+1+j];
+  QString unistr(str,ppos-i-2);
+  
+  // arg == 1 doesn't change the title. In XTerm it only changes the icon name
+  // (btw: arg=0 changes title and icon, arg=1 only icon, arg=2 only title
+//  emit changeTitle(arg,unistr);
+  _pendingTitleUpdates[arg] = unistr;
+  _titleUpdateTimer->start(20);
+
+  delete [] str;
+}
+
+void Vt102Emulation::updateTitle()
+{
+	QListIterator<int> iter( _pendingTitleUpdates.keys() );
+	while (iter.hasNext()) {
+		int arg = iter.next();
+		emit titleChanged( arg , _pendingTitleUpdates[arg] );	
+	}
+
+    _pendingTitleUpdates.clear();	
+}
+
+// Interpreting Codes ---------------------------------------------------------
+
+/*
+   Now that the incoming character stream is properly tokenized,
+   meaning is assigned to them. These are either operations of
+   the current _screen, or of the emulation class itself.
+
+   The token to be interpreteted comes in as a machine word
+   possibly accompanied by two parameters.
+
+   Likewise, the operations assigned to, come with up to two
+   arguments. One could consider to make up a proper table
+   from the function below.
+
+   The technical reference manual provides more information
+   about this mapping.
+*/
+
+void Vt102Emulation::tau( int token, int p, int q )
+{
+#if 0
+int N = (token>>0)&0xff;
+int A = (token>>8)&0xff;
+switch( N )
+{
+   case 0: printf("%c", (p < 128) ? p : '?');
+           break;
+   case 1: if (A == 'J') printf("\r");
+           else if (A == 'M') printf("\n");
+           else printf("CTL-%c ", (token>>8)&0xff);
+           break;
+   case 2: printf("ESC-%c ", (token>>8)&0xff);
+           break;
+   case 3: printf("ESC_CS-%c-%c ", (token>>8)&0xff, (token>>16)&0xff);
+           break;
+   case 4: printf("ESC_DE-%c ", (token>>8)&0xff);
+           break;
+   case 5: printf("CSI-PS-%c-%d", (token>>8)&0xff, (token>>16)&0xff );
+           break;
+   case 6: printf("CSI-PN-%c [%d]", (token>>8)&0xff, p);
+           break;
+   case 7: printf("CSI-PR-%c-%d", (token>>8)&0xff, (token>>16)&0xff );
+           break;
+   case 8: printf("VT52-%c", (token>>8)&0xff);
+           break;
+   case 9: printf("CSI-PG-%c", (token>>8)&0xff);
+           break;
+   case 10: printf("CSI-PE-%c", (token>>8)&0xff);
+           break;
+}
+#endif
+
+  switch (token)
+  {
+
+    case TY_CHR(         ) : _currentScreen->ShowCharacter        (p         ); break; //UTF16
+
+    //             127 DEL    : ignored on input
+
+    case TY_CTL('@'      ) : /* NUL: ignored                      */ break;
+    case TY_CTL('A'      ) : /* SOH: ignored                      */ break;
+    case TY_CTL('B'      ) : /* STX: ignored                      */ break;
+    case TY_CTL('C'      ) : /* ETX: ignored                      */ break;
+    case TY_CTL('D'      ) : /* EOT: ignored                      */ break;
+    case TY_CTL('E'      ) :      reportAnswerBack     (          ); break; //VT100
+    case TY_CTL('F'      ) : /* ACK: ignored                      */ break;
+    case TY_CTL('G'      ) : emit stateSet(NOTIFYBELL);
+                                break; //VT100
+    case TY_CTL('H'      ) : _currentScreen->BackSpace            (          ); break; //VT100
+    case TY_CTL('I'      ) : _currentScreen->Tabulate             (          ); break; //VT100
+    case TY_CTL('J'      ) : _currentScreen->NewLine              (          ); break; //VT100
+    case TY_CTL('K'      ) : _currentScreen->NewLine              (          ); break; //VT100
+    case TY_CTL('L'      ) : _currentScreen->NewLine              (          ); break; //VT100
+    case TY_CTL('M'      ) : _currentScreen->Return               (          ); break; //VT100
+
+    case TY_CTL('N'      ) :      useCharset           (         1); break; //VT100
+    case TY_CTL('O'      ) :      useCharset           (         0); break; //VT100
+
+    case TY_CTL('P'      ) : /* DLE: ignored                      */ break;
+    case TY_CTL('Q'      ) : /* DC1: XON continue                 */ break; //VT100
+    case TY_CTL('R'      ) : /* DC2: ignored                      */ break;
+    case TY_CTL('S'      ) : /* DC3: XOFF halt                    */ break; //VT100
+    case TY_CTL('T'      ) : /* DC4: ignored                      */ break;
+    case TY_CTL('U'      ) : /* NAK: ignored                      */ break;
+    case TY_CTL('V'      ) : /* SYN: ignored                      */ break;
+    case TY_CTL('W'      ) : /* ETB: ignored                      */ break;
+    case TY_CTL('X'      ) : _currentScreen->ShowCharacter        (    0x2592); break; //VT100
+    case TY_CTL('Y'      ) : /* EM : ignored                      */ break;
+    case TY_CTL('Z'      ) : _currentScreen->ShowCharacter        (    0x2592); break; //VT100
+    case TY_CTL('['      ) : /* ESC: cannot be seen here.         */ break;
+    case TY_CTL('\\'     ) : /* FS : ignored                      */ break;
+    case TY_CTL(']'      ) : /* GS : ignored                      */ break;
+    case TY_CTL('^'      ) : /* RS : ignored                      */ break;
+    case TY_CTL('_'      ) : /* US : ignored                      */ break;
+
+    case TY_ESC('D'      ) : _currentScreen->index                (          ); break; //VT100
+    case TY_ESC('E'      ) : _currentScreen->NextLine             (          ); break; //VT100
+    case TY_ESC('H'      ) : _currentScreen->changeTabStop        (true      ); break; //VT100
+    case TY_ESC('M'      ) : _currentScreen->reverseIndex         (          ); break; //VT100
+    case TY_ESC('Z'      ) :      reportTerminalType   (          ); break;
+    case TY_ESC('c'      ) :      reset                (          ); break;
+
+    case TY_ESC('n'      ) :      useCharset           (         2); break;
+    case TY_ESC('o'      ) :      useCharset           (         3); break;
+    case TY_ESC('7'      ) :      saveCursor           (          ); break;
+    case TY_ESC('8'      ) :      restoreCursor        (          ); break;
+
+    case TY_ESC('='      ) :          setMode      (MODE_AppKeyPad); break;
+    case TY_ESC('>'      ) :        resetMode      (MODE_AppKeyPad); break;
+    case TY_ESC('<'      ) :          setMode      (MODE_Ansi     ); break; //VT100
+
+    case TY_ESC_CS('(', '0') :      setCharset           (0,    '0'); break; //VT100
+    case TY_ESC_CS('(', 'A') :      setCharset           (0,    'A'); break; //VT100
+    case TY_ESC_CS('(', 'B') :      setCharset           (0,    'B'); break; //VT100
+
+    case TY_ESC_CS(')', '0') :      setCharset           (1,    '0'); break; //VT100
+    case TY_ESC_CS(')', 'A') :      setCharset           (1,    'A'); break; //VT100
+    case TY_ESC_CS(')', 'B') :      setCharset           (1,    'B'); break; //VT100
+
+    case TY_ESC_CS('*', '0') :      setCharset           (2,    '0'); break; //VT100
+    case TY_ESC_CS('*', 'A') :      setCharset           (2,    'A'); break; //VT100
+    case TY_ESC_CS('*', 'B') :      setCharset           (2,    'B'); break; //VT100
+
+    case TY_ESC_CS('+', '0') :      setCharset           (3,    '0'); break; //VT100
+    case TY_ESC_CS('+', 'A') :      setCharset           (3,    'A'); break; //VT100
+    case TY_ESC_CS('+', 'B') :      setCharset           (3,    'B'); break; //VT100
+
+    case TY_ESC_CS('%', 'G') :      setCodec             (Utf8Codec   ); break; //LINUX
+    case TY_ESC_CS('%', '@') :      setCodec             (LocaleCodec ); break; //LINUX
+
+    case TY_ESC_DE('3'      ) : /* Double height line, top half    */ 
+								_currentScreen->setLineProperty( LINE_DOUBLEWIDTH , true );
+								_currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , true );
+									break;
+    case TY_ESC_DE('4'      ) : /* Double height line, bottom half */ 
+								_currentScreen->setLineProperty( LINE_DOUBLEWIDTH , true );
+								_currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , true );
+									break;
+    case TY_ESC_DE('5'      ) : /* Single width, single height line*/
+								_currentScreen->setLineProperty( LINE_DOUBLEWIDTH , false);
+								_currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , false);
+								break;
+    case TY_ESC_DE('6'      ) : /* Double width, single height line*/ 
+							    _currentScreen->setLineProperty( LINE_DOUBLEWIDTH , true);	
+								_currentScreen->setLineProperty( LINE_DOUBLEHEIGHT , false);
+								break;
+    case TY_ESC_DE('8'      ) : _currentScreen->helpAlign            (          ); break;
+
+// resize = \e[8;<row>;<col>t
+    case TY_CSI_PS('t',   8) : setImageSize( q /* colums */, p /* lines */ );    break;
+
+// change tab text color : \e[28;<color>t  color: 0-16,777,215
+    case TY_CSI_PS('t',   28) : emit changeTabTextColorRequest      ( p        );          break;
+
+    case TY_CSI_PS('K',   0) : _currentScreen->clearToEndOfLine     (          ); break;
+    case TY_CSI_PS('K',   1) : _currentScreen->clearToBeginOfLine   (          ); break;
+    case TY_CSI_PS('K',   2) : _currentScreen->clearEntireLine      (          ); break;
+    case TY_CSI_PS('J',   0) : _currentScreen->clearToEndOfScreen   (          ); break;
+    case TY_CSI_PS('J',   1) : _currentScreen->clearToBeginOfScreen (          ); break;
+    case TY_CSI_PS('J',   2) : _currentScreen->clearEntireScreen    (          ); break;
+    case TY_CSI_PS('g',   0) : _currentScreen->changeTabStop        (false     ); break; //VT100
+    case TY_CSI_PS('g',   3) : _currentScreen->clearTabStops        (          ); break; //VT100
+    case TY_CSI_PS('h',   4) : _currentScreen->    setMode      (MODE_Insert   ); break;
+    case TY_CSI_PS('h',  20) :          setMode      (MODE_NewLine  ); break;
+    case TY_CSI_PS('i',   0) : /* IGNORE: attached printer          */ break; //VT100
+    case TY_CSI_PS('l',   4) : _currentScreen->  resetMode      (MODE_Insert   ); break;
+    case TY_CSI_PS('l',  20) :        resetMode      (MODE_NewLine  ); break;
+    case TY_CSI_PS('s',   0) :      saveCursor           (          ); break;
+    case TY_CSI_PS('u',   0) :      restoreCursor        (          ); break;
+
+    case TY_CSI_PS('m',   0) : _currentScreen->setDefaultRendition  (          ); break;
+    case TY_CSI_PS('m',   1) : _currentScreen->  setRendition     (RE_BOLD     ); break; //VT100
+    case TY_CSI_PS('m',   4) : _currentScreen->  setRendition     (RE_UNDERLINE); break; //VT100
+    case TY_CSI_PS('m',   5) : _currentScreen->  setRendition     (RE_BLINK    ); break; //VT100
+    case TY_CSI_PS('m',   7) : _currentScreen->  setRendition     (RE_REVERSE  ); break;
+    case TY_CSI_PS('m',  10) : /* IGNORED: mapping related          */ break; //LINUX
+    case TY_CSI_PS('m',  11) : /* IGNORED: mapping related          */ break; //LINUX
+    case TY_CSI_PS('m',  12) : /* IGNORED: mapping related          */ break; //LINUX
+    case TY_CSI_PS('m',  22) : _currentScreen->resetRendition     (RE_BOLD     ); break;
+    case TY_CSI_PS('m',  24) : _currentScreen->resetRendition     (RE_UNDERLINE); break;
+    case TY_CSI_PS('m',  25) : _currentScreen->resetRendition     (RE_BLINK    ); break;
+    case TY_CSI_PS('m',  27) : _currentScreen->resetRendition     (RE_REVERSE  ); break;
+
+    case TY_CSI_PS('m',   30) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  0); break;
+    case TY_CSI_PS('m',   31) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  1); break;
+    case TY_CSI_PS('m',   32) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  2); break;
+    case TY_CSI_PS('m',   33) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  3); break;
+    case TY_CSI_PS('m',   34) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  4); break;
+    case TY_CSI_PS('m',   35) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  5); break;
+    case TY_CSI_PS('m',   36) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  6); break;
+    case TY_CSI_PS('m',   37) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  7); break;
+
+    case TY_CSI_PS('m',   38) : _currentScreen->setForeColor         (p,       q); break;
+
+    case TY_CSI_PS('m',   39) : _currentScreen->setForeColor         (COLOR_SPACE_DEFAULT,  0); break;
+
+    case TY_CSI_PS('m',   40) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  0); break;
+    case TY_CSI_PS('m',   41) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  1); break;
+    case TY_CSI_PS('m',   42) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  2); break;
+    case TY_CSI_PS('m',   43) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  3); break;
+    case TY_CSI_PS('m',   44) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  4); break;
+    case TY_CSI_PS('m',   45) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  5); break;
+    case TY_CSI_PS('m',   46) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  6); break;
+    case TY_CSI_PS('m',   47) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  7); break;
+
+    case TY_CSI_PS('m',   48) : _currentScreen->setBackColor         (p,       q); break;
+
+    case TY_CSI_PS('m',   49) : _currentScreen->setBackColor         (COLOR_SPACE_DEFAULT,  1); break;
+
+    case TY_CSI_PS('m',   90) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  8); break;
+    case TY_CSI_PS('m',   91) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM,  9); break;
+    case TY_CSI_PS('m',   92) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM, 10); break;
+    case TY_CSI_PS('m',   93) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM, 11); break;
+    case TY_CSI_PS('m',   94) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM, 12); break;
+    case TY_CSI_PS('m',   95) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM, 13); break;
+    case TY_CSI_PS('m',   96) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM, 14); break;
+    case TY_CSI_PS('m',   97) : _currentScreen->setForeColor         (COLOR_SPACE_SYSTEM, 15); break;
+
+    case TY_CSI_PS('m',  100) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  8); break;
+    case TY_CSI_PS('m',  101) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM,  9); break;
+    case TY_CSI_PS('m',  102) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM, 10); break;
+    case TY_CSI_PS('m',  103) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM, 11); break;
+    case TY_CSI_PS('m',  104) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM, 12); break;
+    case TY_CSI_PS('m',  105) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM, 13); break;
+    case TY_CSI_PS('m',  106) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM, 14); break;
+    case TY_CSI_PS('m',  107) : _currentScreen->setBackColor         (COLOR_SPACE_SYSTEM, 15); break;
+
+    case TY_CSI_PS('n',   5) :      reportStatus         (          ); break;
+    case TY_CSI_PS('n',   6) :      reportCursorPosition (          ); break;
+    case TY_CSI_PS('q',   0) : /* IGNORED: LEDs off                 */ break; //VT100
+    case TY_CSI_PS('q',   1) : /* IGNORED: LED1 on                  */ break; //VT100
+    case TY_CSI_PS('q',   2) : /* IGNORED: LED2 on                  */ break; //VT100
+    case TY_CSI_PS('q',   3) : /* IGNORED: LED3 on                  */ break; //VT100
+    case TY_CSI_PS('q',   4) : /* IGNORED: LED4 on                  */ break; //VT100
+    case TY_CSI_PS('x',   0) :      reportTerminalParms  (         2); break; //VT100
+    case TY_CSI_PS('x',   1) :      reportTerminalParms  (         3); break; //VT100
+
+    case TY_CSI_PN('@'      ) : _currentScreen->insertChars          (p         ); break;
+    case TY_CSI_PN('A'      ) : _currentScreen->cursorUp             (p         ); break; //VT100
+    case TY_CSI_PN('B'      ) : _currentScreen->cursorDown           (p         ); break; //VT100
+    case TY_CSI_PN('C'      ) : _currentScreen->cursorRight          (p         ); break; //VT100
+    case TY_CSI_PN('D'      ) : _currentScreen->cursorLeft           (p         ); break; //VT100
+    case TY_CSI_PN('G'      ) : _currentScreen->setCursorX           (p         ); break; //LINUX
+    case TY_CSI_PN('H'      ) : _currentScreen->setCursorYX          (p,      q); break; //VT100
+    case TY_CSI_PN('I'      ) : _currentScreen->Tabulate             (p         ); break;
+    case TY_CSI_PN('L'      ) : _currentScreen->insertLines          (p         ); break;
+    case TY_CSI_PN('M'      ) : _currentScreen->deleteLines          (p         ); break;
+    case TY_CSI_PN('P'      ) : _currentScreen->deleteChars          (p         ); break;
+    case TY_CSI_PN('S'      ) : _currentScreen->scrollUp             (p         ); break;
+    case TY_CSI_PN('T'      ) : _currentScreen->scrollDown           (p         ); break;
+    case TY_CSI_PN('X'      ) : _currentScreen->eraseChars           (p         ); break;
+    case TY_CSI_PN('Z'      ) : _currentScreen->backTabulate         (p         ); break;
+    case TY_CSI_PN('c'      ) :      reportTerminalType   (          ); break; //VT100
+    case TY_CSI_PN('d'      ) : _currentScreen->setCursorY           (p         ); break; //LINUX
+    case TY_CSI_PN('f'      ) : _currentScreen->setCursorYX          (p,      q); break; //VT100
+    case TY_CSI_PN('r'      ) :      setMargins           (p,      q); break; //VT100
+    case TY_CSI_PN('y'      ) : /* IGNORED: Confidence test          */ break; //VT100
+
+    case TY_CSI_PR('h',   1) :          setMode      (MODE_AppCuKeys); break; //VT100
+    case TY_CSI_PR('l',   1) :        resetMode      (MODE_AppCuKeys); break; //VT100
+    case TY_CSI_PR('s',   1) :         saveMode      (MODE_AppCuKeys); break; //FIXME
+    case TY_CSI_PR('r',   1) :      restoreMode      (MODE_AppCuKeys); break; //FIXME
+
+    case TY_CSI_PR('l',   2) :        resetMode      (MODE_Ansi     ); break; //VT100
+
+    case TY_CSI_PR('h',   3) : clearScreenAndSetColumns(132);          break; //VT100
+    case TY_CSI_PR('l',   3) : clearScreenAndSetColumns(80);           break; //VT100
+
+    case TY_CSI_PR('h',   4) : /* IGNORED: soft scrolling           */ break; //VT100
+    case TY_CSI_PR('l',   4) : /* IGNORED: soft scrolling           */ break; //VT100
+
+    case TY_CSI_PR('h',   5) : _currentScreen->    setMode      (MODE_Screen   ); break; //VT100
+    case TY_CSI_PR('l',   5) : _currentScreen->  resetMode      (MODE_Screen   ); break; //VT100
+
+    case TY_CSI_PR('h',   6) : _currentScreen->    setMode      (MODE_Origin   ); break; //VT100
+    case TY_CSI_PR('l',   6) : _currentScreen->  resetMode      (MODE_Origin   ); break; //VT100
+    case TY_CSI_PR('s',   6) : _currentScreen->   saveMode      (MODE_Origin   ); break; //FIXME
+    case TY_CSI_PR('r',   6) : _currentScreen->restoreMode      (MODE_Origin   ); break; //FIXME
+
+    case TY_CSI_PR('h',   7) : _currentScreen->    setMode      (MODE_Wrap     ); break; //VT100
+    case TY_CSI_PR('l',   7) : _currentScreen->  resetMode      (MODE_Wrap     ); break; //VT100
+    case TY_CSI_PR('s',   7) : _currentScreen->   saveMode      (MODE_Wrap     ); break; //FIXME
+    case TY_CSI_PR('r',   7) : _currentScreen->restoreMode      (MODE_Wrap     ); break; //FIXME
+
+    case TY_CSI_PR('h',   8) : /* IGNORED: autorepeat on            */ break; //VT100
+    case TY_CSI_PR('l',   8) : /* IGNORED: autorepeat off           */ break; //VT100
+    case TY_CSI_PR('s',   8) : /* IGNORED: autorepeat on            */ break; //VT100
+    case TY_CSI_PR('r',   8) : /* IGNORED: autorepeat off           */ break; //VT100
+
+    case TY_CSI_PR('h',   9) : /* IGNORED: interlace                */ break; //VT100
+    case TY_CSI_PR('l',   9) : /* IGNORED: interlace                */ break; //VT100
+    case TY_CSI_PR('s',   9) : /* IGNORED: interlace                */ break; //VT100
+    case TY_CSI_PR('r',   9) : /* IGNORED: interlace                */ break; //VT100
+
+    case TY_CSI_PR('h',  12) : /* IGNORED: Cursor blink             */ break; //att610
+    case TY_CSI_PR('l',  12) : /* IGNORED: Cursor blink             */ break; //att610
+    case TY_CSI_PR('s',  12) : /* IGNORED: Cursor blink             */ break; //att610
+    case TY_CSI_PR('r',  12) : /* IGNORED: Cursor blink             */ break; //att610
+
+    case TY_CSI_PR('h',  25) :          setMode      (MODE_Cursor   ); break; //VT100
+    case TY_CSI_PR('l',  25) :        resetMode      (MODE_Cursor   ); break; //VT100
+    case TY_CSI_PR('s',  25) :         saveMode      (MODE_Cursor   ); break; //VT100
+    case TY_CSI_PR('r',  25) :      restoreMode      (MODE_Cursor   ); break; //VT100
+
+    case TY_CSI_PR('h',  41) : /* IGNORED: obsolete more(1) fix     */ break; //XTERM
+    case TY_CSI_PR('l',  41) : /* IGNORED: obsolete more(1) fix     */ break; //XTERM
+    case TY_CSI_PR('s',  41) : /* IGNORED: obsolete more(1) fix     */ break; //XTERM
+    case TY_CSI_PR('r',  41) : /* IGNORED: obsolete more(1) fix     */ break; //XTERM
+
+    case TY_CSI_PR('h',  47) :          setMode      (MODE_AppScreen); break; //VT100
+    case TY_CSI_PR('l',  47) :        resetMode      (MODE_AppScreen); break; //VT100
+    case TY_CSI_PR('s',  47) :         saveMode      (MODE_AppScreen); break; //XTERM
+    case TY_CSI_PR('r',  47) :      restoreMode      (MODE_AppScreen); break; //XTERM
+
+    case TY_CSI_PR('h',  67) : /* IGNORED: DECBKM                   */ break; //XTERM
+    case TY_CSI_PR('l',  67) : /* IGNORED: DECBKM                   */ break; //XTERM
+    case TY_CSI_PR('s',  67) : /* IGNORED: DECBKM                   */ break; //XTERM
+    case TY_CSI_PR('r',  67) : /* IGNORED: DECBKM                   */ break; //XTERM
+
+    // XTerm defines the following modes:
+    // SET_VT200_MOUSE             1000
+    // SET_VT200_HIGHLIGHT_MOUSE   1001
+    // SET_BTN_EVENT_MOUSE         1002
+    // SET_ANY_EVENT_MOUSE         1003
+    //
+    
+    //Note about mouse modes:
+    //There are four mouse modes which xterm-compatible terminals can support - 1000,1001,1002,1003
+    //Konsole currently supports mode 1000 (basic mouse press and release) and mode 1002 (dragging the mouse).
+    //TODO:  Implementation of mouse modes 1001 (something called hilight tracking) and 
+    //1003 (a slight variation on dragging the mouse)
+    //
+ 
+    case TY_CSI_PR('h', 1000) :          setMode      (MODE_Mouse1000); break; //XTERM
+    case TY_CSI_PR('l', 1000) :        resetMode      (MODE_Mouse1000); break; //XTERM
+    case TY_CSI_PR('s', 1000) :         saveMode      (MODE_Mouse1000); break; //XTERM
+    case TY_CSI_PR('r', 1000) :      restoreMode      (MODE_Mouse1000); break; //XTERM
+
+    case TY_CSI_PR('h', 1001) : /* IGNORED: hilite mouse tracking    */ break; //XTERM
+    case TY_CSI_PR('l', 1001) :        resetMode      (MODE_Mouse1001); break; //XTERM
+    case TY_CSI_PR('s', 1001) : /* IGNORED: hilite mouse tracking    */ break; //XTERM
+    case TY_CSI_PR('r', 1001) : /* IGNORED: hilite mouse tracking    */ break; //XTERM
+
+    case TY_CSI_PR('h', 1002) :          setMode      (MODE_Mouse1002); break; //XTERM
+    case TY_CSI_PR('l', 1002) :        resetMode      (MODE_Mouse1002); break; //XTERM
+    case TY_CSI_PR('s', 1002) :         saveMode      (MODE_Mouse1002); break; //XTERM
+    case TY_CSI_PR('r', 1002) :      restoreMode      (MODE_Mouse1002); break; //XTERM
+
+    case TY_CSI_PR('h', 1003) :          setMode      (MODE_Mouse1003); break; //XTERM
+    case TY_CSI_PR('l', 1003) :        resetMode      (MODE_Mouse1003); break; //XTERM
+    case TY_CSI_PR('s', 1003) :         saveMode      (MODE_Mouse1003); break; //XTERM
+    case TY_CSI_PR('r', 1003) :      restoreMode      (MODE_Mouse1003); break; //XTERM
+
+    case TY_CSI_PR('h', 1047) :          setMode      (MODE_AppScreen); break; //XTERM
+    case TY_CSI_PR('l', 1047) : _screen[1]->clearEntireScreen(); resetMode(MODE_AppScreen); break; //XTERM
+    case TY_CSI_PR('s', 1047) :         saveMode      (MODE_AppScreen); break; //XTERM
+    case TY_CSI_PR('r', 1047) :      restoreMode      (MODE_AppScreen); break; //XTERM
+
+    //FIXME: Unitoken: save translations
+    case TY_CSI_PR('h', 1048) :      saveCursor           (          ); break; //XTERM
+    case TY_CSI_PR('l', 1048) :      restoreCursor        (          ); break; //XTERM
+    case TY_CSI_PR('s', 1048) :      saveCursor           (          ); break; //XTERM
+    case TY_CSI_PR('r', 1048) :      restoreCursor        (          ); break; //XTERM
+
+    //FIXME: every once new sequences like this pop up in xterm.
+    //       Here's a guess of what they could mean.
+    case TY_CSI_PR('h', 1049) : saveCursor(); _screen[1]->clearEntireScreen(); setMode(MODE_AppScreen); break; //XTERM
+    case TY_CSI_PR('l', 1049) : resetMode(MODE_AppScreen); restoreCursor(); break; //XTERM
+
+    //FIXME: weird DEC reset sequence
+    case TY_CSI_PE('p'      ) : /* IGNORED: reset         (        ) */ break;
+
+    //FIXME: when changing between vt52 and ansi mode evtl do some resetting.
+    case TY_VT52('A'      ) : _currentScreen->cursorUp             (         1); break; //VT52
+    case TY_VT52('B'      ) : _currentScreen->cursorDown           (         1); break; //VT52
+    case TY_VT52('C'      ) : _currentScreen->cursorRight          (         1); break; //VT52
+    case TY_VT52('D'      ) : _currentScreen->cursorLeft           (         1); break; //VT52
+
+    case TY_VT52('F'      ) :      setAndUseCharset     (0,    '0'); break; //VT52
+    case TY_VT52('G'      ) :      setAndUseCharset     (0,    'B'); break; //VT52
+
+    case TY_VT52('H'      ) : _currentScreen->setCursorYX          (1,1       ); break; //VT52
+    case TY_VT52('I'      ) : _currentScreen->reverseIndex         (          ); break; //VT52
+    case TY_VT52('J'      ) : _currentScreen->clearToEndOfScreen   (          ); break; //VT52
+    case TY_VT52('K'      ) : _currentScreen->clearToEndOfLine     (          ); break; //VT52
+    case TY_VT52('Y'      ) : _currentScreen->setCursorYX          (p-31,q-31 ); break; //VT52
+    case TY_VT52('Z'      ) :      reportTerminalType   (           ); break; //VT52
+    case TY_VT52('<'      ) :          setMode      (MODE_Ansi     ); break; //VT52
+    case TY_VT52('='      ) :          setMode      (MODE_AppKeyPad); break; //VT52
+    case TY_VT52('>'      ) :        resetMode      (MODE_AppKeyPad); break; //VT52
+
+    case TY_CSI_PG('c'      ) :  reportSecondaryAttributes(          ); break; //VT100
+
+    default : ReportErrorToken();    break;
+  };
+}
+
+void Vt102Emulation::clearScreenAndSetColumns(int columnCount)
+{
+    setImageSize(_currentScreen->getLines(),columnCount); 
+    clearEntireScreen();
+    setDefaultMargins(); 
+    _currentScreen->setCursorYX(0,0);
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                          Terminal to Host protocol                        */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/* 
+   Outgoing bytes originate from several sources:
+
+   - Replies to Enquieries.
+   - Mouse Events
+   - Keyboard Events
+*/
+
+/*!
+*/
+
+void Vt102Emulation::sendString(const char* s , int length)
+{
+  if ( length >= 0 )
+    emit sendData(s,length);
+  else
+    emit sendData(s,strlen(s));
+}
+
+// Replies ----------------------------------------------------------------- --
+
+// This section copes with replies send as response to an enquiery control code.
+
+/*!
+*/
+
+void Vt102Emulation::reportCursorPosition()
+{ char tmp[20];
+  sprintf(tmp,"\033[%d;%dR",_currentScreen->getCursorY()+1,_currentScreen->getCursorX()+1);
+  sendString(tmp);
+}
+
+/*
+   What follows here is rather obsolete and faked stuff.
+   The correspondent enquieries are neverthenless issued.
+*/
+
+/*!
+*/
+
+void Vt102Emulation::reportTerminalType()
+{
+  // Primary device attribute response (Request was: ^[[0c or ^[[c (from TT321 Users Guide))
+  //   VT220:  ^[[?63;1;2;3;6;7;8c   (list deps on emul. capabilities)
+  //   VT100:  ^[[?1;2c
+  //   VT101:  ^[[?1;0c
+  //   VT102:  ^[[?6v
+  if (getMode(MODE_Ansi))
+    sendString("\033[?1;2c");     // I'm a VT100
+  else
+    sendString("\033/Z");         // I'm a VT52
+}
+
+void Vt102Emulation::reportSecondaryAttributes()
+{
+  // Seconday device attribute response (Request was: ^[[>0c or ^[[>c)
+  if (getMode(MODE_Ansi))
+    sendString("\033[>0;115;0c"); // Why 115?  ;)
+  else
+    sendString("\033/Z");         // FIXME I don't think VT52 knows about it but kept for
+                                  // konsoles backward compatibility.
+}
+
+void Vt102Emulation::reportTerminalParms(int p)
+// DECREPTPARM
+{ char tmp[100];
+  sprintf(tmp,"\033[%d;1;1;112;112;1;0x",p); // not really true.
+  sendString(tmp);
+}
+
+/*!
+*/
+
+void Vt102Emulation::reportStatus()
+{
+  sendString("\033[0n"); //VT100. Device status report. 0 = Ready.
+}
+
+/*!
+*/
+
+#define ANSWER_BACK "" // This is really obsolete VT100 stuff.
+
+void Vt102Emulation::reportAnswerBack()
+{
+  sendString(ANSWER_BACK);
+}
+
+// Mouse Handling ---------------------------------------------------------- --
+
+/*!
+    Mouse clicks are possibly reported to the client
+    application if it has issued interest in them.
+    They are normally consumed by the widget for copy
+    and paste, but may be propagated from the widget
+    when gui->setMouseMarks is set via setMode(MODE_Mouse1000).
+
+    `x',`y' are 1-based.
+    `ev' (event) indicates the button pressed (0-2)
+                 or a general mouse release (3).
+
+    eventType represents the kind of mouse action that occurred:
+    	0 = Mouse button press or release
+	1 = Mouse drag
+*/
+
+void Vt102Emulation::sendMouseEvent( int cb, int cx, int cy , int eventType )
+{ char tmp[20];
+  if (  cx<1 || cy<1 ) return;
+  // normal buttons are passed as 0x20 + button,
+  // mouse wheel (buttons 4,5) as 0x5c + button
+  if (cb >= 4) cb += 0x3c;
+
+  //Mouse motion handling
+  if ( (getMode(MODE_Mouse1002) || getMode(MODE_Mouse1003)) && eventType == 1 )
+	  cb += 0x20; //add 32 to signify motion event
+
+  sprintf(tmp,"\033[M%c%c%c",cb+0x20,cx+0x20,cy+0x20);
+  sendString(tmp);
+}
+
+// Keyboard Handling ------------------------------------------------------- --
+
+#define encodeMode(M,B) BITS(B,getMode(M))
+#define encodeStat(M,B) BITS(B,((ev->modifiers() & (M)) == (M)))
+
+void Vt102Emulation::sendText( const QString& text )
+{
+  if (!text.isEmpty()) {
+    QKeyEvent event(QEvent::KeyPress, 
+                    0, 
+                    Qt::NoModifier, 
+                    text);
+    sendKeyEvent(&event); // expose as a big fat keypress event
+  }
+
+}
+
+void Vt102Emulation::sendKeyEvent( QKeyEvent* event )
+{
+    Qt::KeyboardModifiers modifiers = event->modifiers();
+    KeyboardTranslator::States states = KeyboardTranslator::NoState;
+
+    // get current states
+    if ( getMode(MODE_NewLine)  ) states |= KeyboardTranslator::NewLineState;
+    if ( getMode(MODE_Ansi)     ) states |= KeyboardTranslator::AnsiState;
+    if ( getMode(MODE_AppCuKeys)) states |= KeyboardTranslator::CursorKeysState;
+    if ( getMode(MODE_AppScreen)) states |= KeyboardTranslator::AlternateScreenState;
+
+    // lookup key binding
+    if ( _keyTranslator )
+    {
+    KeyboardTranslator::Entry entry = _keyTranslator->findEntry( 
+                                                event->key() , 
+                                                modifiers,
+                                                states );
+
+        // send result to terminal
+        QByteArray textToSend;
+
+        // special handling for the Alt (aka. Meta) modifier.  pressing
+        // Alt+[Character] results in Esc+[Character] being sent
+        // (unless there is an entry defined for this particular combination
+        //  in the keyboard modifier)
+        bool wantsAltModifier = entry.modifiers() & entry.modifierMask() & Qt::AltModifier;
+		bool wantsAnyModifier = entry.state() & entry.stateMask() & KeyboardTranslator::AnyModifierState;
+
+        if ( modifiers & Qt::AltModifier && !(wantsAltModifier || wantsAnyModifier) 
+             && !event->text().isEmpty() )
+        {
+            textToSend.prepend("\033");
+        }
+
+        if ( entry.command() != KeyboardTranslator::NoCommand )
+        {
+			if (entry.command() & KeyboardTranslator::EraseCommand)
+				textToSend += getErase();
+            // TODO command handling
+        }
+        else if ( !entry.text().isEmpty() ) 
+        {
+            textToSend += _codec->fromUnicode(entry.text(true,modifiers));
+        }
+        else
+            textToSend += _codec->fromUnicode(event->text());
+
+        sendData( textToSend.constData() , textToSend.length() );
+    }
+    else
+    {
+        // print an error message to the terminal if no key translator has been
+        // set
+        QString translatorError =  ("No keyboard translator available.  "
+                                         "The information needed to convert key presses "
+                                         "into characters to send to the terminal " 
+                                         "is missing.");
+
+        reset();
+        receiveData( translatorError.toAscii().constData() , translatorError.count() );
+    }
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                                VT100 Charsets                             */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+// Character Set Conversion ------------------------------------------------ --
+
+/* 
+   The processing contains a VT100 specific code translation layer.
+   It's still in use and mainly responsible for the line drawing graphics.
+
+   These and some other glyphs are assigned to codes (0x5f-0xfe)
+   normally occupied by the latin letters. Since this codes also
+   appear within control sequences, the extra code conversion
+   does not permute with the tokenizer and is placed behind it
+   in the pipeline. It only applies to tokens, which represent
+   plain characters.
+
+   This conversion it eventually continued in TerminalDisplay.C, since 
+   it might involve VT100 enhanced fonts, which have these
+   particular glyphs allocated in (0x00-0x1f) in their code page.
+*/
+
+#define CHARSET _charset[_currentScreen==_screen[1]]
+
+// Apply current character map.
+
+unsigned short Vt102Emulation::applyCharset(unsigned short c)
+{
+  if (CHARSET.graphic && 0x5f <= c && c <= 0x7e) return vt100_graphics[c-0x5f];
+  if (CHARSET.pound                && c == '#' ) return 0xa3; //This mode is obsolete
+  return c;
+}
+
+/*
+   "Charset" related part of the emulation state.
+   This configures the VT100 _charset filter.
+
+   While most operation work on the current _screen,
+   the following two are different.
+*/
+
+void Vt102Emulation::resetCharset(int scrno)
+{
+  _charset[scrno].cu_cs   = 0;
+  strncpy(_charset[scrno].charset,"BBBB",4);
+  _charset[scrno].sa_graphic = false;
+  _charset[scrno].sa_pound   = false;
+  _charset[scrno].graphic = false;
+  _charset[scrno].pound   = false;
+}
+
+void Vt102Emulation::setCharset(int n, int cs) // on both screens.
+{
+  _charset[0].charset[n&3] = cs; useCharset(_charset[0].cu_cs);
+  _charset[1].charset[n&3] = cs; useCharset(_charset[1].cu_cs);
+}
+
+void Vt102Emulation::setAndUseCharset(int n, int cs)
+{
+  CHARSET.charset[n&3] = cs;
+  useCharset(n&3);
+}
+
+void Vt102Emulation::useCharset(int n)
+{
+  CHARSET.cu_cs   = n&3;
+  CHARSET.graphic = (CHARSET.charset[n&3] == '0');
+  CHARSET.pound   = (CHARSET.charset[n&3] == 'A'); //This mode is obsolete
+}
+
+void Vt102Emulation::setDefaultMargins()
+{
+	_screen[0]->setDefaultMargins();
+	_screen[1]->setDefaultMargins();
+}
+
+void Vt102Emulation::setMargins(int t, int b)
+{
+  _screen[0]->setMargins(t, b);
+  _screen[1]->setMargins(t, b);
+}
+
+/*! Save the cursor position and the rendition attribute settings. */
+
+void Vt102Emulation::saveCursor()
+{
+  CHARSET.sa_graphic = CHARSET.graphic;
+  CHARSET.sa_pound   = CHARSET.pound; //This mode is obsolete
+  // we are not clear about these
+  //sa_charset = charsets[cScreen->_charset];
+  //sa_charset_num = cScreen->_charset;
+  _currentScreen->saveCursor();
+}
+
+/*! Restore the cursor position and the rendition attribute settings. */
+
+void Vt102Emulation::restoreCursor()
+{
+  CHARSET.graphic = CHARSET.sa_graphic;
+  CHARSET.pound   = CHARSET.sa_pound; //This mode is obsolete
+  _currentScreen->restoreCursor();
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                                Mode Operations                            */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/*
+   Some of the emulations state is either added to the state of the screens.
+
+   This causes some scoping problems, since different emulations choose to
+   located the mode either to the current _screen or to both.
+
+   For strange reasons, the extend of the rendition attributes ranges over
+   all screens and not over the actual _screen.
+
+   We decided on the precise precise extend, somehow.
+*/
+
+// "Mode" related part of the state. These are all booleans.
+
+void Vt102Emulation::resetModes()
+{
+  resetMode(MODE_Mouse1000); saveMode(MODE_Mouse1000);
+  resetMode(MODE_Mouse1001); saveMode(MODE_Mouse1001);
+  resetMode(MODE_Mouse1002); saveMode(MODE_Mouse1002);
+  resetMode(MODE_Mouse1003); saveMode(MODE_Mouse1003);
+
+  resetMode(MODE_AppScreen); saveMode(MODE_AppScreen);
+  // here come obsolete modes
+  resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys);
+  resetMode(MODE_NewLine  );
+    setMode(MODE_Ansi     );
+}
+
+void Vt102Emulation::setMode(int m)
+{
+  _currParm.mode[m] = true;
+  switch (m)
+  {
+    case MODE_Mouse1000:
+    case MODE_Mouse1001:
+    case MODE_Mouse1002:
+    case MODE_Mouse1003:
+ 	    emit programUsesMouseChanged(false); 
+    break;
+
+    case MODE_AppScreen : _screen[1]->clearSelection();
+                          setScreen(1);
+    break;
+  }
+  if (m < MODES_SCREEN || m == MODE_NewLine)
+  {
+    _screen[0]->setMode(m);
+    _screen[1]->setMode(m);
+  }
+}
+
+void Vt102Emulation::resetMode(int m)
+{
+  _currParm.mode[m] = false;
+  switch (m)
+  {
+    case MODE_Mouse1000 : 
+    case MODE_Mouse1001 :
+    case MODE_Mouse1002 :
+    case MODE_Mouse1003 :
+	    emit programUsesMouseChanged(true); 
+    break;
+
+    case MODE_AppScreen : _screen[0]->clearSelection();
+                          setScreen(0);
+    break;
+  }
+  if (m < MODES_SCREEN || m == MODE_NewLine)
+  {
+    _screen[0]->resetMode(m);
+    _screen[1]->resetMode(m);
+  }
+}
+
+void Vt102Emulation::saveMode(int m)
+{
+  _saveParm.mode[m] = _currParm.mode[m];
+}
+
+void Vt102Emulation::restoreMode(int m)
+{
+  if (_saveParm.mode[m]) 
+      setMode(m); 
+  else 
+      resetMode(m);
+}
+
+bool Vt102Emulation::getMode(int m)
+{
+  return _currParm.mode[m];
+}
+
+char Vt102Emulation::getErase() const
+{
+  KeyboardTranslator::Entry entry = _keyTranslator->findEntry(
+                                            Qt::Key_Backspace,
+                                            0,
+                                            0);
+  if ( entry.text().count() > 0 )
+      return entry.text()[0];
+  else
+      return '\b';
+}
+
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/*                               Diagnostic                                  */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+/*! shows the contents of the scan buffer.
+
+    This functions is used for diagnostics. It is called by \e ReportErrorToken
+    to inform about strings that cannot be decoded or handled by the emulation.
+
+    \sa ReportErrorToken
+*/
+
+static void hexdump(int* s, int len)
+{ int i;
+  for (i = 0; i < len; i++)
+  {
+    if (s[i] == '\\')
+      printf("\\\\");
+    else
+    if ((s[i]) > 32 && s[i] < 127)
+      printf("%c",s[i]);
+    else
+      printf("\\%04x(hex)",s[i]);
+  }
+}
+
+void Vt102Emulation::scan_buffer_report()
+{
+  if (ppos == 0 || ppos == 1 && (pbuf[0] & 0xff) >= 32) return;
+  printf("token: "); hexdump(pbuf,ppos); printf("\n");
+}
+
+/*!
+*/
+
+void Vt102Emulation::ReportErrorToken()
+{
+#ifndef NDEBUG
+  printf("undecodable "); scan_buffer_report();
+#endif
+}
+
+//#include "moc_Vt102Emulation.cpp"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/Vt102Emulation.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,192 @@
+/*
+    This file is part of Konsole, an X terminal.
+    
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    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 VT102EMULATION_H
+#define VT102EMULATION_H
+
+// Standard Library
+#include <stdio.h>
+
+// Qt 
+#include <QtGui/QKeyEvent>
+#include <QtCore/QHash>
+#include <QtCore/QTimer>
+
+// Konsole
+#include "Emulation.h"
+#include "Screen.h"
+
+#define MODE_AppScreen (MODES_SCREEN+0)
+#define MODE_AppCuKeys (MODES_SCREEN+1)
+#define MODE_AppKeyPad (MODES_SCREEN+2)
+#define MODE_Mouse1000 (MODES_SCREEN+3)
+#define MODE_Mouse1001 (MODES_SCREEN+4)
+#define MODE_Mouse1002 (MODES_SCREEN+5)
+#define MODE_Mouse1003 (MODES_SCREEN+6)
+#define MODE_Ansi      (MODES_SCREEN+7)
+#define MODE_total     (MODES_SCREEN+8)
+
+namespace Konsole
+{
+
+struct DECpar
+{
+  bool mode[MODE_total];
+};
+
+struct CharCodes
+{
+  // coding info
+  char charset[4]; //
+  int  cu_cs;      // actual charset.
+  bool graphic;    // Some VT100 tricks
+  bool pound  ;    // Some VT100 tricks
+  bool sa_graphic; // saved graphic
+  bool sa_pound;   // saved pound
+};
+
+/**
+ * Provides an xterm compatible terminal emulation based on the DEC VT102 terminal.
+ * A full description of this terminal can be found at http://vt100.net/docs/vt102-ug/
+ * 
+ * In addition, various additional xterm escape sequences are supported to provide 
+ * features such as mouse input handling.
+ * See http://rtfm.etla.org/xterm/ctlseq.html for a description of xterm's escape
+ * sequences. 
+ *
+ */
+class Vt102Emulation : public Emulation
+{ 
+Q_OBJECT
+
+public:
+
+  /** Constructs a new emulation */
+  Vt102Emulation();
+  ~Vt102Emulation();
+  
+  // reimplemented
+  virtual void clearEntireScreen();
+  virtual void reset();
+  
+  // reimplemented
+  virtual char getErase() const;
+  
+public slots: 
+
+  // reimplemented 
+  virtual void sendString(const char*,int length = -1);
+  virtual void sendText(const QString& text);
+  virtual void sendKeyEvent(QKeyEvent*);
+  virtual void sendMouseEvent( int buttons, int column, int line , int eventType );
+  
+protected:
+  // reimplemented
+  virtual void setMode    (int mode);
+  virtual void resetMode  (int mode);
+
+  // reimplemented 
+  virtual void receiveChar(int cc);
+  
+
+private slots:
+		
+  //causes changeTitle() to be emitted for each (int,QString) pair in pendingTitleUpdates
+  //used to buffer multiple title updates
+  void updateTitle();
+
+
+private:
+  unsigned short applyCharset(unsigned short c);
+  void setCharset(int n, int cs);
+  void useCharset(int n);
+  void setAndUseCharset(int n, int cs);
+  void saveCursor();
+  void restoreCursor();
+  void resetCharset(int scrno);
+
+  void setMargins(int top, int bottom);
+  //set margins for all screens back to their defaults
+  void setDefaultMargins();
+
+  // returns true if 'mode' is set or false otherwise
+  bool getMode    (int mode);
+  // saves the current boolean value of 'mode'
+  void saveMode   (int mode);
+  // restores the boolean value of 'mode' 
+  void restoreMode(int mode);
+  // resets all modes
+  void resetModes();
+
+  void resetToken();
+#define MAXPBUF 80
+  void pushToToken(int cc);
+  int pbuf[MAXPBUF]; //FIXME: overflow?
+  int ppos;
+#define MAXARGS 15
+  void addDigit(int dig);
+  void addArgument();
+  int argv[MAXARGS];
+  int argc;
+  void initTokenizer();
+  int tbl[256];
+
+  void scan_buffer_report(); //FIXME: rename
+  void ReportErrorToken();   //FIXME: rename
+
+  void tau(int code, int p, int q);
+  void XtermHack();
+
+  void reportTerminalType();
+  void reportSecondaryAttributes();
+  void reportStatus();
+  void reportAnswerBack();
+  void reportCursorPosition();
+  void reportTerminalParms(int p);
+
+  void onScrollLock();
+  void scrollLock(const bool lock);
+
+  // clears the screen and resizes it to the specified
+  // number of columns
+  void clearScreenAndSetColumns(int columnCount);
+
+  CharCodes _charset[2];
+
+  DECpar _currParm;
+  DECpar _saveParm;
+
+  //hash table and timer for buffering calls to the session instance 
+  //to update the name of the session
+  //or window title.
+  //these calls occur when certain escape sequences are seen in the 
+  //output from the terminal
+  QHash<int,QString> _pendingTitleUpdates;
+  QTimer* _titleUpdateTimer;
+  
+};
+
+}
+
+#endif // VT102EMULATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/default.keytab	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,128 @@
+# [README.default.Keytab] Buildin Keyboard Table
+#
+# To customize your keyboard, copy this file to something
+# ending with .keytab and change it to meet you needs.
+# Please read the README.KeyTab and the README.keyboard
+# in this case.
+#
+# --------------------------------------------------------------
+
+keyboard "Default (XFree 4)"
+
+# --------------------------------------------------------------
+#
+# Note that this particular table is a "risc" version made to
+# ease customization without bothering with obsolete details.
+# See VT100.keytab for the more hairy stuff.
+#
+# --------------------------------------------------------------
+
+# common keys
+
+key Escape             : "\E"
+
+key Tab   -Shift       : "\t"
+key Tab   +Shift+Ansi  : "\E[Z"
+key Tab   +Shift-Ansi  : "\t"
+key Backtab     +Ansi  : "\E[Z"
+key Backtab     -Ansi  : "\t"
+
+key Return-Shift-NewLine : "\r"
+key Return-Shift+NewLine : "\r\n"
+
+key Return+Shift         : "\EOM"
+
+# Backspace and Delete codes are preserving CTRL-H.
+
+key Backspace      : "\x7f"
+
+# Arrow keys in VT52 mode
+# shift up/down are reserved for scrolling.
+# shift left/right are reserved for switching between tabs (this is hardcoded).
+
+key Up   -Shift-Ansi : "\EA"
+key Down -Shift-Ansi : "\EB"
+key Right-Shift-Ansi : "\EC"
+key Left -Shift-Ansi : "\ED"
+
+# Arrow keys in ANSI mode with Application - and Normal Cursor Mode)
+
+key Up    -Shift-AnyMod+Ansi+AppCuKeys           : "\EOA"
+key Down  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOB"
+key Right -Shift-AnyMod+Ansi+AppCuKeys           : "\EOC"
+key Left  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOD"
+
+key Up    -Shift-AnyMod+Ansi-AppCuKeys           : "\E[A"
+key Down  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[B"
+key Right -Shift-AnyMod+Ansi-AppCuKeys           : "\E[C"
+key Left  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[D"
+
+key Up    -Shift+AnyMod+Ansi                     : "\E[1;*A"
+key Down  -Shift+AnyMod+Ansi                     : "\E[1;*B"
+key Right -Shift+AnyMod+Ansi                     : "\E[1;*C"
+key Left  -Shift+AnyMod+Ansi                     : "\E[1;*D"
+
+# other grey PC keys
+
+key Enter+NewLine : "\r\n"
+key Enter-NewLine : "\r"
+
+key Home        -AnyMod     -AppCuKeys           : "\E[H"  
+key End         -AnyMod     -AppCuKeys           : "\E[F"  
+key Home        -AnyMod     +AppCuKeys           : "\EOH"  
+key End         -AnyMod     +AppCuKeys           : "\EOF"  
+key Home        +AnyMod                          : "\E[1;*H"
+key End         +AnyMod                          : "\E[1;*F"
+
+key Insert      -AnyMod                          : "\E[2~"
+key Delete      -AnyMod                          : "\E[3~"
+key Insert      +AnyMod                          : "\E[2;*~"
+key Delete      +AnyMod                          : "\E[3;*~"
+
+key Prior -Shift-AnyMod                          : "\E[5~"
+key Next  -Shift-AnyMod                          : "\E[6~"
+key Prior -Shift+AnyMod                          : "\E[5;*~"
+key Next  -Shift+AnyMod                          : "\E[6;*~"
+
+# Function keys
+key F1          -AnyMod                          : "\EOP"
+key F2          -AnyMod                          : "\EOQ"
+key F3          -AnyMod                          : "\EOR"
+key F4          -AnyMod                          : "\EOS"
+key F5          -AnyMod                          : "\E[15~"
+key F6          -AnyMod                          : "\E[17~"
+key F7          -AnyMod                          : "\E[18~"
+key F8          -AnyMod                          : "\E[19~"
+key F9          -AnyMod                          : "\E[20~"
+key F10         -AnyMod                          : "\E[21~"
+key F11         -AnyMod                          : "\E[23~"
+key F12         -AnyMod                          : "\E[24~"
+
+key F1          +AnyMod                          : "\EO*P"
+key F2          +AnyMod                          : "\EO*Q"
+key F3          +AnyMod                          : "\EO*R"
+key F4          +AnyMod                          : "\EO*S"
+key F5          +AnyMod                          : "\E[15;*~"
+key F6          +AnyMod                          : "\E[17;*~"
+key F7          +AnyMod                          : "\E[18;*~"
+key F8          +AnyMod                          : "\E[19;*~"
+key F9          +AnyMod                          : "\E[20;*~"
+key F10         +AnyMod                          : "\E[21;*~"
+key F11         +AnyMod                          : "\E[23;*~"
+key F12         +AnyMod                          : "\E[24;*~"
+
+# Work around dead keys
+
+key Space +Control : "\x00"
+
+# Some keys are used by konsole to cause operations.
+# The scroll* operations refer to the history buffer.
+
+key Up    +Shift-AppScreen  : scrollLineUp
+key Prior +Shift-AppScreen  : scrollPageUp
+key Down  +Shift-AppScreen  : scrollLineDown
+key Next  +Shift-AppScreen  : scrollPageDown
+
+key ScrollLock     : scrollLock
+
+# keypad characters are not offered differently by Qt.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/k3process.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1053 @@
+/*
+   This file is part of the KDE libraries
+   Copyright (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at)
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+
+#include "k3process.h"
+//#include <config.h>
+
+#include "k3processcontroller.h"
+#include "kpty.h"
+
+#ifdef __osf__
+#define _OSF_SOURCE
+#include <float.h>
+#endif
+
+#ifdef _AIX
+#define _ALL_SOURCE
+#endif
+
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#include <errno.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <time.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
+
+#include <QtCore/QMap>
+#include <QtCore/QFile>
+#include <QtCore/QSocketNotifier>
+
+//#include <kdebug.h>
+//#include <kstandarddirs.h>
+//#include <kuser.h>
+
+
+//////////////////
+// private data //
+//////////////////
+
+class K3ProcessPrivate {
+public:
+   K3ProcessPrivate() :
+     usePty(K3Process::NoCommunication),
+     addUtmp(false), useShell(false),
+     pty(0),
+     priority(0)
+   {
+   }
+
+   K3Process::Communication usePty;
+   bool addUtmp : 1;
+   bool useShell : 1;
+
+   KPty *pty;
+
+   int priority;
+
+   QMap<QString,QString> env;
+   QString wd;
+   QByteArray shell;
+   QByteArray executable;
+};
+
+/////////////////////////////
+// public member functions //
+/////////////////////////////
+
+K3Process::K3Process( QObject* parent )
+  : QObject( parent ),
+    run_mode(NotifyOnExit),
+    runs(false),
+    pid_(0),
+    status(0),
+    keepPrivs(false),
+    innot(0),
+    outnot(0),
+    errnot(0),
+    communication(NoCommunication),
+    input_data(0),
+    input_sent(0),
+    input_total(0),
+	 d(new K3ProcessPrivate)
+{
+  K3ProcessController::ref();
+  K3ProcessController::instance()->addKProcess(this);
+
+
+  out[0] = out[1] = -1;
+  in[0] = in[1] = -1;
+  err[0] = err[1] = -1;
+}
+
+void
+K3Process::setEnvironment(const QString &name, const QString &value)
+{
+   d->env.insert(name, value);
+}
+
+void
+K3Process::setWorkingDirectory(const QString &dir)
+{
+   d->wd = dir;
+}
+
+void
+K3Process::setupEnvironment()
+{
+   QMap<QString,QString>::Iterator it;
+   for(it = d->env.begin(); it != d->env.end(); ++it)
+   {
+      setenv(QFile::encodeName(it.key()).data(),
+             QFile::encodeName(it.value()).data(), 1);
+   }
+   if (!d->wd.isEmpty())
+   {
+      chdir(QFile::encodeName(d->wd).data());
+   }
+}
+
+void
+K3Process::setRunPrivileged(bool keepPrivileges)
+{
+   keepPrivs = keepPrivileges;
+}
+
+bool
+K3Process::runPrivileged() const
+{
+   return keepPrivs;
+}
+
+bool
+K3Process::setPriority(int prio)
+{
+    if (runs) {
+        if (setpriority(PRIO_PROCESS, pid_, prio))
+            return false;
+    } else {
+        if (prio > 19 || prio < (geteuid() ? getpriority(PRIO_PROCESS, 0) : -20))
+            return false;
+    }
+    d->priority = prio;
+    return true;
+}
+
+K3Process::~K3Process()
+{
+  if (run_mode != DontCare)
+    kill(SIGKILL);
+  detach();
+
+  delete d->pty;
+  delete d;
+
+  K3ProcessController::instance()->removeKProcess(this);
+  K3ProcessController::deref();
+}
+
+void K3Process::detach()
+{
+  if (runs) {
+    K3ProcessController::instance()->addProcess(pid_);
+    runs = false;
+    pid_ = 0; // close without draining
+    commClose(); // Clean up open fd's and socket notifiers.
+  }
+}
+
+void K3Process::setBinaryExecutable(const char *filename)
+{
+   d->executable = filename;
+}
+
+K3Process &K3Process::operator<<(const QStringList& args)
+{
+  QStringList::ConstIterator it = args.begin();
+  for ( ; it != args.end() ; ++it )
+      arguments.append(QFile::encodeName(*it));
+  return *this;
+}
+
+K3Process &K3Process::operator<<(const QByteArray& arg)
+{
+  return operator<< (arg.data());
+}
+
+K3Process &K3Process::operator<<(const char* arg)
+{
+  arguments.append(arg);
+  return *this;
+}
+
+K3Process &K3Process::operator<<(const QString& arg)
+{
+  arguments.append(QFile::encodeName(arg));
+  return *this;
+}
+
+void K3Process::clearArguments()
+{
+  arguments.clear();
+}
+
+bool K3Process::start(RunMode runmode, Communication comm)
+{
+  if (runs) {
+    qDebug() << "Attempted to start an already running process" << endl;
+    return false;
+  }
+
+  uint n = arguments.count();
+  if (n == 0) {
+    qDebug() << "Attempted to start a process without arguments" << endl;
+    return false;
+  }
+  char **arglist;
+  QByteArray shellCmd;
+  if (d->useShell)
+  {
+      if (d->shell.isEmpty()) {
+        qDebug() << "Invalid shell specified" << endl;
+        return false;
+      }
+
+      for (uint i = 0; i < n; i++) {
+          shellCmd += arguments[i];
+          shellCmd += ' '; // CC: to separate the arguments
+      }
+
+      arglist = static_cast<char **>(malloc( 4 * sizeof(char *)));
+      arglist[0] = d->shell.data();
+      arglist[1] = (char *) "-c";
+      arglist[2] = shellCmd.data();
+      arglist[3] = 0;
+  }
+  else
+  {
+      arglist = static_cast<char **>(malloc( (n + 1) * sizeof(char *)));
+      for (uint i = 0; i < n; i++)
+         arglist[i] = arguments[i].data();
+      arglist[n] = 0;
+  }
+
+  run_mode = runmode;
+
+  if (!setupCommunication(comm))
+  {
+      qDebug() << "Could not setup Communication!" << endl;
+      free(arglist);
+      return false;
+  }
+
+  // We do this in the parent because if we do it in the child process
+  // gdb gets confused when the application runs from gdb.
+#ifdef HAVE_INITGROUPS
+  struct passwd *pw = geteuid() ? 0 : getpwuid(getuid());
+#endif
+
+  int fd[2];
+  if (pipe(fd))
+     fd[0] = fd[1] = -1; // Pipe failed.. continue
+
+  // we don't use vfork() because
+  // - it has unclear semantics and is not standardized
+  // - we do way too much magic in the child
+  pid_ = fork();
+  if (pid_ == 0) {
+        // The child process
+
+        close(fd[0]);
+        // Closing of fd[1] indicates that the execvp() succeeded!
+        fcntl(fd[1], F_SETFD, FD_CLOEXEC);
+
+        if (!commSetupDoneC())
+          qDebug() << "Could not finish comm setup in child!" << endl;
+
+        // reset all signal handlers
+        struct sigaction act;
+        sigemptyset(&act.sa_mask);
+        act.sa_handler = SIG_DFL;
+        act.sa_flags = 0;
+        for (int sig = 1; sig < NSIG; sig++)
+          sigaction(sig, &act, 0L);
+
+        if (d->priority)
+            setpriority(PRIO_PROCESS, 0, d->priority);
+
+        if (!runPrivileged())
+        {
+           setgid(getgid());
+#ifdef HAVE_INITGROUPS
+           if (pw)
+              initgroups(pw->pw_name, pw->pw_gid);
+#endif
+	   if (geteuid() != getuid())
+	       setuid(getuid());
+	   if (geteuid() != getuid())
+	       _exit(1);
+        }
+
+        setupEnvironment();
+
+        if (runmode == DontCare || runmode == OwnGroup)
+          setsid();
+
+        const char *executable = arglist[0];
+        if (!d->executable.isEmpty())
+           executable = d->executable.data();
+        execvp(executable, arglist);
+
+        char resultByte = 1;
+        write(fd[1], &resultByte, 1);
+        _exit(-1);
+  } else if (pid_ == -1) {
+        // forking failed
+
+        // commAbort();
+        pid_ = 0;
+        free(arglist);
+        return false;
+  }
+  // the parent continues here
+  free(arglist);
+
+  if (!commSetupDoneP())
+    qDebug() << "Could not finish comm setup in parent!" << endl;
+
+  // Check whether client could be started.
+  close(fd[1]);
+  for(;;)
+  {
+     char resultByte;
+     int n = ::read(fd[0], &resultByte, 1);
+     if (n == 1)
+     {
+         // exec() failed
+         close(fd[0]);
+         waitpid(pid_, 0, 0);
+         pid_ = 0;
+         commClose();
+         return false;
+     }
+     if (n == -1)
+     {
+        if (errno == EINTR)
+           continue; // Ignore
+     }
+     break; // success
+  }
+  close(fd[0]);
+
+  runs = true;
+  switch (runmode)
+  {
+  case Block:
+    for (;;)
+    {
+      commClose(); // drain only, unless obsolete reimplementation
+      if (!runs)
+      {
+        // commClose detected data on the process exit notifification pipe
+        K3ProcessController::instance()->unscheduleCheck();
+        if (waitpid(pid_, &status, WNOHANG) != 0) // error finishes, too
+        {
+          commClose(); // this time for real (runs is false)
+          K3ProcessController::instance()->rescheduleCheck();
+          break;
+        }
+        runs = true; // for next commClose() iteration
+      }
+      else
+      {
+        // commClose is an obsolete reimplementation and waited until
+        // all output channels were closed (or it was interrupted).
+        // there is a chance that it never gets here ...
+        waitpid(pid_, &status, 0);
+        runs = false;
+        break;
+      }
+    }
+    // why do we do this? i think this signal should be emitted _only_
+    // after the process has successfully run _asynchronously_ --ossi
+    emit processExited(this);
+    break;
+  default: // NotifyOnExit & OwnGroup
+    input_data = 0; // Discard any data for stdin that might still be there
+    break;
+  }
+  return true;
+}
+
+
+
+bool K3Process::kill(int signo)
+{
+  if (runs && pid_ > 0 && !::kill(run_mode == OwnGroup ? -pid_ : pid_, signo))
+    return true;
+  return false;
+}
+
+
+
+bool K3Process::isRunning() const
+{
+  return runs;
+}
+
+
+
+pid_t K3Process::pid() const
+{
+  return pid_;
+}
+
+#ifndef timersub
+# define timersub(a, b, result) \
+  do { \
+    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+    if ((result)->tv_usec < 0) { \
+      --(result)->tv_sec; \
+      (result)->tv_usec += 1000000; \
+    } \
+  } while (0)
+#endif
+
+bool K3Process::wait(int timeout)
+{
+  if (!runs)
+    return true;
+
+#ifndef __linux__
+  struct timeval etv;
+#endif
+  struct timeval tv, *tvp;
+  if (timeout < 0)
+    tvp = 0;
+  else
+  {
+#ifndef __linux__
+    gettimeofday(&etv, 0);
+    etv.tv_sec += timeout;
+#else
+    tv.tv_sec = timeout;
+    tv.tv_usec = 0;
+#endif
+    tvp = &tv;
+  }
+
+  int fd = K3ProcessController::instance()->notifierFd();
+  for(;;)
+  {
+    fd_set fds;
+    FD_ZERO( &fds );
+    FD_SET( fd, &fds );
+
+#ifndef __linux__
+    if (tvp)
+    {
+      gettimeofday(&tv, 0);
+      timersub(&etv, &tv, &tv);
+      if (tv.tv_sec < 0)
+        tv.tv_sec = tv.tv_usec = 0;
+    }
+#endif
+
+    switch( select( fd+1, &fds, 0, 0, tvp ) )
+    {
+    case -1:
+      if( errno == EINTR )
+        break;
+      // fall through; should happen if tvp->tv_sec < 0
+    case 0:
+      K3ProcessController::instance()->rescheduleCheck();
+      return false;
+    default:
+      K3ProcessController::instance()->unscheduleCheck();
+      if (waitpid(pid_, &status, WNOHANG) != 0) // error finishes, too
+      {
+        processHasExited(status);
+        K3ProcessController::instance()->rescheduleCheck();
+        return true;
+      }
+    }
+  }
+  return false;
+}
+
+
+
+bool K3Process::normalExit() const
+{
+  return (pid_ != 0) && !runs && WIFEXITED(status);
+}
+
+
+bool K3Process::signalled() const
+{
+  return (pid_ != 0) && !runs && WIFSIGNALED(status);
+}
+
+
+bool K3Process::coreDumped() const
+{
+#ifdef WCOREDUMP
+  return signalled() && WCOREDUMP(status);
+#else
+  return false;
+#endif
+}
+
+
+int K3Process::exitStatus() const
+{
+  return WEXITSTATUS(status);
+}
+
+
+int K3Process::exitSignal() const
+{
+  return WTERMSIG(status);
+}
+
+
+bool K3Process::writeStdin(const char *buffer, int buflen)
+{
+  // if there is still data pending, writing new data
+  // to stdout is not allowed (since it could also confuse
+  // kprocess ...)
+  if (input_data != 0)
+    return false;
+
+  if (communication & Stdin) {
+    input_data = buffer;
+    input_sent = 0;
+    input_total = buflen;
+    innot->setEnabled(true);
+    if (input_total)
+       slotSendData(0);
+    return true;
+  } else
+    return false;
+}
+
+void K3Process::suspend()
+{
+  if (outnot)
+     outnot->setEnabled(false);
+}
+
+void K3Process::resume()
+{
+  if (outnot)
+     outnot->setEnabled(true);
+}
+
+bool K3Process::closeStdin()
+{
+  if (communication & Stdin) {
+    communication = communication & ~Stdin;
+    delete innot;
+    innot = 0;
+    if (!(d->usePty & Stdin))
+      close(in[1]);
+    in[1] = -1;
+    return true;
+  } else
+    return false;
+}
+
+bool K3Process::closeStdout()
+{
+  if (communication & Stdout) {
+    communication = communication & ~Stdout;
+    delete outnot;
+    outnot = 0;
+    if (!(d->usePty & Stdout))
+      close(out[0]);
+    out[0] = -1;
+    return true;
+  } else
+    return false;
+}
+
+bool K3Process::closeStderr()
+{
+  if (communication & Stderr) {
+    communication = communication & ~Stderr;
+    delete errnot;
+    errnot = 0;
+    if (!(d->usePty & Stderr))
+      close(err[0]);
+    err[0] = -1;
+    return true;
+  } else
+    return false;
+}
+
+bool K3Process::closePty()
+{
+  if (d->pty && d->pty->masterFd() >= 0) {
+    if (d->addUtmp)
+      d->pty->logout();
+    d->pty->close();
+    return true;
+  } else
+    return false;
+}
+
+void K3Process::closeAll()
+{
+  closeStdin();
+  closeStdout();
+  closeStderr();
+  closePty();
+}
+
+/////////////////////////////
+// protected slots         //
+/////////////////////////////
+
+
+
+void K3Process::slotChildOutput(int fdno)
+{
+  if (!childOutput(fdno))
+     closeStdout();
+}
+
+
+void K3Process::slotChildError(int fdno)
+{
+  if (!childError(fdno))
+     closeStderr();
+}
+
+
+void K3Process::slotSendData(int)
+{
+  if (input_sent == input_total) {
+    innot->setEnabled(false);
+    input_data = 0;
+    emit wroteStdin(this);
+  } else {
+    int result = ::write(in[1], input_data+input_sent, input_total-input_sent);
+    if (result >= 0)
+    {
+       input_sent += result;
+    }
+    else if ((errno != EAGAIN) && (errno != EINTR))
+    {
+       qDebug() << "Error writing to stdin of child process" << endl;
+       closeStdin();
+    }
+  }
+}
+
+void K3Process::setUseShell(bool useShell, const char *shell)
+{
+  d->useShell = useShell;
+  if (shell && *shell)
+    d->shell = shell;
+  else
+// #ifdef NON_FREE // ... as they ship non-POSIX /bin/sh
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__GNU__) && !defined(__DragonFly__)
+  // Solaris POSIX ...
+  if (!access( "/usr/xpg4/bin/sh", X_OK ))
+    d->shell = "/usr/xpg4/bin/sh";
+  else
+  // ... which links here anyway
+  if (!access( "/bin/ksh", X_OK ))
+    d->shell = "/bin/ksh";
+  else
+  // dunno, maybe superfluous?
+  if (!access( "/usr/ucb/sh", X_OK ))
+    d->shell = "/usr/ucb/sh";
+  else
+#endif
+    d->shell = "/bin/sh";
+}
+
+void K3Process::setUsePty(Communication usePty, bool addUtmp)
+{
+  d->usePty = usePty;
+  d->addUtmp = addUtmp;
+  if (usePty) {
+    if (!d->pty)
+      d->pty = new KPty;
+  } else {
+    delete d->pty;
+    d->pty = 0;
+  }
+}
+
+KPty *K3Process::pty() const
+{
+  return d->pty;
+}
+
+QString K3Process::quote(const QString &arg)
+{
+    QChar q('\'');
+    return QString(arg).replace(q, "'\\''").prepend(q).append(q);
+}
+
+
+//////////////////////////////
+// private member functions //
+//////////////////////////////
+
+
+void K3Process::processHasExited(int state)
+{
+    // only successfully run NotifyOnExit processes ever get here
+
+    status = state;
+    runs = false; // do this before commClose, so it knows we're dead
+
+    commClose(); // cleanup communication sockets
+
+    if (run_mode != DontCare)
+      emit processExited(this);
+}
+
+
+
+int K3Process::childOutput(int fdno)
+{
+  if (communication & NoRead) {
+     int len = -1;
+     emit receivedStdout(fdno, len);
+     errno = 0; // Make sure errno doesn't read "EAGAIN"
+     return len;
+  }
+  else
+  {
+     char buffer[1025];
+     int len;
+
+     len = ::read(fdno, buffer, 1024);
+
+     if (len > 0) {
+        buffer[len] = 0; // Just in case.
+        emit receivedStdout(this, buffer, len);
+     }
+     return len;
+  }
+}
+
+int K3Process::childError(int fdno)
+{
+  char buffer[1025];
+  int len;
+
+  len = ::read(fdno, buffer, 1024);
+
+  if (len > 0) {
+     buffer[len] = 0; // Just in case.
+     emit receivedStderr(this, buffer, len);
+  }
+  return len;
+}
+
+
+int K3Process::setupCommunication(Communication comm)
+{
+  // PTY stuff //
+  if (d->usePty)
+  {
+    // cannot communicate on both stderr and stdout if they are both on the pty
+    if (!(~(comm & d->usePty) & (Stdout | Stderr))) {
+       qWarning() << "Invalid usePty/communication combination (" << d->usePty << "/" << comm << ")" << endl;
+       return 0;
+    }
+    if (!d->pty->open())
+       return 0;
+
+    int rcomm = comm & d->usePty;
+    int mfd = d->pty->masterFd();
+    if (rcomm & Stdin)
+      in[1] = mfd;
+    if (rcomm & Stdout)
+      out[0] = mfd;
+    if (rcomm & Stderr)
+      err[0] = mfd;
+  }
+
+  communication = comm;
+
+  comm = comm & ~d->usePty;
+  if (comm & Stdin) {
+    if (socketpair(AF_UNIX, SOCK_STREAM, 0, in))
+      goto fail0;
+    fcntl(in[0], F_SETFD, FD_CLOEXEC);
+    fcntl(in[1], F_SETFD, FD_CLOEXEC);
+  }
+  if (comm & Stdout) {
+    if (socketpair(AF_UNIX, SOCK_STREAM, 0, out))
+      goto fail1;
+    fcntl(out[0], F_SETFD, FD_CLOEXEC);
+    fcntl(out[1], F_SETFD, FD_CLOEXEC);
+  }
+  if (comm & Stderr) {
+    if (socketpair(AF_UNIX, SOCK_STREAM, 0, err))
+      goto fail2;
+    fcntl(err[0], F_SETFD, FD_CLOEXEC);
+    fcntl(err[1], F_SETFD, FD_CLOEXEC);
+  }
+  return 1; // Ok
+ fail2:
+  if (comm & Stdout)
+  {
+    close(out[0]);
+    close(out[1]);
+    out[0] = out[1] = -1;
+  }
+ fail1:
+  if (comm & Stdin)
+  {
+    close(in[0]);
+    close(in[1]);
+    in[0] = in[1] = -1;
+  }
+ fail0:
+  communication = NoCommunication;
+  return 0; // Error
+}
+
+
+
+int K3Process::commSetupDoneP()
+{
+  int rcomm = communication & ~d->usePty;
+  if (rcomm & Stdin)
+    close(in[0]);
+  if (rcomm & Stdout)
+    close(out[1]);
+  if (rcomm & Stderr)
+    close(err[1]);
+  in[0] = out[1] = err[1] = -1;
+
+  // Don't create socket notifiers if no interactive comm is to be expected
+  if (run_mode != NotifyOnExit && run_mode != OwnGroup)
+    return 1;
+
+  if (communication & Stdin) {
+    fcntl(in[1], F_SETFL, O_NONBLOCK | fcntl(in[1], F_GETFL));
+    innot =  new QSocketNotifier(in[1], QSocketNotifier::Write, this);
+    Q_CHECK_PTR(innot);
+    innot->setEnabled(false); // will be enabled when data has to be sent
+    QObject::connect(innot, SIGNAL(activated(int)),
+                     this, SLOT(slotSendData(int)));
+  }
+
+  if (communication & Stdout) {
+    outnot = new QSocketNotifier(out[0], QSocketNotifier::Read, this);
+    Q_CHECK_PTR(outnot);
+    QObject::connect(outnot, SIGNAL(activated(int)),
+                     this, SLOT(slotChildOutput(int)));
+    if (communication & NoRead)
+        suspend();
+  }
+
+  if (communication & Stderr) {
+    errnot = new QSocketNotifier(err[0], QSocketNotifier::Read, this );
+    Q_CHECK_PTR(errnot);
+    QObject::connect(errnot, SIGNAL(activated(int)),
+                     this, SLOT(slotChildError(int)));
+  }
+
+  return 1;
+}
+
+
+
+int K3Process::commSetupDoneC()
+{
+  int ok = 1;
+  if (d->usePty & Stdin) {
+    if (dup2(d->pty->slaveFd(), STDIN_FILENO) < 0) ok = 0;
+  } else if (communication & Stdin) {
+    if (dup2(in[0], STDIN_FILENO) < 0) ok = 0;
+  } else {
+    int null_fd = open( "/dev/null", O_RDONLY );
+    if (dup2( null_fd, STDIN_FILENO ) < 0) ok = 0;
+    close( null_fd );
+  }
+  struct linger so;
+  memset(&so, 0, sizeof(so));
+  if (d->usePty & Stdout) {
+    if (dup2(d->pty->slaveFd(), STDOUT_FILENO) < 0) ok = 0;
+  } else if (communication & Stdout) {
+    if (dup2(out[1], STDOUT_FILENO) < 0 ||
+        setsockopt(out[1], SOL_SOCKET, SO_LINGER, (char *)&so, sizeof(so)))
+      ok = 0;
+    if (communication & MergedStderr) {
+      if (dup2(out[1], STDERR_FILENO) < 0)
+        ok = 0;
+    }
+  }
+  if (d->usePty & Stderr) {
+    if (dup2(d->pty->slaveFd(), STDERR_FILENO) < 0) ok = 0;
+  } else if (communication & Stderr) {
+    if (dup2(err[1], STDERR_FILENO) < 0 ||
+        setsockopt(err[1], SOL_SOCKET, SO_LINGER, (char *)&so, sizeof(so)))
+      ok = 0;
+  }
+
+  // don't even think about closing all open fds here or anywhere else
+
+  // PTY stuff //
+  if (d->usePty) {
+    d->pty->setCTty();
+    if (d->addUtmp)
+      d->pty->login(getenv("USER"), getenv("DISPLAY"));
+  }
+
+  return ok;
+}
+
+
+
+void K3Process::commClose()
+{
+  closeStdin();
+
+  if (pid_) { // detached, failed, and killed processes have no output. basta. :)
+    // If both channels are being read we need to make sure that one socket
+    // buffer doesn't fill up whilst we are waiting for data on the other
+    // (causing a deadlock). Hence we need to use select.
+
+    int notfd = K3ProcessController::instance()->notifierFd();
+
+    while ((communication & (Stdout | Stderr)) || runs) {
+      fd_set rfds;
+      FD_ZERO(&rfds);
+      struct timeval timeout, *p_timeout;
+
+      int max_fd = 0;
+      if (communication & Stdout) {
+        FD_SET(out[0], &rfds);
+        max_fd = out[0];
+      }
+      if (communication & Stderr) {
+        FD_SET(err[0], &rfds);
+        if (err[0] > max_fd)
+          max_fd = err[0];
+      }
+      if (runs) {
+        FD_SET(notfd, &rfds);
+        if (notfd > max_fd)
+          max_fd = notfd;
+        // If the process is still running we block until we
+        // receive data or the process exits.
+        p_timeout = 0; // no timeout
+      } else {
+        // If the process has already exited, we only check
+        // the available data, we don't wait for more.
+        timeout.tv_sec = timeout.tv_usec = 0; // timeout immediately
+        p_timeout = &timeout;
+      }
+
+      int fds_ready = select(max_fd+1, &rfds, 0, 0, p_timeout);
+      if (fds_ready < 0) {
+        if (errno == EINTR)
+          continue;
+        break;
+      } else if (!fds_ready)
+        break;
+
+      if ((communication & Stdout) && FD_ISSET(out[0], &rfds))
+        slotChildOutput(out[0]);
+
+      if ((communication & Stderr) && FD_ISSET(err[0], &rfds))
+        slotChildError(err[0]);
+
+      if (runs && FD_ISSET(notfd, &rfds)) {
+        runs = false; // hack: signal potential exit
+        return; // don't close anything, we will be called again
+      }
+    }
+  }
+
+  closeStdout();
+  closeStderr();
+
+  closePty();
+}
+
+
+
+///////////////////////////
+// CC: Class K3ShellProcess
+///////////////////////////
+
+K3ShellProcess::K3ShellProcess(const char *shellname):
+  K3Process(), d(0)
+{
+  setUseShell( true, shellname ? shellname : getenv("SHELL") );
+}
+
+K3ShellProcess::~K3ShellProcess() {
+}
+
+QString K3ShellProcess::quote(const QString &arg)
+{
+    return K3Process::quote(arg);
+}
+
+bool K3ShellProcess::start(RunMode runmode, Communication comm)
+{
+  return K3Process::start(runmode, comm);
+}
+
+
+//#include "moc_k3process.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/k3process.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,890 @@
+/* This file is part of the KDE libraries
+    Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at)
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef K3PROCESS_H
+#define K3PROCESS_H
+
+#include <QtCore/QObject>
+
+#include <sys/types.h> // for pid_t
+#include <sys/wait.h>
+#include <signal.h>
+#include <unistd.h>
+
+class QSocketNotifier;
+class K3ProcessPrivate;
+class KPty;
+
+/**
+ * @obsolete Use KProcess and KPtyProcess instead.
+ *
+ * Child process invocation, monitoring and control.
+ * This class works only in the application's main thread.
+ *
+ * <b>General usage and features:</b>\n
+ *
+ * This class allows a KDE application to start child processes without having
+ * to worry about UN*X signal handling issues and zombie process reaping.
+ *
+ * @see K3ProcIO
+ *
+ * Basically, this class distinguishes three different ways of running
+ * child processes:
+ *
+ * @li  DontCare -- The child process is invoked and both the child
+ * process and the parent process continue concurrently.
+ *
+ * The process is started in an own session (see setsid(2)).
+ *
+ * @li  NotifyOnExit -- The child process is invoked and both the
+ * child and the parent process run concurrently.
+ *
+ * When the child process exits, the K3Process instance
+ * corresponding to it emits the Qt signal processExited().
+ * Since this signal is @em not emitted from within a UN*X
+ * signal handler, arbitrary function calls can be made.
+ *
+ * Be aware: When the K3Process object gets destructed, the child
+ * process will be killed if it is still running!
+ * This means in particular, that it usually makes no sense to use
+ * a K3Process on the stack with NotifyOnExit.
+ *
+ * @li  OwnGroup -- like NotifyOnExit, but the child process is started
+ * in an own process group (and an own session, FWIW). The behavior of
+ * kill() changes to killing the whole process group - this makes
+ * this mode useful for implementing primitive job management. It can be
+ * used to work around broken wrapper scripts that don't propagate signals
+ * to the "real" program. However, use this with care, as you disturb the
+ * shell's job management if your program is started from the command line.
+ *
+ * @li  Block -- The child process starts and the parent process
+ * is suspended until the child process exits. (@em Really not recommended
+ * for programs with a GUI.)
+ * In this mode the parent can read the child's output, but can't send it any
+ * input.
+ *
+ * K3Process also provides several functions for determining the exit status
+ * and the pid of the child process it represents.
+ *
+ * Furthermore it is possible to supply command-line arguments to the process
+ * in a clean fashion (no null-terminated stringlists and such...)
+ *
+ * A small usage example:
+ * \code
+ *   K3Process *proc = new K3Process;
+ *
+ *   *proc << "my_executable";
+ *   *proc << "These" << "are" << "the" << "command" << "line" << "args";
+ *   QApplication::connect(proc, SIGNAL(processExited(K3Process *)),
+ *                         pointer_to_my_object, SLOT(my_objects_slot(K3Process *)));
+ *   proc->start();
+ * \endcode
+ *
+ * This will start "my_executable" with the commandline arguments "These"...
+ *
+ * When the child process exits, the slot will be invoked.
+ *
+ * <b>Communication with the child process:</b>\n
+ *
+ * K3Process supports communication with the child process through
+ * stdin/stdout/stderr.
+ *
+ * The following functions are provided for getting data from the child
+ * process or sending data to the child's stdin (For more information,
+ * have a look at the documentation of each function):
+ *
+ * @li writeStdin()
+ *  -- Transmit data to the child process' stdin. When all data was sent, the
+ * signal wroteStdin() is emitted.
+ *
+ * @li When data arrives at stdout or stderr, the signal receivedStdout()
+ * resp. receivedStderr() is emitted.
+ *
+ * @li You can shut down individual communication channels with
+ * closeStdin(), closeStdout(), and closeStderr(), resp.
+ *
+ * @author Christian Czezatke e9025461@student.tuwien.ac.at
+ *
+ **/
+class K3Process : public QObject
+{
+  Q_OBJECT
+
+public:
+
+  /**
+   * Modes in which the communication channels can be opened.
+   *
+   * If communication for more than one channel is required,
+   * the values should be or'ed together, for example to get
+   * communication with stdout as well as with stdin, you would
+   * specify @p Stdin | @p Stdout
+   *
+   */
+  enum CommunicationFlag {
+       NoCommunication = 0, /**< No communication with the process. */
+       Stdin = 1, /**< Connect to write to the process with writeStdin(). */
+       Stdout = 2, /**< Connect to read from the process' output. */
+       Stderr = 4, /**< Connect to read from the process' stderr. */
+       AllOutput = 6, /**< Connects to all output channels. */
+       All = 7, /**< Connects to all channels. */
+       NoRead = 8, /**< If specified with Stdout, no data is actually read from stdout,
+                    * only the signal receivedStdout(int fd, int &len) is emitted. */
+       CTtyOnly = NoRead, /**< Tells setUsePty() to create a PTY for the process
+                           * and make it the process' controlling TTY, but does not
+                           * redirect any I/O channel to the PTY. */
+       MergedStderr = 16  /**< If specified with Stdout, the process' stderr will be
+                           * redirected onto the same file handle as its stdout, i.e.,
+                           * all error output will be signalled with receivedStdout().
+                           * Don't specify Stderr if you specify MergedStderr. */
+  };
+
+  Q_DECLARE_FLAGS(Communication, CommunicationFlag)
+
+  /**
+   * Run-modes for a child process.
+   */
+  enum RunMode {
+      /**
+       * The application does not receive notifications from the subprocess when
+       * it is finished or aborted.
+       */
+       DontCare,
+       /**
+        * The application is notified when the subprocess dies.
+        */
+       NotifyOnExit,
+       /**
+        * The application is suspended until the started process is finished.
+        */
+       Block,
+       /**
+        * Same as NotifyOnExit, but the process is run in an own session,
+        * just like with DontCare.
+        */
+       OwnGroup
+  };
+
+  /**
+   * Constructor
+   */
+  explicit K3Process( QObject* parent=0L );
+
+  /**
+   *Destructor:
+   *
+   *  If the process is running when the destructor for this class
+   *  is called, the child process is killed with a SIGKILL, but
+   *  only if the run mode is not of type @p DontCare.
+   *  Processes started as @p DontCare keep running anyway.
+  */
+  virtual ~K3Process();
+
+  /**
+   * Sets the executable and the command line argument list for this process.
+   *
+   * For example, doing an "ls -l /usr/local/bin" can be achieved by:
+   *  \code
+   *  K3Process p;
+   *  ...
+   *  p << "ls" << "-l" << "/usr/local/bin"
+   *  \endcode
+   *
+   * @param arg the argument to add
+   * @return a reference to this K3Process
+   **/
+  K3Process &operator<<(const QString& arg);
+  /**
+   * Similar to previous method, takes a char *, supposed to be in locale 8 bit already.
+   */
+  K3Process &operator<<(const char * arg);
+  /**
+   * Similar to previous method, takes a QByteArray, supposed to be in locale 8 bit already.
+   * @param arg the argument to add
+   * @return a reference to this K3Process
+   */
+  K3Process &operator<<(const QByteArray & arg);
+
+  /**
+   * Sets the executable and the command line argument list for this process,
+   * in a single method call, or add a list of arguments.
+   * @param args the arguments to add
+   * @return a reference to this K3Process
+   **/
+  K3Process &operator<<(const QStringList& args);
+
+  /**
+   * Clear a command line argument list that has been set by using
+   * operator<<.
+  */
+  void clearArguments();
+
+  /**
+   *  Starts the process.
+   *  For a detailed description of the
+   *  various run modes and communication semantics, have a look at the
+   *  general description of the K3Process class. Note that if you use
+   * setUsePty( Stdout | Stderr, \<bool\> ), you cannot use Stdout | Stderr
+   *  here - instead, use Stdout only to receive the mixed output.
+   *
+   *  The following problems could cause this function to
+   *    return false:
+   *
+   *  @li The process is already running.
+   *  @li The command line argument list is empty.
+   *  @li The the @p comm parameter is incompatible with the selected pty usage.
+   *  @li The starting of the process failed (could not fork).
+   *  @li The executable was not found.
+   *
+   *  @param runmode The Run-mode for the process.
+   *  @param comm  Specifies which communication channels should be
+   *  established to the child process (stdin/stdout/stderr). By default,
+   *  no communication takes place and the respective communication
+   *  signals will never get emitted.
+   *
+   *  @return true on success, false on error
+   *  (see above for error conditions)
+   **/
+  virtual bool start(RunMode  runmode = NotifyOnExit,
+                     Communication comm = NoCommunication);
+
+  /**
+   * Stop the process (by sending it a signal).
+   *
+   * @param signo The signal to send. The default is SIGTERM.
+   * @return true if the signal was delivered successfully.
+  */
+  virtual bool kill(int signo = SIGTERM);
+
+  /**
+   * Checks whether the process is running.
+   * @return true if the process is (still) considered to be running
+  */
+  bool isRunning() const;
+
+  /** Returns the process id of the process.
+   *
+   * If it is called after
+   * the process has exited, it returns the process id of the last
+   *  child process that was created by this instance of K3Process.
+   *
+   *  Calling it before any child process has been started by this
+   *  K3Process instance causes pid() to return 0.
+   * @return the pid of the process or 0 if no process has been started yet.
+   **/
+  pid_t pid() const;
+
+  /**
+   * Suspend processing of data from stdout of the child process.
+   */
+  void suspend();
+
+  /**
+   * Resume processing of data from stdout of the child process.
+   */
+  void resume();
+
+  /**
+   * Suspend execution of the current thread until the child process dies
+   * or the timeout hits. This function is not recommended for programs
+   * with a GUI.
+   * @param timeout timeout in seconds. -1 means wait indefinitely.
+   * @return true if the process exited, false if the timeout hit.
+   */
+  bool wait(int timeout = -1);
+
+  /**
+   * Checks whether the process exited cleanly.
+   *
+   * @return true if the process has already finished and has exited
+   *  "voluntarily", ie: it has not been killed by a signal.
+   */
+  bool normalExit() const;
+
+  /**
+   * Checks whether the process was killed by a signal.
+   *
+   * @return true if the process has already finished and has not exited
+   * "voluntarily", ie: it has been killed by a signal.
+   */
+  bool signalled() const;
+
+  /**
+   * Checks whether a killed process dumped core.
+   *
+   * @return true if signalled() returns true and the process
+   * dumped core. Note that on systems that don't define the
+   * WCOREDUMP macro, the return value is always false.
+   */
+  bool coreDumped() const;
+
+  /**
+   * Returns the exit status of the process.
+   *
+   * @return the exit status of the process. Note that this value
+   * is not valid if normalExit() returns false.
+   */
+  int exitStatus() const;
+
+  /**
+   * Returns the signal the process was killed by.
+   *
+   * @return the signal number that caused the process to exit.
+   * Note that this value is not valid if signalled() returns false.
+   */
+  int exitSignal() const;
+
+  /**
+   *	 Transmit data to the child process' stdin.
+   *
+   * This function may return false in the following cases:
+   *
+   *     @li The process is not currently running.
+   * This implies that you cannot use this function in Block mode.
+   *
+   *     @li Communication to stdin has not been requested in the start() call.
+   *
+   *     @li Transmission of data to the child process by a previous call to
+   * writeStdin() is still in progress.
+   *
+   * Please note that the data is sent to the client asynchronously,
+   * so when this function returns, the data might not have been
+   * processed by the child process.
+   * That means that you must not free @p buffer or call writeStdin()
+   * again until either a wroteStdin() signal indicates that the
+   * data has been sent or a processExited() signal shows that
+   * the child process is no longer alive.
+   *
+   * If all the data has been sent to the client, the signal
+   * wroteStdin() will be emitted.
+   *
+   * This function does not work when the process is start()ed in Block mode.
+   *
+   * @param buffer the buffer to write
+   * @param buflen the length of the buffer
+   * @return false if an error has occurred
+   **/
+  bool writeStdin(const char *buffer, int buflen);
+
+  /**
+   * Shuts down the Stdin communication link. If no pty is used, this
+   * causes "EOF" to be indicated on the child's stdin file descriptor.
+   *
+   * @return false if no Stdin communication link exists (any more).
+   */
+  bool closeStdin();
+
+  /**
+   * Shuts down the Stdout communication link. If no pty is used, any further
+   * attempts by the child to write to its stdout file descriptor will cause
+   * it to receive a SIGPIPE.
+   *
+   * @return false if no Stdout communication link exists (any more).
+   */
+  bool closeStdout();
+
+  /**
+   * Shuts down the Stderr communication link. If no pty is used, any further
+   * attempts by the child to write to its stderr file descriptor will cause
+   * it to receive a SIGPIPE.
+   *
+   * @return false if no Stderr communication link exists (any more).
+   */
+  bool closeStderr();
+
+  /**
+   * Deletes the optional utmp entry and closes the pty.
+   *
+   * Make sure to shut down any communication links that are using the pty
+   * before calling this function.
+   *
+   * @return false if the pty is not open (any more).
+   */
+  bool closePty();
+
+  /**
+   * @brief Close stdin, stdout, stderr and the pty
+   *
+   * This is the same that calling all close* functions in a row:
+   * @see closeStdin, @see closeStdout, @see closeStderr and @see closePty
+   */
+  void closeAll();
+
+  /**
+   * Lets you see what your arguments are for debugging.
+   * @return the list of arguments
+   */
+  const QList<QByteArray> &args() /* const */ { return arguments; }
+
+  /**
+   * Controls whether the started process should drop any
+   * setuid/setgid privileges or whether it should keep them.
+   * Note that this function is mostly a dummy, as the KDE libraries
+   * currently refuse to run with setuid/setgid privileges.
+   *
+   * The default is false: drop privileges
+   * @param keepPrivileges true to keep the privileges
+   */
+  void setRunPrivileged(bool keepPrivileges);
+
+  /**
+   * Returns whether the started process will drop any
+   * setuid/setgid privileges or whether it will keep them.
+   * @return true if the process runs privileged
+   */
+  bool runPrivileged() const;
+
+  /**
+   * Adds the variable @p name to the process' environment.
+   * This function must be called before starting the process.
+   * @param name the name of the environment variable
+   * @param value the new value for the environment variable
+   */
+  void setEnvironment(const QString &name, const QString &value);
+
+  /**
+   * Changes the current working directory (CWD) of the process
+   * to be started.
+   * This function must be called before starting the process.
+   * @param dir the new directory
+   */
+  void setWorkingDirectory(const QString &dir);
+
+  /**
+   * Specify whether to start the command via a shell or directly.
+   * The default is to start the command directly.
+   * If @p useShell is true @p shell will be used as shell, or
+   * if shell is empty, /bin/sh will be used.
+   *
+   * When using a shell, the caller should make sure that all filenames etc.
+   * are properly quoted when passed as argument.
+   * @see quote()
+   * @param useShell true if the command should be started via a shell
+   * @param shell the path to the shell that will execute the process, or
+   *              0 to use /bin/sh. Use getenv("SHELL") to use the user's
+   *              default shell, but note that doing so is usually a bad idea
+   *              for shell compatibility reasons.
+   */
+  void setUseShell(bool useShell, const char *shell = 0);
+
+  /**
+   * This function can be used to quote an argument string such that
+   * the shell processes it properly. This is e. g. necessary for
+   * user-provided file names which may contain spaces or quotes.
+   * It also prevents expansion of wild cards and environment variables.
+   * @param arg the argument to quote
+   * @return the quoted argument
+   */
+  static QString quote(const QString &arg);
+
+  /**
+   * Detaches K3Process from child process. All communication is closed.
+   * No exit notification is emitted any more for the child process.
+   * Deleting the K3Process will no longer kill the child process.
+   * Note that the current process remains the parent process of the
+   * child process.
+   */
+  void detach();
+
+  /**
+   * Specify whether to create a pty (pseudo-terminal) for running the
+   * command.
+   * This function should be called before starting the process.
+   *
+   * @param comm for which stdio handles to use a pty. Note that it is not
+   *  allowed to specify Stdout and Stderr at the same time both here and to
+   * start (there is only one pty, so they cannot be distinguished).
+   * @param addUtmp true if a utmp entry should be created for the pty
+   */
+  void setUsePty(Communication comm, bool addUtmp);
+
+  /**
+   * Obtains the pty object used by this process. The return value is
+   * valid only after setUsePty() was used with a non-zero argument.
+   * The pty is open only while the process is running.
+   * @return a pointer to the pty object
+   */
+  KPty *pty() const;
+
+  /**
+   * More or less intuitive constants for use with setPriority().
+   */
+  enum { PrioLowest = 20, PrioLow = 10, PrioLower = 5, PrioNormal = 0,
+    PrioHigher = -5, PrioHigh = -10, PrioHighest = -19 };
+
+  /**
+   * Sets the scheduling priority of the process.
+   * @param prio the new priority in the range -20 (high) to 19 (low).
+   * @return false on error; see setpriority(2) for possible reasons.
+   */
+  bool setPriority(int prio);
+
+Q_SIGNALS:
+  /**
+   * Emitted after the process has terminated when
+   * the process was run in the @p NotifyOnExit  (==default option to
+   * start() ) or the Block mode.
+   * @param proc a pointer to the process that has exited
+   **/
+  void processExited(K3Process *proc);
+
+
+  /**
+   * Emitted, when output from the child process has
+   * been received on stdout.
+   *
+   * To actually get this signal, the Stdout communication link
+   * has to be turned on in start().
+   *
+   * @param proc a pointer to the process that has received the output
+   * @param buffer The data received.
+   * @param buflen The number of bytes that are available.
+   *
+   * You should copy the information contained in @p buffer to your private
+   * data structures before returning from the slot.
+   * Example:
+   * \code
+   *     QString myBuf = QLatin1String(buffer, buflen);
+   * \endcode
+   **/
+  void receivedStdout(K3Process *proc, char *buffer, int buflen);
+
+  /**
+   * Emitted when output from the child process has
+   * been received on stdout.
+   *
+   * To actually get this signal, the Stdout communication link
+   * has to be turned on in start() and the
+   * NoRead flag must have been passed.
+   *
+   * You will need to explicitly call resume() after your call to start()
+   * to begin processing data from the child process' stdout.  This is
+   * to ensure that this signal is not emitted when no one is connected
+   * to it, otherwise this signal will not be emitted.
+   *
+   * The data still has to be read from file descriptor @p fd.
+   * @param fd the file descriptor that provides the data
+   * @param len the number of bytes that have been read from @p fd must
+   *  be written here
+   **/
+  void receivedStdout(int fd, int &len); // KDE4: change, broken API
+
+
+  /**
+   * Emitted, when output from the child process has
+   * been received on stderr.
+   *
+   * To actually get this signal, the Stderr communication link
+   * has to be turned on in start().
+   *
+   * You should copy the information contained in @p buffer to your private
+   * data structures before returning from the slot.
+   *
+   * @param proc a pointer to the process that has received the data
+   * @param buffer The data received.
+   * @param buflen The number of bytes that are available.
+   **/
+  void receivedStderr(K3Process *proc, char *buffer, int buflen);
+
+  /**
+   * Emitted after all the data that has been
+   * specified by a prior call to writeStdin() has actually been
+   * written to the child process.
+   * @param proc a pointer to the process
+   **/
+  void wroteStdin(K3Process *proc);
+
+
+protected Q_SLOTS:
+
+ /**
+  * This slot gets activated when data from the child's stdout arrives.
+  * It usually calls childOutput().
+  * @param fdno the file descriptor for the output
+  */
+  void slotChildOutput(int fdno);
+
+ /**
+  * This slot gets activated when data from the child's stderr arrives.
+  * It usually calls childError().
+  * @param fdno the file descriptor for the output
+  */
+  void slotChildError(int fdno);
+
+  /**
+   * Called when another bulk of data can be sent to the child's
+   * stdin. If there is no more data to be sent to stdin currently
+   * available, this function must disable the QSocketNotifier innot.
+   * @param dummy ignore this argument
+   */
+  void slotSendData(int dummy);	// KDE 4: remove dummy
+
+protected:
+
+  /**
+   * Sets up the environment according to the data passed via
+   * setEnvironment()
+   */
+  void setupEnvironment();
+
+  /**
+   * The list of the process' command line arguments. The first entry
+   * in this list is the executable itself.
+   */
+  QList<QByteArray> arguments;
+  /**
+   * How to run the process (Block, NotifyOnExit, DontCare). You should
+   *  not modify this data member directly from derived classes.
+   */
+  RunMode run_mode;
+  /**
+   * true if the process is currently running. You should not
+   * modify this data member directly from derived classes. Please use
+   * isRunning() for reading the value of this data member since it
+   * will probably be made private in later versions of K3Process.
+   */
+  bool runs;
+
+  /**
+   * The PID of the currently running process.
+   * You should not modify this data member in derived classes.
+   * Please use pid() instead of directly accessing this
+   * member since it will probably be made private in
+   * later versions of K3Process.
+   */
+  pid_t pid_;
+
+  /**
+   * The process' exit status as returned by waitpid(). You should not
+   * modify the value of this data member from derived classes. You should
+   * rather use exitStatus() than accessing this data member directly
+   * since it will probably be made private in further versions of
+   * K3Process.
+   */
+  int status;
+
+
+  /**
+   * If false, the child process' effective uid & gid will be reset to the
+   * real values.
+   * @see setRunPrivileged()
+   */
+  bool keepPrivs;
+
+  /**
+   * This function is called from start() right before a fork() takes
+   * place. According to the @p comm parameter this function has to initialize
+   * the in, out and err data members of K3Process.
+   *
+   * This function should return 1 if setting the needed communication channels
+   * was successful.
+   *
+   * The default implementation is to create UNIX STREAM sockets for the
+   * communication, but you could reimplement this function to establish a
+   * TCP/IP communication for network communication, for example.
+   */
+  virtual int setupCommunication(Communication comm);
+
+  /**
+   * Called right after a (successful) fork() on the parent side. This function
+   * will usually do some communications cleanup, like closing in[0],
+   * out[1] and out[1].
+   *
+   * Furthermore, it must also create the QSocketNotifiers innot,
+   * outnot and errnot and connect their Qt signals to the respective
+   * K3Process slots.
+   *
+   * For a more detailed explanation, it is best to have a look at the default
+   * implementation in kprocess.cpp.
+   */
+  virtual int commSetupDoneP();
+
+  /**
+   * Called right after a (successful) fork(), but before an exec() on the child
+   * process' side. It usually duplicates the in[0], out[1] and
+   * err[1] file handles to the respective standard I/O handles.
+   */
+  virtual int commSetupDoneC();
+
+
+  /**
+   * Immediately called after a successfully started process in NotifyOnExit
+   * mode has exited. This function normally calls commClose()
+   * and emits the processExited() signal.
+   * @param state the exit code of the process as returned by waitpid()
+   */
+  virtual void processHasExited(int state);
+
+  /**
+   * Cleans up the communication links to the child after it has exited.
+   * This function should act upon the values of pid() and runs.
+   * See the kprocess.cpp source for details.
+   * @li If pid() returns zero, the communication links should be closed
+   *  only.
+   * @li if pid() returns non-zero and runs is false, all data
+   *  immediately available from the communication links should be processed
+   *  before closing them.
+   * @li if pid() returns non-zero and runs is true, the communication
+   *  links should be monitored for data until the file handle returned by
+   *  K3ProcessController::theKProcessController->notifierFd() becomes ready
+   *  for reading - when it triggers, runs should be reset to false, and
+   *  the function should be immediately left without closing anything.
+   *
+   * The previous semantics of this function are forward-compatible, but should
+   * be avoided, as they are prone to race conditions and can cause K3Process
+   * (and thus the whole program) to lock up under certain circumstances. At the
+   * end the function closes the communication links in any case. Additionally
+   * @li if runs is true, the communication links are monitored for data
+   *  until all of them have returned EOF. Note that if any system function is
+   *  interrupted (errno == EINTR) the polling loop should be aborted.
+   * @li if runs is false, all data immediately available from the
+   *  communication links is processed.
+   */
+  virtual void commClose();
+
+  /* KDE 4 - commClose will be changed to perform cleanup only in all cases *
+   * If @p notfd is -1, all data immediately available from the
+   *  communication links should be processed.
+   * If @p notfd is not -1, the communication links should be monitored
+   *  for data until the file handle @p notfd becomes ready for reading.
+   */
+//  virtual void commDrain(int notfd);
+
+  /**
+   * Specify the actual executable that should be started (first argument to execve)
+   * Normally the the first argument is the executable but you can
+   * override that with this function.
+   */
+  void setBinaryExecutable(const char *filename);
+
+  /**
+   * The socket descriptors for stdout.
+   */
+  int out[2];
+  /**
+   * The socket descriptors for stdin.
+   */
+  int in[2];
+  /**
+   * The socket descriptors for stderr.
+   */
+  int err[2];
+
+  /**
+   * The socket notifier for in[1].
+   */
+  QSocketNotifier *innot;
+  /**
+   * The socket notifier for out[0].
+   */
+  QSocketNotifier *outnot;
+  /**
+   * The socket notifier for err[0].
+   */
+  QSocketNotifier *errnot;
+
+  /**
+   * Lists the communication links that are activated for the child
+   * process.  Should not be modified from derived classes.
+   */
+  Communication communication;
+
+  /**
+   * Called by slotChildOutput() this function copies data arriving from
+   * the child process' stdout to the respective buffer and emits the signal
+   * receivedStdout().
+   */
+  int childOutput(int fdno);
+
+  /**
+   * Called by slotChildError() this function copies data arriving from
+   * the child process' stderr to the respective buffer and emits the signal
+   * receivedStderr().
+   */
+  int childError(int fdno);
+
+  /**
+   * The buffer holding the data that has to be sent to the child
+   */
+  const char *input_data;
+  /**
+   * The number of bytes already transmitted
+   */
+  int input_sent;
+  /**
+   * The total length of input_data
+   */
+  int input_total;
+
+  /**
+   * K3ProcessController is a friend of K3Process because it has to have
+   * access to various data members.
+   */
+  friend class K3ProcessController;
+
+private:
+  K3ProcessPrivate* const d;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(K3Process::Communication)
+
+class K3ShellProcessPrivate;
+
+/**
+* @obsolete
+*
+* Use K3Process and K3Process::setUseShell(true) instead.
+*
+*   @short A class derived from K3Process to start child
+*   	processes through a shell.
+*   @author Christian Czezatke <e9025461@student.tuwien.ac.at>
+*/
+class K3ShellProcess : public K3Process
+{
+  Q_OBJECT
+
+public:
+
+  /**
+   * Constructor
+   *
+   * If no shellname is specified, the user's default shell is used.
+   */
+  explicit K3ShellProcess(const char *shellname=0);
+
+  /**
+   * Destructor.
+   */
+  ~K3ShellProcess();
+
+  virtual bool start(RunMode  runmode = NotifyOnExit,
+		  Communication comm = NoCommunication);
+
+  static QString quote(const QString &arg);
+
+private:
+  K3ShellProcessPrivate* const d;
+};
+
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/k3processcontroller.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,334 @@
+/* This file is part of the KDE libraries
+    Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at)
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "k3processcontroller.h"
+#include "k3process.h"
+
+//#include <config.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <QtCore/QSocketNotifier>
+
+class K3ProcessController::Private
+{
+public:
+    Private()
+        : needcheck( false ),
+          notifier( 0 )
+    {
+    }
+
+    ~Private()
+    {
+        delete notifier;
+    }
+
+    int fd[2];
+    bool needcheck;
+    QSocketNotifier *notifier;
+    QList<K3Process*> kProcessList;
+    QList<int> unixProcessList;
+    static struct sigaction oldChildHandlerData;
+    static bool handlerSet;
+    static int refCount;
+    static K3ProcessController* instance;
+};
+
+K3ProcessController *K3ProcessController::Private::instance = 0;
+int K3ProcessController::Private::refCount = 0;
+
+void K3ProcessController::ref()
+{
+    if ( !Private::refCount ) {
+        Private::instance = new K3ProcessController;
+        setupHandlers();
+    }
+    Private::refCount++;
+}
+
+void K3ProcessController::deref()
+{
+    Private::refCount--;
+    if( !Private::refCount ) {
+        resetHandlers();
+        delete Private::instance;
+        Private::instance = 0;
+    }
+}
+
+K3ProcessController* K3ProcessController::instance()
+{
+    /*
+     * there were no safety guards in previous revisions, is that ok?
+    if ( !Private::instance ) {
+        ref();
+    }
+     */
+
+    return Private::instance;
+}
+
+K3ProcessController::K3ProcessController()
+  : d( new Private )
+{
+  if( pipe( d->fd ) )
+  {
+    perror( "pipe" );
+    abort();
+  }
+
+  fcntl( d->fd[0], F_SETFL, O_NONBLOCK ); // in case slotDoHousekeeping is called without polling first
+  fcntl( d->fd[1], F_SETFL, O_NONBLOCK ); // in case it fills up
+  fcntl( d->fd[0], F_SETFD, FD_CLOEXEC );
+  fcntl( d->fd[1], F_SETFD, FD_CLOEXEC );
+
+  d->notifier = new QSocketNotifier( d->fd[0], QSocketNotifier::Read );
+  d->notifier->setEnabled( true );
+  QObject::connect( d->notifier, SIGNAL(activated(int)),
+                    SLOT(slotDoHousekeeping()));
+}
+
+K3ProcessController::~K3ProcessController()
+{
+#ifndef Q_OS_MAC
+/* not sure why, but this is causing lockups */
+  close( d->fd[0] );
+  close( d->fd[1] );
+#else
+#warning FIXME: why does close() freeze up destruction?
+#endif
+
+  delete d;
+}
+
+
+extern "C" {
+static void theReaper( int num )
+{
+  K3ProcessController::theSigCHLDHandler( num );
+}
+}
+
+#ifdef Q_OS_UNIX
+struct sigaction K3ProcessController::Private::oldChildHandlerData;
+#endif
+bool K3ProcessController::Private::handlerSet = false;
+
+void K3ProcessController::setupHandlers()
+{
+  if( Private::handlerSet )
+      return;
+  Private::handlerSet = true;
+
+#ifdef Q_OS_UNIX
+  struct sigaction act;
+  sigemptyset( &act.sa_mask );
+
+  act.sa_handler = SIG_IGN;
+  act.sa_flags = 0;
+  sigaction( SIGPIPE, &act, 0L );
+
+  act.sa_handler = theReaper;
+  act.sa_flags = SA_NOCLDSTOP;
+  // CC: take care of SunOS which automatically restarts interrupted system
+  // calls (and thus does not have SA_RESTART)
+#ifdef SA_RESTART
+  act.sa_flags |= SA_RESTART;
+#endif
+  sigaction( SIGCHLD, &act, &Private::oldChildHandlerData );
+
+  sigaddset( &act.sa_mask, SIGCHLD );
+  // Make sure we don't block this signal. gdb tends to do that :-(
+  sigprocmask( SIG_UNBLOCK, &act.sa_mask, 0 );
+#else
+  //TODO: win32
+#endif
+}
+
+void K3ProcessController::resetHandlers()
+{
+  if( !Private::handlerSet )
+      return;
+  Private::handlerSet = false;
+
+#ifdef Q_OS_UNIX
+  sigset_t mask, omask;
+  sigemptyset( &mask );
+  sigaddset( &mask, SIGCHLD );
+  sigprocmask( SIG_BLOCK, &mask, &omask );
+
+  struct sigaction act;
+  sigaction( SIGCHLD, &Private::oldChildHandlerData, &act );
+  if (act.sa_handler != theReaper) {
+     sigaction( SIGCHLD, &act, 0 );
+     Private::handlerSet = true;
+  }
+
+  sigprocmask( SIG_SETMASK, &omask, 0 );
+#else
+  //TODO: win32
+#endif
+  // there should be no problem with SIGPIPE staying SIG_IGN
+}
+
+// the pipe is needed to sync the child reaping with our event processing,
+// as otherwise there are race conditions, locking requirements, and things
+// generally get harder
+void K3ProcessController::theSigCHLDHandler( int arg )
+{
+  int saved_errno = errno;
+
+  char dummy = 0;
+  ::write( instance()->d->fd[1], &dummy, 1 );
+
+#ifdef Q_OS_UNIX
+    if ( Private::oldChildHandlerData.sa_handler != SIG_IGN &&
+         Private::oldChildHandlerData.sa_handler != SIG_DFL ) {
+        Private::oldChildHandlerData.sa_handler( arg ); // call the old handler
+    }
+#else
+  //TODO: win32
+#endif
+
+  errno = saved_errno;
+}
+
+int K3ProcessController::notifierFd() const
+{
+  return d->fd[0];
+}
+
+void K3ProcessController::unscheduleCheck()
+{
+  char dummy[16]; // somewhat bigger - just in case several have queued up
+  if( ::read( d->fd[0], dummy, sizeof(dummy) ) > 0 )
+    d->needcheck = true;
+}
+
+void
+K3ProcessController::rescheduleCheck()
+{
+  if( d->needcheck )
+  {
+    d->needcheck = false;
+    char dummy = 0;
+    ::write( d->fd[1], &dummy, 1 );
+  }
+}
+
+void K3ProcessController::slotDoHousekeeping()
+{
+  char dummy[16]; // somewhat bigger - just in case several have queued up
+  ::read( d->fd[0], dummy, sizeof(dummy) );
+
+  int status;
+ again:
+  QList<K3Process*>::iterator it( d->kProcessList.begin() );
+  QList<K3Process*>::iterator eit( d->kProcessList.end() );
+  while( it != eit )
+  {
+    K3Process *prc = *it;
+    if( prc->runs && waitpid( prc->pid_, &status, WNOHANG ) > 0 )
+    {
+      prc->processHasExited( status );
+      // the callback can nuke the whole process list and even 'this'
+      if (!instance())
+        return;
+      goto again;
+    }
+    ++it;
+  }
+  QList<int>::iterator uit( d->unixProcessList.begin() );
+  QList<int>::iterator ueit( d->unixProcessList.end() );
+  while( uit != ueit )
+  {
+    if( waitpid( *uit, 0, WNOHANG ) > 0 )
+    {
+      uit = d->unixProcessList.erase( uit );
+      deref(); // counterpart to addProcess, can invalidate 'this'
+    } else
+      ++uit;
+  }
+}
+
+bool K3ProcessController::waitForProcessExit( int timeout )
+{
+#ifdef Q_OS_UNIX
+  for(;;)
+  {
+    struct timeval tv, *tvp;
+    if (timeout < 0)
+      tvp = 0;
+    else
+    {
+      tv.tv_sec = timeout;
+      tv.tv_usec = 0;
+      tvp = &tv;
+    }
+
+    fd_set fds;
+    FD_ZERO( &fds );
+    FD_SET( d->fd[0], &fds );
+
+    switch( select( d->fd[0]+1, &fds, 0, 0, tvp ) )
+    {
+    case -1:
+      if( errno == EINTR )
+        continue;
+      // fall through; should never happen
+    case 0:
+      return false;
+    default:
+      slotDoHousekeeping();
+      return true;
+    }
+  }
+#else
+  //TODO: win32
+  return false;
+#endif
+}
+
+void K3ProcessController::addKProcess( K3Process* p )
+{
+  d->kProcessList.append( p );
+}
+
+void K3ProcessController::removeKProcess( K3Process* p )
+{
+  d->kProcessList.removeAll( p );
+}
+
+void K3ProcessController::addProcess( int pid )
+{
+  d->unixProcessList.append( pid );
+  ref(); // make sure we stay around when the K3Process goes away
+}
+
+//#include "moc_k3processcontroller.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/k3processcontroller.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,137 @@
+/* This file is part of the KDE libraries
+    Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at)
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef K3PROCCTRL_H
+#define K3PROCCTRL_H
+
+#include <QtCore/QList>
+#include <k3process.h>
+
+
+/**
+ * @short Used internally by K3Process
+ * @internal
+ * @author Christian Czezatke <e9025461@student.tuwien.ac.at>
+ *
+ *  A class for internal use by K3Process only. -- Exactly one instance
+ *  of this class is created by KApplication.
+ *
+ * This class takes care of the actual (UN*X) signal handling.
+ */
+class K3ProcessController : public QObject
+{
+  Q_OBJECT
+
+public:
+  /**
+   * Create an instance if none exists yet.
+   * Called by KApplication::KApplication()
+   */
+  static void ref();
+
+  /**
+   * Destroy the instance if one exists and it is not referenced any more.
+   * Called by KApplication::~KApplication()
+   */
+  static void deref();
+
+  /**
+   * Only a single instance of this class is allowed at a time.
+   * This method provides access to that instance.
+   */
+  static K3ProcessController *instance();
+
+  /**
+   * Automatically called upon SIGCHLD. Never call it directly.
+   * If your application (or some library it uses) redirects SIGCHLD,
+   * the new signal handler (and only it) should call the old handler
+   * returned by sigaction().
+   * @internal
+   */
+  static void theSigCHLDHandler(int signal); // KDE4: private
+
+  /**
+   * Wait for any process to exit and handle their exit without
+   * starting an event loop.
+   * This function may cause K3Process to emit any of its signals.
+   *
+   * @param timeout the timeout in seconds. -1 means no timeout.
+   * @return true if a process exited, false
+   *         if no process exited within @p timeout seconds.
+   */
+  bool waitForProcessExit(int timeout);
+
+  /**
+   * Call this function to defer processing of the data that became available
+   * on notifierFd().
+   */
+  void unscheduleCheck();
+
+  /**
+   * This function @em must be called at some point after calling
+   * unscheduleCheck().
+   */
+  void rescheduleCheck();
+
+  /*
+   * Obtain the file descriptor K3ProcessController uses to get notified
+   * about process exits. select() or poll() on it if you create a custom
+   * event loop that needs to act upon SIGCHLD.
+   * @return the file descriptor of the reading end of the notification pipe
+   */
+  int notifierFd() const;
+
+  /**
+   * @internal
+   */
+  void addKProcess( K3Process* );
+  /**
+   * @internal
+   */
+  void removeKProcess( K3Process* );
+  /**
+   * @internal
+   */
+  void addProcess( int pid );
+
+private Q_SLOTS:
+  void slotDoHousekeeping();
+
+private:
+  friend class I_just_love_gcc;
+
+  static void setupHandlers();
+  static void resetHandlers();
+
+  // Disallow instantiation
+  K3ProcessController();
+  ~K3ProcessController();
+
+  // Disallow assignment and copy-construction
+  K3ProcessController( const K3ProcessController& );
+  K3ProcessController& operator= ( const K3ProcessController& );
+
+  class Private;
+  Private * const d;
+};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kb-layouts/CVS/Entries	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,4 @@
+/default.keytab/1.1.1.1/Sat May 10 21:27:57 2008//
+/linux.keytab/1.1.1.1/Sat May 10 21:27:57 2008//
+/vt420pc.keytab/1.1.1.1/Sat May 10 21:27:57 2008//
+D
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kb-layouts/CVS/Repository	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+qtermwidget/lib/kb-layouts
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kb-layouts/CVS/Root	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+:ext:e_k@qtermwidget.cvs.sourceforge.net:/cvsroot/qtermwidget
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kb-layouts/default.keytab	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,133 @@
+# [README.default.Keytab] Buildin Keyboard Table
+#
+# To customize your keyboard, copy this file to something
+# ending with .keytab and change it to meet you needs.
+# Please read the README.KeyTab and the README.keyboard
+# in this case.
+#
+# --------------------------------------------------------------
+
+keyboard "Default (XFree 4)"
+
+# --------------------------------------------------------------
+#
+# Note that this particular table is a "risc" version made to
+# ease customization without bothering with obsolete details.
+# See VT100.keytab for the more hairy stuff.
+#
+# --------------------------------------------------------------
+
+# common keys
+
+key Escape             : "\E"
+
+key Tab   -Shift       : "\t"
+key Tab   +Shift+Ansi  : "\E[Z"
+key Tab   +Shift-Ansi  : "\t"
+key Backtab     +Ansi  : "\E[Z"
+key Backtab     -Ansi  : "\t"
+
+key Return-Shift-NewLine : "\r"
+key Return-Shift+NewLine : "\r\n"
+
+key Return+Shift         : "\EOM"
+
+# Backspace and Delete codes are preserving CTRL-H.
+
+key Backspace      : "\x7f"
+
+# Arrow keys in VT52 mode
+# shift up/down are reserved for scrolling.
+# shift left/right are reserved for switching between tabs (this is hardcoded).
+
+key Up   -Shift-Ansi : "\EA"
+key Down -Shift-Ansi : "\EB"
+key Right-Shift-Ansi : "\EC"
+key Left -Shift-Ansi : "\ED"
+
+# Arrow keys in ANSI mode with Application - and Normal Cursor Mode)
+
+key Up    -Shift-AnyMod+Ansi+AppCuKeys           : "\EOA"
+key Down  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOB"
+key Right -Shift-AnyMod+Ansi+AppCuKeys           : "\EOC"
+key Left  -Shift-AnyMod+Ansi+AppCuKeys           : "\EOD"
+
+key Up    -Shift-AnyMod+Ansi-AppCuKeys           : "\E[A"
+key Down  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[B"
+key Right -Shift-AnyMod+Ansi-AppCuKeys           : "\E[C"
+key Left  -Shift-AnyMod+Ansi-AppCuKeys           : "\E[D"
+
+key Up    -Shift+AnyMod+Ansi                     : "\E[1;*A"
+key Down  -Shift+AnyMod+Ansi                     : "\E[1;*B"
+key Right -Shift+AnyMod+Ansi                     : "\E[1;*C"
+key Left  -Shift+AnyMod+Ansi                     : "\E[1;*D"
+
+# other grey PC keys
+
+key Enter+NewLine : "\r\n"
+key Enter-NewLine : "\r"
+
+key Home        -AnyMod     -AppCuKeys           : "\E[H"  
+key End         -AnyMod     -AppCuKeys           : "\E[F"  
+key Home        -AnyMod     +AppCuKeys           : "\EOH"  
+key End         -AnyMod     +AppCuKeys           : "\EOF"  
+key Home        +AnyMod                          : "\E[1;*H"
+key End         +AnyMod                          : "\E[1;*F"
+
+key Insert      -AnyMod                          : "\E[2~"
+key Delete      -AnyMod                          : "\E[3~"
+key Insert      +AnyMod                          : "\E[2;*~"
+key Delete      +AnyMod                          : "\E[3;*~"
+
+key Prior -Shift-AnyMod                          : "\E[5~"
+key Next  -Shift-AnyMod                          : "\E[6~"
+key Prior -Shift+AnyMod                          : "\E[5;*~"
+key Next  -Shift+AnyMod                          : "\E[6;*~"
+
+# Function keys
+key F1          -AnyMod                          : "\EOP"
+key F2          -AnyMod                          : "\EOQ"
+key F3          -AnyMod                          : "\EOR"
+key F4          -AnyMod                          : "\EOS"
+key F5          -AnyMod                          : "\E[15~"
+key F6          -AnyMod                          : "\E[17~"
+key F7          -AnyMod                          : "\E[18~"
+key F8          -AnyMod                          : "\E[19~"
+key F9          -AnyMod                          : "\E[20~"
+key F10         -AnyMod                          : "\E[21~"
+key F11         -AnyMod                          : "\E[23~"
+key F12         -AnyMod                          : "\E[24~"
+
+key F1          +AnyMod                          : "\EO*P"
+key F2          +AnyMod                          : "\EO*Q"
+key F3          +AnyMod                          : "\EO*R"
+key F4          +AnyMod                          : "\EO*S"
+key F5          +AnyMod                          : "\E[15;*~"
+key F6          +AnyMod                          : "\E[17;*~"
+key F7          +AnyMod                          : "\E[18;*~"
+key F8          +AnyMod                          : "\E[19;*~"
+key F9          +AnyMod                          : "\E[20;*~"
+key F10         +AnyMod                          : "\E[21;*~"
+key F11         +AnyMod                          : "\E[23;*~"
+key F12         +AnyMod                          : "\E[24;*~"
+
+# Work around dead keys
+
+key Space +Control : "\x00"
+
+# Some keys are used by konsole to cause operations.
+# The scroll* operations refer to the history buffer.
+
+key Up    +Shift-AppScreen  : scrollLineUp
+key Prior +Shift-AppScreen  : scrollPageUp
+key Down  +Shift-AppScreen  : scrollLineDown
+key Next  +Shift-AppScreen  : scrollPageDown
+
+#key Up    +Shift  : scrollLineUp
+#key Prior +Shift  : scrollPageUp
+#key Down  +Shift  : scrollLineDown
+#key Next  +Shift  : scrollPageDown
+
+key ScrollLock     : scrollLock
+
+# keypad characters are not offered differently by Qt.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kb-layouts/linux.keytab	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,133 @@
+# [linux.keytab] Konsole Keyboard Table (Linux console keys)
+#
+# --------------------------------------------------------------
+
+# NOT TESTED, MAY NEED SOME CLEANUPS
+keyboard "Linux console"
+
+# --------------------------------------------------------------
+#
+# This configuration table allows to customize the
+# meaning of the keys.
+#
+# The syntax is that each entry has the form : 
+#
+#   "key" Keyname { ("+"|"-") Modename } ":" (String|Operation)
+#
+# Keynames are those defined in <qnamespace.h> with the
+# "Qt::Key_" removed. (We'd better insert the list here)
+#
+# Mode names are : 
+#
+# - Shift
+# - Alt
+# - Control
+#
+#   The VT100 emulation has two modes that can affect the
+#   sequences emitted by certain keys. These modes are
+#   under control of the client program.
+#   
+# - Newline     : effects Return and Enter key.
+# - Application : effects Up and Down key.
+#
+# - Ansi        : effects Up and Down key (This is for VT52, really).
+#
+# Operations are
+#
+# - scrollUpLine
+# - scrollUpPage
+# - scrollDownLine
+# - scrollDownPage
+#
+# - emitSelection
+#
+# If the key is not found here, the text of the
+# key event as provided by QT is emitted, possibly
+# preceeded by ESC if the Alt key is pressed.
+#
+# --------------------------------------------------------------
+
+key Escape : "\E"
+key Tab    : "\t"
+
+# VT100 can add an extra \n after return.
+# The NewLine mode is set by an escape sequence.
+
+key Return-NewLine : "\r"  
+key Return+NewLine : "\r\n"
+
+# Some desperately try to save the ^H.
+
+key Backspace : "\x7f"
+key Delete    : "\E[3~"
+
+# These codes are for the VT52 mode of VT100
+# The Ansi mode (i.e. VT100 mode) is set by
+# an escape sequence
+
+key Up   -Shift-Ansi : "\EA"
+key Down -Shift-Ansi : "\EB"
+key Right-Shift-Ansi : "\EC"
+key Left -Shift-Ansi : "\ED"
+
+# VT100 emits a mode bit together
+# with the arrow keys.The AppCuKeys
+# mode is set by an escape sequence.
+
+key Up   -Shift+Ansi+AppCuKeys : "\EOA"
+key Down -Shift+Ansi+AppCuKeys : "\EOB"
+key Right-Shift+Ansi+AppCuKeys : "\EOC"
+key Left -Shift+Ansi+AppCuKeys : "\EOD"
+
+key Up   -Shift+Ansi-AppCuKeys : "\E[A"
+key Down -Shift+Ansi-AppCuKeys : "\E[B"
+key Right-Shift+Ansi-AppCuKeys : "\E[C"
+key Left -Shift+Ansi-AppCuKeys : "\E[D"
+
+# linux functions keys F1-F5 differ from xterm
+
+key F1 : "\E[[A" 
+key F2 : "\E[[B" 
+key F3 : "\E[[C" 
+key F4 : "\E[[D" 
+key F5 : "\E[[E" 
+
+key F6     : "\E[17~" 
+key F7     : "\E[18~" 
+key F8     : "\E[19~" 
+key F9     : "\E[20~" 
+key F10    : "\E[21~" 
+key F11    : "\E[23~" 
+key F12    : "\E[24~" 
+
+key Home   : "\E[1~"  
+key End    : "\E[4~"  
+
+key Prior -Shift : "\E[5~"  
+key Next  -Shift : "\E[6~"  
+key Insert-Shift : "\E[2~"  
+
+# Keypad-Enter. See comment on Return above.
+
+key Enter+NewLine : "\r\n"
+key Enter-NewLine : "\r"  
+
+key Space +Control : "\x00"
+
+# some of keys are used by konsole.
+
+key Up    +Shift   : scrollLineUp
+key Prior +Shift   : scrollPageUp
+key Down  +Shift   : scrollLineDown
+key Next  +Shift   : scrollPageDown
+
+key ScrollLock     : scrollLock
+
+#----------------------------------------------------------
+
+# keypad characters as offered by Qt
+# cannot be recognized as such.
+
+#----------------------------------------------------------
+
+# Following other strings as emitted by konsole.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kb-layouts/vt420pc.keytab	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,163 @@
+# [vt420pc.keytab] Konsole Keyboard Table (VT420pc keys)
+# adapted by ferdinand gassauer f.gassauer@aon.at
+# Nov 2000
+#
+################################################################
+#
+# The escape sequences emmited by the 
+# keys Shift+F1 to Shift+F12 might not fit your needs
+#
+################# IMPORTANT NOTICE #############################
+# the key bindings (Kcontrol -> look and feel -> keybindgs) 
+# overrule the settings in this file. The key bindings might be 
+# changed by the user WITHOUT notification of the maintainer of
+# the keytab file. Konsole will not work as expected by 
+# the maintainer of the keytab file.
+################################################################
+#
+# --------------------------------------------------------------
+
+keyboard "DEC VT420 Terminal"
+
+# --------------------------------------------------------------
+#
+# This configuration table allows to customize the
+# meaning of the keys.
+#
+# The syntax is that each entry has the form : 
+#
+#   "key" Keyname { ("+"|"-") Modename } ":" (String|Operation)
+#
+# Keynames are those defined in <qnamespace.h> with the
+# "Qt::Key_" removed. (We'd better insert the list here)
+#
+# Mode names are : 
+#
+# - Shift
+# - Alt
+# - Control
+#
+#   The VT100 emulation has two modes that can affect the
+#   sequences emitted by certain keys. These modes are
+#   under control of the client program.
+#   
+# - Newline     : effects Return and Enter key.
+# - Application : effects Up and Down key.
+#
+# - Ansi        : effects Up and Down key (This is for VT52, really).
+#
+# Operations are
+#
+# - scrollUpLine
+# - scrollUpPage
+# - scrollDownLine
+# - scrollDownPage
+#
+# - emitSelection
+#
+# If the key is not found here, the text of the
+# key event as provided by QT is emitted, possibly
+# preceeded by ESC if the Alt key is pressed.
+#
+# --------------------------------------------------------------
+
+key Escape : "\E"
+key Tab    : "\t"
+key Backtab: "\E[Z"
+
+# VT100 can add an extra \n after return.
+# The NewLine mode is set by an escape sequence.
+
+key Return-NewLine : "\r"  
+key Return+NewLine : "\r\n"
+
+# Some desperately try to save the ^H.
+# may be not everyone wants this
+
+key Backspace : "\x08"  # Control H
+key Delete    : "\x7f"
+
+# These codes are for the VT420pc
+# The Ansi mode (i.e. VT100 mode) is set by
+# an escape sequence
+
+key Up   -Shift-Ansi : "\EA"
+key Down -Shift-Ansi : "\EB"
+key Right-Shift-Ansi : "\EC"
+key Left -Shift-Ansi : "\ED"
+
+# VT100 emits a mode bit together
+# with the arrow keys.The AppCuKeys
+# mode is set by an escape sequence.
+
+key Up   -Shift+Ansi+AppCuKeys : "\EOA"
+key Down -Shift+Ansi+AppCuKeys : "\EOB"
+key Right-Shift+Ansi+AppCuKeys : "\EOC"
+key Left -Shift+Ansi+AppCuKeys : "\EOD"
+
+key Up   -Shift+Ansi-AppCuKeys : "\E[A"
+key Down -Shift+Ansi-AppCuKeys : "\E[B"
+key Right-Shift+Ansi-AppCuKeys : "\E[C"
+key Left -Shift+Ansi-AppCuKeys : "\E[D"
+
+# function keys 
+
+key F1 -Shift    : "\E[11~"  
+key F2 -Shift    : "\E[12~"
+key F3 -Shift    : "\E[13~"
+key F4 -Shift    : "\E[14~"
+key F5 -Shift    : "\E[15~"
+key F6 -Shift    : "\E[17~"
+key F7 -Shift    : "\E[18~"
+key F8 -Shift    : "\E[19~"
+key F9 -Shift    : "\E[20~"
+key F10-Shift    : "\E[21~"
+key F11-Shift    : "\E[23~"
+key F12-Shift    : "\E[24~"  
+#
+# Shift F1-F12
+#
+key F1 +Shift    : "\E[11;2~"
+key F2 +Shift    : "\E[12;2~"
+key F3 +Shift    : "\E[13;2~"
+key F4 +Shift    : "\E[14;2~"
+key F5 +Shift    : "\E[15;2~"
+key F6 +Shift    : "\E[17;2~" 
+key F7 +Shift    : "\E[18;2~" 
+key F8 +Shift    : "\E[19;2~" 
+key F9 +Shift    : "\E[20;2~" 
+key F10+Shift    : "\E[21;2~" 
+key F11+Shift    : "\E[23;2~" 
+key F12+Shift    : "\E[24;2~" 
+
+key Home   : "\E[H"  
+key End    : "\E[F"  
+
+key Prior -Shift : "\E[5~"  
+key Next  -Shift : "\E[6~"  
+key Insert-Shift : "\E[2~"  
+
+# Keypad-Enter. See comment on Return above.
+
+key Enter+NewLine : "\r\n"
+key Enter-NewLine : "\r"  
+
+key Space +Control : "\x00"
+
+# some of keys are used by konsole.
+
+key Up    +Shift   : scrollLineUp
+key Prior +Shift   : scrollPageUp
+key Down  +Shift   : scrollLineDown
+key Next  +Shift   : scrollPageDown
+
+key ScrollLock     : scrollLock
+
+#----------------------------------------------------------
+
+# keypad characters as offered by Qt
+# cannot be recognized as such.
+
+#----------------------------------------------------------
+
+# Following other strings as emitted by konsole.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/konsole_wcwidth.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,216 @@
+/* $XFree86: xc/programs/xterm/wcwidth.character,v 1.3 2001/07/29 22:08:16 tsi Exp $ */
+/*
+ * This is an implementation of wcwidth() and wcswidth() as defined in
+ * "The Single UNIX Specification, Version 2, The Open Group, 1997"
+ * <http://www.UNIX-systems.org/online.html>
+ *
+ * Markus Kuhn -- 2001-01-12 -- public domain
+ */
+
+#include "konsole_wcwidth.h"
+
+struct interval {
+  unsigned short first;
+  unsigned short last;
+};
+
+/* auxiliary function for binary search in interval table */
+static int bisearch(quint16 ucs, const struct interval *table, int max) {
+  int min = 0;
+  int mid;
+
+  if (ucs < table[0].first || ucs > table[max].last)
+    return 0;
+  while (max >= min) {
+    mid = (min + max) / 2;
+    if (ucs > table[mid].last)
+      min = mid + 1;
+    else if (ucs < table[mid].first)
+      max = mid - 1;
+    else
+      return 1;
+  }
+
+  return 0;
+}
+
+
+/* The following functions define the column width of an ISO 10646
+ * character as follows:
+ *
+ *    - The null character (U+0000) has a column width of 0.
+ *
+ *    - Other C0/C1 control characters and DEL will lead to a return
+ *      value of -1.
+ *
+ *    - Non-spacing and enclosing combining characters (general
+ *      category code Mn or Me in the Unicode database) have a
+ *      column width of 0.
+ *
+ *    - Other format characters (general category code Cf in the Unicode
+ *      database) and ZERO WIDTH SPACE (U+200B) have a column width of 0.
+ *
+ *    - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
+ *      have a column width of 0.
+ *
+ *    - Spacing characters in the East Asian Wide (W) or East Asian
+ *      FullWidth (F) category as defined in Unicode Technical
+ *      Report #11 have a column width of 2.
+ *
+ *    - All remaining characters (including all printable
+ *      ISO 8859-1 and WGL4 characters, Unicode control characters,
+ *      etc.) have a column width of 1.
+ *
+ * This implementation assumes that quint16 characters are encoded
+ * in ISO 10646.
+ */
+
+int konsole_wcwidth(quint16 ucs)
+{
+  /* sorted list of non-overlapping intervals of non-spacing characters */
+  static const struct interval combining[] = {
+    { 0x0300, 0x034E }, { 0x0360, 0x0362 }, { 0x0483, 0x0486 },
+    { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 },
+    { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 },
+    { 0x05C4, 0x05C4 }, { 0x064B, 0x0655 }, { 0x0670, 0x0670 },
+    { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED },
+    { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A },
+    { 0x07A6, 0x07B0 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C },
+    { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 },
+    { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC },
+    { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 },
+    { 0x0A02, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 },
+    { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 },
+    { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 },
+    { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0B01, 0x0B01 },
+    { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 },
+    { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 },
+    { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 },
+    { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 },
+    { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD },
+    { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA },
+    { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 },
+    { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 },
+    { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD },
+    { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 },
+    { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 },
+    { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC },
+    { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 },
+    { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 },
+    { 0x1160, 0x11FF }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 },
+    { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, { 0x18A9, 0x18A9 },
+    { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x206A, 0x206F },
+    { 0x20D0, 0x20E3 }, { 0x302A, 0x302F }, { 0x3099, 0x309A },
+    { 0xFB1E, 0xFB1E }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF },
+    { 0xFFF9, 0xFFFB }
+  };
+
+  /* test for 8-bit control characters */
+  if (ucs == 0)
+    return 0;
+  if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))
+    return -1;
+
+  /* binary search in table of non-spacing characters */
+  if (bisearch(ucs, combining,
+	       sizeof(combining) / sizeof(struct interval) - 1))
+    return 0;
+
+  /* if we arrive here, ucs is not a combining or C0/C1 control character */
+
+  return 1 +
+    (ucs >= 0x1100 &&
+     (ucs <= 0x115f ||                    /* Hangul Jamo init. consonants */
+      (ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs & ~0x0011) != 0x300a &&
+       ucs != 0x303f) ||                  /* CJK ... Yi */
+      (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */
+      (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */
+      (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */
+      (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */
+      (ucs >= 0xffe0 && ucs <= 0xffe6) /* do not compare UINT16 with 0x20000 ||
+      (ucs >= 0x20000 && ucs <= 0x2ffff) */));
+}
+
+#if 0
+/*
+ * The following function is the same as konsole_wcwidth(), except that
+ * spacing characters in the East Asian Ambiguous (A) category as
+ * defined in Unicode Technical Report #11 have a column width of 2.
+ * This experimental variant might be useful for users of CJK legacy
+ * encodings who want to migrate to UCS. It is not otherwise
+ * recommended for general use.
+ */
+int konsole_wcwidth_cjk(quint16 ucs)
+{
+  /* sorted list of non-overlapping intervals of East Asian Ambiguous
+   * characters */
+  static const struct interval ambiguous[] = {
+    { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 },
+    { 0x00AA, 0x00AA }, { 0x00AD, 0x00AD }, { 0x00B0, 0x00B4 },
+    { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 },
+    { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 },
+    { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED },
+    { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA },
+    { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 },
+    { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B },
+    { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 },
+    { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 },
+    { 0x0148, 0x014A }, { 0x014D, 0x014D }, { 0x0152, 0x0153 },
+    { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE },
+    { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 },
+    { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA },
+    { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 },
+    { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, { 0x02CD, 0x02CD },
+    { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, { 0x02DD, 0x02DD },
+    { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 },
+    { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, { 0x0410, 0x044F },
+    { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, { 0x2013, 0x2016 },
+    { 0x2018, 0x2019 }, { 0x201C, 0x201D }, { 0x2020, 0x2021 },
+    { 0x2025, 0x2027 }, { 0x2030, 0x2030 }, { 0x2032, 0x2033 },
+    { 0x2035, 0x2035 }, { 0x203B, 0x203B }, { 0x2074, 0x2074 },
+    { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC },
+    { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 },
+    { 0x2113, 0x2113 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 },
+    { 0x212B, 0x212B }, { 0x2154, 0x2155 }, { 0x215B, 0x215B },
+    { 0x215E, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 },
+    { 0x2190, 0x2199 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 },
+    { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 },
+    { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 },
+    { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 },
+    { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C },
+    { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D },
+    { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 },
+    { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B },
+    { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 },
+    { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 },
+    { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24BF },
+    { 0x24D0, 0x24E9 }, { 0x2500, 0x254B }, { 0x2550, 0x2574 },
+    { 0x2580, 0x258F }, { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 },
+    { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 },
+    { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 },
+    { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 },
+    { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, { 0x2609, 0x2609 },
+    { 0x260E, 0x260F }, { 0x261C, 0x261C }, { 0x261E, 0x261E },
+    { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2660, 0x2661 },
+    { 0x2663, 0x2665 }, { 0x2667, 0x266A }, { 0x266C, 0x266D },
+    { 0x266F, 0x266F }, { 0x300A, 0x300B }, { 0x301A, 0x301B },
+    { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD }
+  };
+
+  /* binary search in table of non-spacing characters */
+  if (bisearch(ucs, ambiguous,
+	       sizeof(ambiguous) / sizeof(struct interval) - 1))
+    return 2;
+
+  return konsole_wcwidth(ucs);
+}
+#endif
+
+// single byte char: +1, multi byte char: +2
+int string_width( const QString &txt )
+{
+  int w = 0;
+  for ( int i = 0; i < txt.length(); ++i )
+     w += konsole_wcwidth( txt[ i ].unicode() );
+ return w;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/konsole_wcwidth.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,24 @@
+/* $XFree86: xc/programs/xterm/wcwidth.h,v 1.2 2001/06/18 19:09:27 dickey Exp $ */
+
+/* Markus Kuhn -- 2001-01-12 -- public domain */
+/* Adaptions for KDE by Waldo Bastian <bastian@kde.org> */
+/*
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>
+*/
+
+
+#ifndef	_KONSOLE_WCWIDTH_H_
+#define	_KONSOLE_WCWIDTH_H_
+
+// Qt
+#include <QtCore/QBool>
+#include <QtCore/QString>
+
+int konsole_wcwidth(quint16 ucs);
+#if 0
+int konsole_wcwidth_cjk(Q_UINT16 ucs);
+#endif
+
+int string_width( const QString &txt );
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kpty.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,624 @@
+/*
+
+   This file is part of the KDE libraries
+   Copyright (C) 2002 Waldo Bastian <bastian@kde.org>
+   Copyright (C) 2002-2003,2007 Oswald Buddenhagen <ossi@kde.org>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+#include "kpty_p.h"
+
+#ifdef __sgi
+#define __svr4__
+#endif
+
+#ifdef __osf__
+#define _OSF_SOURCE
+#include <float.h>
+#endif
+
+#ifdef _AIX
+#define _ALL_SOURCE
+#endif
+
+// __USE_XOPEN isn't defined by default in ICC
+// (needed for ptsname(), grantpt() and unlockpt())
+#ifdef __INTEL_COMPILER
+#  ifndef __USE_XOPEN
+#    define __USE_XOPEN
+#  endif
+#endif
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <grp.h>
+
+#if defined(HAVE_PTY_H)
+# include <pty.h>
+#endif
+
+#ifdef HAVE_LIBUTIL_H
+# include <libutil.h>
+#elif defined(HAVE_UTIL_H)
+# include <util.h>
+#endif
+
+#ifdef HAVE_UTEMPTER
+extern "C" {
+# include <utempter.h>
+}
+#else
+# include <utmp.h>
+# ifdef HAVE_UTMPX
+#  include <utmpx.h>
+# endif
+# if !defined(_PATH_UTMPX) && defined(_UTMPX_FILE)
+#  define _PATH_UTMPX _UTMPX_FILE
+# endif
+# if !defined(_PATH_WTMPX) && defined(_WTMPX_FILE)
+#  define _PATH_WTMPX _WTMPX_FILE
+# endif
+#endif
+
+/* for HP-UX (some versions) the extern C is needed, and for other
+   platforms it doesn't hurt */
+extern "C" {
+#include <termios.h>
+#if defined(HAVE_TERMIO_H)
+# include <termio.h> // struct winsize on some systems
+#endif
+}
+
+#if defined (_HPUX_SOURCE)
+# define _TERMIOS_INCLUDED
+# include <bsdtty.h>
+#endif
+
+#ifdef HAVE_SYS_STROPTS_H
+# include <sys/stropts.h>	// Defines I_PUSH
+# define _NEW_TTY_CTRL
+#endif
+
+#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
+# define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode)
+#else
+# if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__)
+#  define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode)
+# else
+#  define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode)
+# endif
+#endif
+
+#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
+# define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode)
+#else
+# if defined(_HPUX_SOURCE) || defined(__CYGWIN__)
+#  define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode)
+# else
+#  define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode)
+# endif
+#endif
+
+//#include <kdebug.h>
+//#include <kstandarddirs.h>	// findExe
+
+#include <QtCore>
+
+// not defined on HP-UX for example
+#ifndef CTRL
+# define CTRL(x) ((x) & 037)
+#endif
+
+#define TTY_GROUP "tty"
+
+///////////////////////
+// private functions //
+///////////////////////
+
+//////////////////
+// private data //
+//////////////////
+
+KPtyPrivate::KPtyPrivate() :
+    masterFd(-1), slaveFd(-1)
+{
+}
+
+bool KPtyPrivate::chownpty(bool)
+{
+//    return !QProcess::execute(KStandardDirs::findExe("kgrantpty"),
+//        QStringList() << (grant?"--grant":"--revoke") << QString::number(masterFd));
+    return true;
+}
+
+/////////////////////////////
+// public member functions //
+/////////////////////////////
+
+KPty::KPty() :
+    d_ptr(new KPtyPrivate)
+{
+    d_ptr->q_ptr = this;
+}
+
+KPty::KPty(KPtyPrivate *d) :
+    d_ptr(d)
+{
+    d_ptr->q_ptr = this;
+}
+
+KPty::~KPty()
+{
+    close();
+    delete d_ptr;
+}
+
+bool KPty::open()
+{
+  Q_D(KPty);
+
+  if (d->masterFd >= 0)
+    return true;
+
+  QByteArray ptyName;
+
+  // Find a master pty that we can open ////////////////////////////////
+
+  // Because not all the pty animals are created equal, they want to
+  // be opened by several different methods.
+
+  // We try, as we know them, one by one.
+
+#ifdef HAVE_OPENPTY
+
+  char ptsn[PATH_MAX];
+  if (::openpty( &d->masterFd, &d->slaveFd, ptsn, 0, 0))
+  {
+    d->masterFd = -1;
+    d->slaveFd = -1;
+    kWarning(175) << "Can't open a pseudo teletype";
+    return false;
+  }
+  d->ttyName = ptsn;
+
+#else
+
+#ifdef HAVE__GETPTY // irix
+
+  char *ptsn = _getpty(&d->masterFd, O_RDWR|O_NOCTTY, S_IRUSR|S_IWUSR, 0);
+  if (ptsn) {
+    d->ttyName = ptsn;
+    goto grantedpt;
+  }
+
+#elif defined(HAVE_PTSNAME) || defined(TIOCGPTN)
+
+#ifdef HAVE_POSIX_OPENPT
+  d->masterFd = ::posix_openpt(O_RDWR|O_NOCTTY);
+#elif defined(HAVE_GETPT)
+  d->masterFd = ::getpt();
+#elif defined(PTM_DEVICE)
+  d->masterFd = ::open(PTM_DEVICE, O_RDWR|O_NOCTTY);
+#else
+# error No method to open a PTY master detected.
+#endif
+
+  if (d->masterFd >= 0)
+  {
+ 
+#ifdef HAVE_PTSNAME
+    char *ptsn = ptsname(d->masterFd);
+    if (ptsn) {
+        d->ttyName = ptsn;
+#else
+    int ptyno;
+    if (!ioctl(d->masterFd, TIOCGPTN, &ptyno)) {
+        d->ttyName = QByteArray("/dev/pts/") + QByteArray::number(ptyno);
+#endif
+#ifdef HAVE_GRANTPT
+        if (!grantpt(d->masterFd))
+           goto grantedpt;
+#else
+
+        goto gotpty;
+#endif
+    }
+    ::close(d->masterFd);
+    d->masterFd = -1;
+  }
+#endif // HAVE_PTSNAME || TIOCGPTN
+
+  // Linux device names, FIXME: Trouble on other systems?
+  for (const char* s3 = "pqrstuvwxyzabcde"; *s3; s3++)
+  {
+    for (const char* s4 = "0123456789abcdef"; *s4; s4++)
+    {
+      ptyName = QString().sprintf("/dev/pty%c%c", *s3, *s4).toAscii();
+      d->ttyName = QString().sprintf("/dev/tty%c%c", *s3, *s4).toAscii();
+
+      d->masterFd = ::open(ptyName.data(), O_RDWR);
+      if (d->masterFd >= 0)
+      {
+#ifdef Q_OS_SOLARIS
+        /* Need to check the process group of the pty.
+         * If it exists, then the slave pty is in use,
+         * and we need to get another one.
+         */
+        int pgrp_rtn;
+        if (ioctl(d->masterFd, TIOCGPGRP, &pgrp_rtn) == 0 || errno != EIO) {
+          ::close(d->masterFd);
+          d->masterFd = -1;
+          continue;
+        }
+#endif /* Q_OS_SOLARIS */
+        if (!access(d->ttyName.data(),R_OK|W_OK)) // checks availability based on permission bits
+        {
+          if (!geteuid())
+          {
+            struct group* p = getgrnam(TTY_GROUP);
+            if (!p)
+              p = getgrnam("wheel");
+            gid_t gid = p ? p->gr_gid : getgid ();
+
+            chown(d->ttyName.data(), getuid(), gid);
+            chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IWGRP);
+          }
+          goto gotpty;
+        }
+        ::close(d->masterFd);
+        d->masterFd = -1;
+      }
+    }
+  }
+
+  qWarning() << "Can't open a pseudo teletype";
+  return false;
+
+ gotpty:
+  struct stat st;
+  if (stat(d->ttyName.data(), &st)) {
+    return false; // this just cannot happen ... *cough*  Yeah right, I just
+                  // had it happen when pty #349 was allocated.  I guess
+                  // there was some sort of leak?  I only had a few open.
+    }
+  if (((st.st_uid != getuid()) ||
+       (st.st_mode & (S_IRGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH))) &&
+      !d->chownpty(true))
+  {
+    qWarning()
+      << "chownpty failed for device " << ptyName << "::" << d->ttyName
+      << "\nThis means the communication can be eavesdropped." << endl;
+  }
+
+#if defined (HAVE__GETPTY) || defined (HAVE_GRANTPT)
+ grantedpt:
+#endif 
+
+#ifdef HAVE_REVOKE
+  revoke(d->ttyName.data());
+#endif
+
+#ifdef HAVE_UNLOCKPT
+  unlockpt(d->masterFd);
+#elif defined(TIOCSPTLCK)
+  int flag = 0;
+  ioctl(d->masterFd, TIOCSPTLCK, &flag);
+#endif
+
+  d->slaveFd = ::open(d->ttyName.data(), O_RDWR | O_NOCTTY);
+  if (d->slaveFd < 0)
+  {
+    qWarning() << "Can't open slave pseudo teletype";
+    ::close(d->masterFd);
+    d->masterFd = -1;
+    return false;
+  }
+
+#if (defined(__svr4__) || defined(__sgi__))
+  // Solaris
+  ioctl(d->slaveFd, I_PUSH, "ptem");
+  ioctl(d->slaveFd, I_PUSH, "ldterm");
+#endif
+
+#endif /* HAVE_OPENPTY */
+
+  fcntl(d->masterFd, F_SETFD, FD_CLOEXEC);
+  fcntl(d->slaveFd, F_SETFD, FD_CLOEXEC);
+
+  return true;
+}
+
+void KPty::closeSlave()
+{
+    Q_D(KPty);
+
+    if (d->slaveFd < 0)
+        return;
+    ::close(d->slaveFd);
+    d->slaveFd = -1;
+}
+
+void KPty::close()
+{
+   Q_D(KPty);
+
+   if (d->masterFd < 0)
+      return;
+   closeSlave();
+   // don't bother resetting unix98 pty, it will go away after closing master anyway.
+   if (memcmp(d->ttyName.data(), "/dev/pts/", 9)) {
+      if (!geteuid()) {
+         struct stat st;
+         if (!stat(d->ttyName.data(), &st)) {
+            chown(d->ttyName.data(), 0, st.st_gid == getgid() ? 0 : -1);
+            chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+         }
+      } else {
+         fcntl(d->masterFd, F_SETFD, 0);
+         d->chownpty(false);
+      }
+   }
+   ::close(d->masterFd);
+   d->masterFd = -1;
+}
+
+void KPty::setCTty()
+{
+    Q_D(KPty);
+
+    // Setup job control //////////////////////////////////
+
+    // Become session leader, process group leader,
+    // and get rid of the old controlling terminal.
+    setsid();
+
+    // make our slave pty the new controlling terminal.
+#ifdef TIOCSCTTY
+    ioctl(d->slaveFd, TIOCSCTTY, 0);
+#else
+    // __svr4__ hack: the first tty opened after setsid() becomes controlling tty
+    ::close(::open(d->ttyName, O_WRONLY, 0));
+#endif
+
+    // make our new process group the foreground group on the pty
+    int pgrp = getpid();
+#if defined(_POSIX_VERSION) || defined(__svr4__)
+    tcsetpgrp(d->slaveFd, pgrp);
+#elif defined(TIOCSPGRP)
+    ioctl(d->slaveFd, TIOCSPGRP, (char *)&pgrp);
+#endif
+}
+
+void KPty::login(const char *user, const char *remotehost)
+{
+#ifdef HAVE_UTEMPTER
+    Q_D(KPty);
+
+    addToUtmp(d->ttyName, remotehost, d->masterFd);
+    Q_UNUSED(user);
+#else
+# ifdef HAVE_UTMPX
+    struct utmpx l_struct;
+# else
+    struct utmp l_struct;
+# endif
+    memset(&l_struct, 0, sizeof(l_struct));
+    // note: strncpy without terminators _is_ correct here. man 4 utmp
+
+    if (user)
+      strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
+
+    if (remotehost) {
+      strncpy(l_struct.ut_host, remotehost, sizeof(l_struct.ut_host));
+# ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
+      l_struct.ut_syslen = qMin(strlen(remotehost), sizeof(l_struct.ut_host));
+# endif
+    }
+
+# ifndef __GLIBC__
+    Q_D(KPty);
+    const char *str_ptr = d->ttyName.data();
+    if (!memcmp(str_ptr, "/dev/", 5))
+        str_ptr += 5;
+    strncpy(l_struct.ut_line, str_ptr, sizeof(l_struct.ut_line));
+#  ifdef HAVE_STRUCT_UTMP_UT_ID
+    strncpy(l_struct.ut_id,
+            str_ptr + strlen(str_ptr) - sizeof(l_struct.ut_id),
+            sizeof(l_struct.ut_id));
+#  endif
+# endif
+
+# ifdef HAVE_UTMPX
+    gettimeofday(&l_struct.ut_tv, 0);
+# else
+    l_struct.ut_time = time(0);
+# endif
+
+# ifdef HAVE_LOGIN
+#  ifdef HAVE_LOGINX
+    ::loginx(&l_struct);
+#  else
+    ::login(&l_struct);
+#  endif
+# else
+#  ifdef HAVE_STRUCT_UTMP_UT_TYPE
+    l_struct.ut_type = USER_PROCESS;
+#  endif
+#  ifdef HAVE_STRUCT_UTMP_UT_PID
+    l_struct.ut_pid = getpid();
+#   ifdef HAVE_STRUCT_UTMP_UT_SESSION
+    l_struct.ut_session = getsid(0);
+#   endif
+#  endif
+#  ifdef HAVE_UTMPX
+    utmpxname(_PATH_UTMPX);
+    setutxent();
+    pututxline(&l_struct);
+    endutxent();
+    updwtmpx(_PATH_WTMPX, &l_struct);
+#  else
+    utmpname(_PATH_UTMP);
+    setutent();
+    pututline(&l_struct);
+    endutent();
+    updwtmp(_PATH_WTMP, &l_struct);
+#  endif
+# endif
+#endif
+}
+
+void KPty::logout()
+{
+#ifdef HAVE_UTEMPTER
+    Q_D(KPty);
+
+    removeLineFromUtmp(d->ttyName, d->masterFd);
+#else
+    Q_D(KPty);
+
+    const char *str_ptr = d->ttyName.data();
+    if (!memcmp(str_ptr, "/dev/", 5))
+        str_ptr += 5;
+# ifdef __GLIBC__
+    else {
+        const char *sl_ptr = strrchr(str_ptr, '/');
+        if (sl_ptr)
+            str_ptr = sl_ptr + 1;
+    }
+# endif
+# ifdef HAVE_LOGIN
+#  ifdef HAVE_LOGINX
+    ::logoutx(str_ptr, 0, DEAD_PROCESS);
+#  else
+    ::logout(str_ptr);
+#  endif
+# else
+#  ifdef HAVE_UTMPX
+    struct utmpx l_struct, *ut;
+#  else
+    struct utmp l_struct, *ut;
+#  endif
+    memset(&l_struct, 0, sizeof(l_struct));
+
+    strncpy(l_struct.ut_line, str_ptr, sizeof(l_struct.ut_line));
+
+#  ifdef HAVE_UTMPX
+    utmpxname(_PATH_UTMPX);
+    setutxent();
+    if ((ut = getutxline(&l_struct))) {
+#  else
+    utmpname(_PATH_UTMP);
+    setutent();
+    if ((ut = getutline(&l_struct))) {
+#  endif
+        memset(ut->ut_name, 0, sizeof(*ut->ut_name));
+        memset(ut->ut_host, 0, sizeof(*ut->ut_host));
+#  ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
+        ut->ut_syslen = 0;
+#  endif
+#  ifdef HAVE_STRUCT_UTMP_UT_TYPE
+        ut->ut_type = DEAD_PROCESS;
+#  endif
+#  ifdef HAVE_UTMPX
+        gettimeofday(ut->ut_tv, 0);
+        pututxline(ut);
+    }
+    endutxent();
+#  else
+        ut->ut_time = time(0);
+        pututline(ut);
+    }
+    endutent();
+#  endif
+# endif
+#endif
+}
+
+// XXX Supposedly, tc[gs]etattr do not work with the master on Solaris.
+// Please verify.
+
+bool KPty::tcGetAttr(struct ::termios *ttmode) const
+{
+    Q_D(const KPty);
+
+    return _tcgetattr(d->masterFd, ttmode) == 0;
+}
+
+bool KPty::tcSetAttr(struct ::termios *ttmode)
+{
+    Q_D(KPty);
+
+    return _tcsetattr(d->masterFd, ttmode) == 0;
+}
+
+bool KPty::setWinSize(int lines, int columns)
+{
+    Q_D(KPty);
+
+    struct winsize winSize;
+    memset(&winSize, 0, sizeof(winSize));
+    winSize.ws_row = (unsigned short)lines;
+    winSize.ws_col = (unsigned short)columns;
+    return ioctl(d->masterFd, TIOCSWINSZ, (char *)&winSize) == 0;
+}
+
+bool KPty::setEcho(bool echo)
+{
+    struct ::termios ttmode;
+    if (!tcGetAttr(&ttmode))
+        return false;
+    if (!echo)
+        ttmode.c_lflag &= ~ECHO;
+    else
+        ttmode.c_lflag |= ECHO;
+    return tcSetAttr(&ttmode);
+}
+
+const char *KPty::ttyName() const
+{
+    Q_D(const KPty);
+
+    return d->ttyName.data();
+}
+
+int KPty::masterFd() const
+{
+    Q_D(const KPty);
+
+    return d->masterFd;
+}
+
+int KPty::slaveFd() const
+{
+    Q_D(const KPty);
+
+    return d->slaveFd;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kpty.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,188 @@
+/* This file is part of the KDE libraries
+
+    Copyright (C) 2003,2007 Oswald Buddenhagen <ossi@kde.org>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef kpty_h
+#define kpty_h
+
+#include <QtCore>
+
+struct KPtyPrivate;
+struct termios;
+
+/**
+ * Provides primitives for opening & closing a pseudo TTY pair, assigning the
+ * controlling TTY, utmp registration and setting various terminal attributes.
+ */
+class KPty {
+    Q_DECLARE_PRIVATE(KPty)
+
+public:
+
+  /**
+   * Constructor
+   */
+  KPty();
+
+  /**
+   * Destructor:
+   *
+   *  If the pty is still open, it will be closed. Note, however, that
+   *  an utmp registration is @em not undone.
+  */
+  ~KPty();
+
+  /**
+   * Create a pty master/slave pair.
+   *
+   * @return true if a pty pair was successfully opened
+   */
+  bool open();
+
+  /**
+   * Close the pty master/slave pair.
+   */
+  void close();
+
+  /**
+   * Close the pty slave descriptor.
+   *
+   * When creating the pty, KPty also opens the slave and keeps it open.
+   * Consequently the master will never receive an EOF notification.
+   * Usually this is the desired behavior, as a closed pty slave can be
+   * reopened any time - unlike a pipe or socket. However, in some cases
+   * pipe-alike behavior might be desired.
+   *
+   * After this function was called, slaveFd() and setCTty() cannot be
+   * used.
+   */
+  void closeSlave();
+
+  /**
+   * Creates a new session and process group and makes this pty the
+   * controlling tty.
+   */
+  void setCTty();
+
+  /**
+   * Creates an utmp entry for the tty.
+   * This function must be called after calling setCTty and
+   * making this pty the stdin.
+   * @param user the user to be logged on
+   * @param remotehost the host from which the login is coming. This is
+   *  @em not the local host. For remote logins it should be the hostname
+   *  of the client. For local logins from inside an X session it should
+   *  be the name of the X display. Otherwise it should be empty.
+   */
+  void login(const char *user = 0, const char *remotehost = 0);
+
+  /**
+   * Removes the utmp entry for this tty.
+   */
+  void logout();
+
+  /**
+   * Wrapper around tcgetattr(3).
+   *
+   * This function can be used only while the PTY is open.
+   * You will need an #include &lt;termios.h&gt; to do anything useful
+   * with it.
+   *
+   * @param ttmode a pointer to a termios structure.
+   *  Note: when declaring ttmode, @c struct @c ::termios must be used -
+   *  without the '::' some version of HP-UX thinks, this declares
+   *  the struct in your class, in your method.
+   * @return @c true on success, false otherwise
+   */
+  bool tcGetAttr(struct ::termios *ttmode) const;
+
+  /**
+   * Wrapper around tcsetattr(3) with mode TCSANOW.
+   *
+   * This function can be used only while the PTY is open.
+   *
+   * @param ttmode a pointer to a termios structure.
+   * @return @c true on success, false otherwise. Note that success means
+   *  that @em at @em least @em one attribute could be set.
+   */
+  bool tcSetAttr(struct ::termios *ttmode);
+
+  /**
+   * Change the logical (screen) size of the pty.
+   * The default is 24 lines by 80 columns.
+   *
+   * This function can be used only while the PTY is open.
+   *
+   * @param lines the number of rows
+   * @param columns the number of columns
+   * @return @c true on success, false otherwise
+   */
+  bool setWinSize(int lines, int columns);
+
+  /**
+   * Set whether the pty should echo input.
+   *
+   * Echo is on by default.
+   * If the output of automatically fed (non-interactive) PTY clients
+   * needs to be parsed, disabling echo often makes it much simpler.
+   *
+   * This function can be used only while the PTY is open.
+   *
+   * @param echo true if input should be echoed.
+   * @return @c true on success, false otherwise
+   */
+  bool setEcho(bool echo);
+
+  /**
+   * @return the name of the slave pty device.
+   *
+   * This function should be called only while the pty is open.
+   */
+  const char *ttyName() const;
+
+  /**
+   * @return the file descriptor of the master pty
+   *
+   * This function should be called only while the pty is open.
+   */
+  int masterFd() const;
+
+  /**
+   * @return the file descriptor of the slave pty
+   *
+   * This function should be called only while the pty slave is open.
+   */
+  int slaveFd() const;
+
+protected:
+  /**
+   * @internal
+   */
+  KPty(KPtyPrivate *d);
+
+  /**
+   * @internal
+   */
+  KPtyPrivate * const d_ptr;
+};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/kpty_p.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,44 @@
+/* This file is part of the KDE libraries
+
+    Copyright (C) 2003,2007 Oswald Buddenhagen <ossi@kde.org>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef kpty_p_h
+#define kpty_p_h
+
+#include "kpty.h"
+
+#include <QtCore/QByteArray>
+
+struct KPtyPrivate {
+    Q_DECLARE_PUBLIC(KPty)
+
+    KPtyPrivate();
+    bool chownpty(bool grant);
+
+    int masterFd;
+    int slaveFd;
+
+    QByteArray ttyName;
+
+    KPty *q_ptr;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/lib.pro	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,48 @@
+TEMPLATE	= lib
+VERSION		= 0.1.0
+DESTDIR 	= ..
+
+TARGET		= qtermwidget
+
+CONFIG		+= qt debug_and_release warn_on build_all staticlib #dll
+
+QT += core gui
+
+MOC_DIR 	= ../.moc
+
+CONFIG(debug, debug|release) {
+    OBJECTS_DIR = ../.objs_d
+    TARGET 	= qtermwidget_d
+} else {
+    OBJECTS_DIR = ../.objs
+    TARGET 	= qtermwidget
+}
+
+DEFINES 	+= HAVE_POSIX_OPENPT	    
+#or DEFINES 	+= HAVE_GETPT
+
+HEADERS 	= TerminalCharacterDecoder.h Character.h CharacterColor.h \
+		KeyboardTranslator.h \
+		ExtendedDefaultTranslator.h \
+		Screen.h History.h BlockArray.h konsole_wcwidth.h \
+		ScreenWindow.h \
+		Emulation.h \
+		Vt102Emulation.h TerminalDisplay.h Filter.h LineFont.h \
+		Pty.h kpty.h kpty_p.h k3process.h k3processcontroller.h \
+		Session.h ShellCommand.h \
+		qtermwidget.h
+
+SOURCES 	= TerminalCharacterDecoder.cpp \
+		KeyboardTranslator.cpp \
+		Screen.cpp History.cpp BlockArray.cpp konsole_wcwidth.cpp \
+		ScreenWindow.cpp \
+		Emulation.cpp \
+		Vt102Emulation.cpp TerminalDisplay.cpp Filter.cpp \
+		Pty.cpp kpty.cpp k3process.cpp k3processcontroller.cpp \
+		Session.cpp ShellCommand.cpp \
+		qtermwidget.cpp
+
+	    
+
+
+	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/qtermwidget.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,222 @@
+/*  Copyright (C) 2008 e_k (e_k@users.sourceforge.net)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+		
+    This library 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
+    Library General Public License for more details.
+				
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+						
+
+#include "qtermwidget.h"
+
+#include "Session.h"
+#include "TerminalDisplay.h"
+
+using namespace Konsole;
+
+void *createTermWidget(int startnow, void *parent)
+{ 
+    return (void*) new QTermWidget(startnow, (QWidget*)parent); 
+}
+
+struct TermWidgetImpl
+{
+    TermWidgetImpl(QWidget* parent = 0);
+
+    TerminalDisplay *m_terminalDisplay;
+    Session *m_session;
+    
+    Session* createSession();
+    TerminalDisplay* createTerminalDisplay(Session *session, QWidget* parent);
+};
+
+TermWidgetImpl::TermWidgetImpl(QWidget* parent)
+{
+    this->m_session = createSession();
+    this->m_terminalDisplay = createTerminalDisplay(this->m_session, parent);
+}
+
+
+Session *TermWidgetImpl::createSession()
+{
+    Session *session = new Session();
+
+    session->setTitle(Session::NameRole, "QTermWidget");
+    session->setProgram("/bin/bash");
+    QStringList args("");
+    session->setArguments(args);
+    session->setAutoClose(true);
+		    
+    session->setCodec(QTextCodec::codecForName("UTF-8"));
+			
+    session->setFlowControlEnabled(true);
+    session->setHistoryType(HistoryTypeBuffer(1000));
+    
+    session->setDarkBackground(true);
+	    
+    session->setKeyBindings("");	    
+    return session;
+}
+
+TerminalDisplay *TermWidgetImpl::createTerminalDisplay(Session *session, QWidget* parent)
+{
+//    TerminalDisplay* display = new TerminalDisplay(this);
+    TerminalDisplay* display = new TerminalDisplay(parent);
+    
+    display->setBellMode(TerminalDisplay::NotifyBell);
+    display->setTerminalSizeHint(true);
+    display->setTripleClickMode(TerminalDisplay::SelectWholeLine);
+    display->setTerminalSizeStartup(true);
+
+    display->setRandomSeed(session->sessionId() * 31);
+    
+    return display;
+}
+
+
+QTermWidget::QTermWidget(int startnow, QWidget *parent)
+:QWidget(parent)
+{
+    m_impl = new TermWidgetImpl(this);
+    
+    init();
+
+    if (startnow && m_impl->m_session) {
+	m_impl->m_session->run();
+    }
+    
+    this->setFocus( Qt::OtherFocusReason );
+    m_impl->m_terminalDisplay->resize(this->size());
+    
+    this->setFocusProxy(m_impl->m_terminalDisplay);
+}
+
+void QTermWidget::startShellProgram()
+{
+    if ( m_impl->m_session->isRunning() )
+	return;
+	
+    m_impl->m_session->run();
+}
+
+void QTermWidget::init()
+{    
+    m_impl->m_terminalDisplay->setSize(80, 40);
+    
+    QFont font = QApplication::font(); 
+    font.setFamily("Monospace");
+    font.setPointSize(10);
+    font.setStyleHint(QFont::TypeWriter);
+    setTerminalFont(font);
+    setScrollBarPosition(NoScrollBar);    
+        
+    m_impl->m_session->addView(m_impl->m_terminalDisplay);
+    
+    connect(m_impl->m_session, SIGNAL(finished()), this, SLOT(sessionFinished()));
+}
+
+
+QTermWidget::~QTermWidget()
+{
+    emit destroyed();
+}
+
+
+void QTermWidget::setTerminalFont(QFont &font)
+{
+    if (!m_impl->m_terminalDisplay)
+	return;
+    m_impl->m_terminalDisplay->setVTFont(font);
+}
+
+void QTermWidget::setShellProgram(QString &progname)
+{
+    if (!m_impl->m_session)
+	return;
+    m_impl->m_session->setProgram(progname);	
+}
+
+void QTermWidget::setArgs(QStringList &args)
+{
+    if (!m_impl->m_session)
+	return;
+    m_impl->m_session->setArguments(args);	
+}
+
+void QTermWidget::setTextCodec(QTextCodec *codec)
+{
+    if (!m_impl->m_session)
+	return;
+    m_impl->m_session->setCodec(codec);	
+}
+
+void QTermWidget::setColorScheme(int scheme)
+{
+    switch(scheme) {
+	case COLOR_SCHEME_WHITE_ON_BLACK:
+		m_impl->m_terminalDisplay->setColorTable(whiteonblack_color_table);
+		break;		
+	case COLOR_SCHEME_GREEN_ON_BLACK:
+		m_impl->m_terminalDisplay->setColorTable(greenonblack_color_table);
+		break;
+	case COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW:
+		m_impl->m_terminalDisplay->setColorTable(blackonlightyellow_color_table);
+		break;
+	default: //do nothing
+	    break;
+    };
+}
+
+void QTermWidget::setSize(int h, int v)
+{
+    if (!m_impl->m_terminalDisplay)
+	return;
+    m_impl->m_terminalDisplay->setSize(h, v);
+}
+
+void QTermWidget::setHistorySize(int lines)
+{
+    if (lines < 0)
+        m_impl->m_session->setHistoryType(HistoryTypeFile());
+    else
+	m_impl->m_session->setHistoryType(HistoryTypeBuffer(lines));
+}
+
+void QTermWidget::setScrollBarPosition(ScrollBarPosition pos)
+{
+    if (!m_impl->m_terminalDisplay)
+	return;
+    m_impl->m_terminalDisplay->setScrollBarPosition((TerminalDisplay::ScrollBarPosition)pos);
+}
+
+void QTermWidget::sendText(QString &text)
+{
+    m_impl->m_session->sendText(text); 
+}
+
+void QTermWidget::resizeEvent(QResizeEvent*)
+{
+//qDebug("global window resizing...with %d %d", this->size().width(), this->size().height());
+    m_impl->m_terminalDisplay->resize(this->size());
+}
+
+
+
+void QTermWidget::sessionFinished()
+{
+    emit finished();
+}
+
+	
+//#include "moc_consoleq.cpp"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/lib/qtermwidget.h	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,108 @@
+/*  Copyright (C) 2008 e_k (e_k@users.sourceforge.net)
+    
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+		    
+    This library 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
+    Library General Public License for more details.
+			    
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+						    
+
+#ifndef _Q_TERM_WIDGET
+#define _Q_TERM_WIDGET
+
+#include <QtGui>
+
+struct TermWidgetImpl;
+
+enum COLOR_SCHEME {     COLOR_SCHEME_WHITE_ON_BLACK	= 1,
+		        COLOR_SCHEME_GREEN_ON_BLACK,
+		        COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW };
+
+class QTermWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    
+    enum ScrollBarPosition
+    {
+        /** Do not show the scroll bar. */
+        NoScrollBar=0,
+        /** Show the scroll bar on the left side of the display. */
+        ScrollBarLeft=1,
+        /** Show the scroll bar on the right side of the display. */
+        ScrollBarRight=2
+    };
+
+
+    //Creation of widget
+    QTermWidget(int startnow = 1, //start shell programm immediatelly
+		QWidget *parent = 0);
+    ~QTermWidget();
+
+    //start shell program if it was not started in constructor
+    void startShellProgram();
+    
+    //look-n-feel, if you don`t like defaults
+
+    //	Terminal font
+    // Default is application font with family Monospace, size 10
+    void setTerminalFont(QFont &font); 
+    
+    //	Shell program, default is /bin/bash
+    void setShellProgram(QString &progname);
+    
+    // Shell program args, default is none
+    void setArgs(QStringList &args);
+    
+    //Text codec, default is UTF-8
+    void setTextCodec(QTextCodec *codec);
+
+    //Color scheme, default is white on black
+    void setColorScheme(int scheme);
+    
+    //set size
+    void setSize(int h, int v);
+    
+    // History size for scrolling 
+    void setHistorySize(int lines); //infinite if lines < 0
+
+    // Presence of scrollbar
+    void setScrollBarPosition(ScrollBarPosition);
+    
+    // Send some text to terminal
+    void sendText(QString &text);
+            
+signals:
+    void finished();
+        
+protected: 
+    virtual void resizeEvent(QResizeEvent *);
+    
+protected slots:
+    void sessionFinished();        
+    
+private:
+    void init();    
+    TermWidgetImpl *m_impl;
+};
+
+
+//Maybe useful, maybe not
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void *createTermWidget(int startnow, void *parent); 
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/qtermwidget.pro	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,4 @@
+TEMPLATE 	= subdirs
+SUBDIRS 	= lib src
+
+OPTIONS 	+= ordered
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/src/CVS/Entries	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,4 @@
+/README/1.1.1.1/Sat May 10 21:27:57 2008//
+/src.pro/1.1.1.1/Sat May 10 21:27:57 2008//
+/main.cpp/1.7/Wed Jul 30 21:32:00 2008//
+D
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/src/CVS/Repository	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+qtermwidget/src
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/src/CVS/Root	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+:ext:e_k@qtermwidget.cvs.sourceforge.net:/cvsroot/qtermwidget
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/src/README	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,1 @@
+here is sample program which uses QTermWidet for displaying a terminal
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/src/main.cpp	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,51 @@
+/*  Copyright (C) 2008 e_k (e_k@users.sourceforge.net)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+		
+    This library 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
+    Library General Public License for more details.
+				
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+						
+
+#include <QtCore>
+#include <QtGui>
+#include <QApplication>
+
+#include "qtermwidget.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+    QMainWindow *mainWindow = new QMainWindow();
+
+    QTermWidget *console = new QTermWidget();
+    
+    QFont font = QApplication::font();
+    font.setFamily("Terminus");
+    font.setPointSize(12);
+    
+    console->setTerminalFont(font);
+    
+    //console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW);
+    console->setScrollBarPosition(QTermWidget::ScrollBarRight);
+    
+    mainWindow->setCentralWidget(console);
+    mainWindow->resize(802, 610);
+    
+    QObject::connect(console, SIGNAL(finished()), mainWindow, SLOT(close()));
+
+    mainWindow->show();    
+    return app.exec();
+} 
+
+  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/qtermwidget/src/src.pro	Sat Jan 21 11:26:36 2012 +0100
@@ -0,0 +1,27 @@
+TEMPLATE	= app
+DESTDIR 	= ..
+
+CONFIG		+= qt debug_and_release warn_on build_all
+
+QT += core gui
+
+MOC_DIR 	= ../.moc
+
+CONFIG(debug, debug|release) {
+    OBJECTS_DIR = ../.objs_d
+    TARGET 	= consoleq_d
+    LIBS 	+= -L.. ../libqtermwidget_d.a
+} else {
+    OBJECTS_DIR = ../.objs
+    TARGET 	= consoleq
+    LIBS 	+= -L.. ../libqtermwidget.a
+}
+
+SOURCES 	= main.cpp 
+
+INCLUDEPATH 	= ../lib
+
+#LIBS 		+= -L.. -lqtermwidget
+
+
+	
\ No newline at end of file
--- a/gui/src/AbstractTerminalView.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "AbstractTerminalView.h"
-#if defined (Q_OS_UNIX)
-#include "TerminalView.h"
-#elif defined (Q_OS_WIN)
-#include "WinTerminalView.h"
-#endif
-
-AbstractTerminalView* AbstractTerminalView::create (QWidget* parent)
-{
-#if defined (Q_OS_UNIX)
-  return new TerminalView (parent);
-#elif defined (Q_OS_WIN)
-  return new WinTerminalView (parent);
-#else
-  qFatal ("No terminal widget available for this platform.");
-  return 0
-#endif
-}
--- a/gui/src/AbstractTerminalView.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef ABSTRACTTERMINALVIEW_H
-#define ABSTRACTTERMINALVIEW_H
-
-#include <QString>
-
-class QWidget;
-
-/**
-  * @class AbstractTerminalView
-  * Abstract class defining the interface for any terminal view widget.
-  */
-class AbstractTerminalView
-{
-public:
-  /** Sends text to the terminal. */
-  virtual void sendText (const QString&) = 0;
-
-  /** Gets the terminal widget. */
-  virtual QWidget* widget (void) = 0;
-
-  /** Creates a terminal view for the current platform. */
-  static AbstractTerminalView* create (QWidget* parent = 0);
-};
-
-#endif // ABSTRACTTERMINALVIEW_H
--- a/gui/src/BrowserWidget.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "BrowserWidget.h"
-#include <QVBoxLayout>
-#include <QAction>
-#include <QStyle>
-#include <QApplication>
-
-BrowserWidget::BrowserWidget (QWidget * parent):QWidget (parent)
-{
-  construct ();
-}
-
-void
-BrowserWidget::construct ()
-{
-  QStyle *style = QApplication::style ();
-  m_navigationToolBar = new QToolBar (this);
-  m_webView = new QWebView (this);
-  m_urlLineEdit = new QLineEdit (this);
-  m_statusBar = new QStatusBar (this);
-  m_progressBar = new QProgressBar (this);
-  m_progressBar->setMaximumWidth (150);
-
-  m_webView->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
-  QAction *backAction =
-    new QAction (style->standardIcon (QStyle::SP_ArrowLeft),
-		 "", m_navigationToolBar);
-  QAction *forwardAction =
-    new QAction (style->standardIcon (QStyle::SP_ArrowRight),
-		 "", m_navigationToolBar);
-
-  m_navigationToolBar->addAction (backAction);
-  m_navigationToolBar->addAction (forwardAction);
-  m_navigationToolBar->addWidget (m_urlLineEdit);
-
-  QVBoxLayout *layout = new QVBoxLayout ();
-  layout->addWidget (m_navigationToolBar);
-  layout->addWidget (m_webView);
-
-    QWidget *bottomWidget = new QWidget (this);
-    QHBoxLayout *bottomLineLayout = new QHBoxLayout ();
-    bottomLineLayout->addWidget (m_progressBar);
-    bottomLineLayout->addWidget (m_statusBar);
-    bottomLineLayout->setMargin (0);
-    bottomWidget->setLayout (bottomLineLayout);
-
-  layout->addWidget (bottomWidget);
-  layout->setMargin (2);
-  setLayout (layout);
-
-  connect (backAction, SIGNAL (triggered ()), m_webView, SLOT (back ()));
-  connect (forwardAction, SIGNAL (triggered ()), m_webView,
-	   SLOT (forward ()));
-  connect (m_webView, SIGNAL (urlChanged (QUrl)), this, SLOT (setUrl (QUrl)));
-  connect (m_urlLineEdit, SIGNAL (returnPressed ()), this,
-	   SLOT (jumpToWebsite ()));
-
-  connect (m_webView, SIGNAL (statusBarMessage(QString)),
-           m_statusBar, SLOT (showMessage(QString)));
-  connect (m_webView, SIGNAL (loadProgress(int)),
-           m_progressBar, SLOT (setValue(int)));
-}
-
-void
-BrowserWidget::setUrl (QUrl url)
-{
-  m_urlLineEdit->setText (url.toString ());
-}
-
-void
-BrowserWidget::jumpToWebsite ()
-{
-  QString url = m_urlLineEdit->text ();
-  if (!url.startsWith ("http://") && !url.startsWith ("https://"))
-    url = "http://" + url;
-  load (url);
-}
-
-void
-BrowserWidget::showStatusMessage (QString message)
-{
-  m_statusBar->showMessage (message, 1000);
-}
-
-void
-BrowserWidget::load (QUrl url)
-{
-  m_webView->load (url);
-}
--- a/gui/src/BrowserWidget.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef BROWSERMDISUBWINDOW_H
-#define BROWSERMDISUBWINDOW_H
-
-#include <QWidget>
-#include <QToolBar>
-#include <QLineEdit>
-#include <QtWebKit/QWebView>
-#include <QStatusBar>
-#include <QProgressBar>
-
-class BrowserWidget:public QWidget
-{
-  Q_OBJECT
-public:
-  BrowserWidget (QWidget * parent = 0);
-  void load (QUrl url);
-
-public slots:
-  void setUrl (QUrl url);
-  void jumpToWebsite ();
-  void showStatusMessage (QString message);
-
-private:
-  void construct ();
-
-  QLineEdit *m_urlLineEdit;
-  QToolBar *m_navigationToolBar;
-  QWebView *m_webView;
-  QStatusBar *m_statusBar;
-  QProgressBar *m_progressBar;
-};
-
-#endif // BROWSERMDISUBWINDOW_H
--- a/gui/src/CommandLineParser.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "CommandLineParser.h"
-
-CommandLineParser::CommandLineParser ()
-{
-}
-
-void
-CommandLineParser::registerOption (CommandLineOption commandLineOption)
-{
-  if (m_registeredCommandLineOptions.contains(commandLineOption))
-    m_registeredCommandLineOptions.append(commandLineOption);
-}
-
-void
-CommandLineParser::registerOption (QString longOption, QString shortOption, QString description, bool withArgument)
-{
-  CommandLineOption commandLineOption;
-  commandLineOption.longOption = longOption;
-  commandLineOption.shortOption = shortOption;
-  commandLineOption.description = description;
-  commandLineOption.withArgument = withArgument;
-  registerOption (commandLineOption);
-}
-
-void
-CommandLineParser::parse (int argc, char** argv)
-{
-  Q_UNUSED(argc);
-  Q_UNUSED(argv);
-}
--- a/gui/src/CommandLineParser.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef COMMANDLINEPARSER_H
-#define COMMANDLINEPARSER_H
-
-#include <QList>
-#include <QString>
-
-class CommandLineParser
-{
-public:
-  struct CommandLineOption
-  {
-    QString longOption;
-    QString shortOption;
-    QString description;
-    bool withArgument;
-
-    bool operator== (CommandLineOption other)
-    {
-        return longOption == other.longOption
-            || shortOption == other.shortOption;
-    }
-  };
-
-  CommandLineParser ();
-  void registerOption (CommandLineOption commandLineOption);
-  void registerOption (QString longOption, QString shortOption, QString description, bool withArgument);
-  void parse (int argc, char** argv);
-
-private:
-  QList<CommandLineOption> m_registeredCommandLineOptions;
-};
-
-#endif // COMMANDLINEPARSER_H
--- a/gui/src/FileEditorMdiSubWindow.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,596 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "FileEditorMdiSubWindow.h"
-#include <QVBoxLayout>
-#include <QApplication>
-#include <QFile>
-#include <QFont>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QStyle>
-#include <QTextStream>
-
-FileEditorMdiSubWindow::FileEditorMdiSubWindow (QWidget * parent):QMdiSubWindow
-  (parent)
-{
-  construct ();
-}
-
-FileEditorMdiSubWindow::~FileEditorMdiSubWindow ()
-{
-}
-
-void
-FileEditorMdiSubWindow::closeEvent(QCloseEvent *event)
-{
-  if ( m_mainWindow->isCloseApplication() )
-    {
-      // close wohle application: save file or not if modified
-      checkFileModified ("Close Octave GUI",0); // no cancel possible
-    }
-  else
-    {
-      // ignore close event if file is not saved and user cancels closing this window
-      if (checkFileModified ("Close File",QMessageBox::Cancel)==QMessageBox::Cancel)
-        event->ignore();
-      else
-        event->accept();
-    }
-}
-
-void
-FileEditorMdiSubWindow::handleMarginClicked(int margin, int line, Qt::KeyboardModifiers state)
-{
-  Q_UNUSED (state);
-  if ( margin == 1 )  // marker margin
-    {
-      unsigned int mask = m_editor->markersAtLine (line);
-      if (mask && (1 << MARKER_BOOKMARK))
-        m_editor->markerDelete(line,MARKER_BOOKMARK);
-      else
-        m_editor->markerAdd(line,MARKER_BOOKMARK);
-    }
-}
-
-void
-FileEditorMdiSubWindow::newWindowTitle(bool modified)
-{
-  QString title(m_fileName);
-  if ( !m_longTitle )
-    {
-      QFileInfo file(m_fileName);
-      title = file.fileName();
-    }
-  if ( modified )
-    {
-      setWindowTitle(title.prepend("* "));
-    }
-  else
-     setWindowTitle (title);
-}
-
-void
-FileEditorMdiSubWindow::handleCopyAvailable(bool enableCopy)
-{
-  m_copyAction->setEnabled(enableCopy);
-  m_cutAction->setEnabled(enableCopy);
-}
-
-
-void
-FileEditorMdiSubWindow::openFile ()
-{
-    if (checkFileModified ("Open File",QMessageBox::Cancel)==QMessageBox::Cancel)
-      {
-        return; // existing file not saved and opening another file canceled by user
-      }
-    QString openFileName;
-    QFileDialog dlg(this);
-    dlg.setNameFilter(SAVE_FILE_FILTER);
-    dlg.setAcceptMode(QFileDialog::AcceptOpen);
-    dlg.setViewMode(QFileDialog::Detail);
-    if ( dlg.exec() )
-      {
-        openFileName = dlg.selectedFiles().at(0);
-        if (openFileName.isEmpty ())
-          return;
-        loadFile(openFileName);
-      }
-}
-
-void
-FileEditorMdiSubWindow::loadFile (QString fileName)
-{
-  QFile file (fileName);
-  if (!file.open (QFile::ReadOnly))
-    {
-      QMessageBox::warning (this, tr ("File Editor"),
-			    tr ("Cannot read file %1:\n%2.").arg (fileName).
-			    arg (file.errorString ()));
-      return;
-    }
-
-  QTextStream in (&file);
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-  m_editor->setText (in.readAll ());
-  QApplication::restoreOverrideCursor ();
-
-  m_fileName = fileName;
-  newWindowTitle (false); // window title (no modification)
-  m_statusBar->showMessage (tr ("File loaded."), 2000);
-  m_editor->setModified (false); // loaded file is not modified yet
-}
-
-void
-FileEditorMdiSubWindow::newFile ()
-{
-    if (checkFileModified ("Create New File",QMessageBox::Cancel)==QMessageBox::Cancel)
-      {
-        return; // existing file not saved and creating new file canceled by user
-      }
-    m_fileName = UNNAMED_FILE;
-    newWindowTitle (false); // window title (no modification)
-    m_editor->setText ("");
-    m_editor->setModified (false); // new file is not modified yet
-}
-
-int
-FileEditorMdiSubWindow::checkFileModified (QString msg, int cancelButton)
-{
-  int decision = QMessageBox::Yes;
-  if (m_editor->isModified ())
-    {
-      // file is modified but not saved, aks user what to do
-      decision = QMessageBox::warning (this,
-                                        msg,
-                                        tr ("The file %1\n"
-                                            "has been modified. Do you want to save the changes?").
-                                          arg (m_fileName),
-                                        QMessageBox::Save, QMessageBox::Discard, cancelButton );
-      if (decision == QMessageBox::Save)
-        {
-          saveFile ();
-          if (m_editor->isModified ())
-            {
-              // If the user attempted to save the file, but it's still
-              // modified, then probably something went wrong, so return cancel
-              // for cancel this operation or try to save files as if cancel not
-              // possible
-              if ( cancelButton )
-                return (QMessageBox::Cancel);
-              else
-                saveFileAs ();
-            }
-        }
-    }
-  return (decision);
-}
-
-void
-FileEditorMdiSubWindow::saveFile ()
-{
-  saveFile(m_fileName);
-}
-
-void
-FileEditorMdiSubWindow::saveFile (QString saveFileName)
-{
-  // it is a new file with the name "<unnamed>" -> call saveFielAs
-  if (saveFileName==UNNAMED_FILE || saveFileName.isEmpty ())
-    {
-      saveFileAs();
-      return;
-    }
-
-  // open the file for writing
-  QFile file (saveFileName);
-  if (!file.open (QFile::WriteOnly))
-    {
-      QMessageBox::warning (this, tr ("File Editor"),
-			    tr ("Cannot write file %1:\n%2.").
-          arg (saveFileName).arg (file.errorString ()));
-      return;
-    }
-
-  // save the contents into the file
-  QTextStream out (&file);
-  QApplication::setOverrideCursor (Qt::WaitCursor);
-  out << m_editor->text ();
-  QApplication::restoreOverrideCursor ();
-  m_fileName = saveFileName;  // save file name for later use
-  newWindowTitle(false);      // set the window title to actual file name (not modified)
-  m_statusBar->showMessage (tr ("File %1 saved").arg(m_fileName), 2000);
-  m_editor->setModified (false); // files is save -> not modified
-}
-
-void
-FileEditorMdiSubWindow::saveFileAs ()
-{
-  QString saveFileName(m_fileName);
-  QFileDialog dlg(this);
-  if (saveFileName==UNNAMED_FILE || saveFileName.isEmpty ())
-    {
-      saveFileName = QDir::homePath();
-      dlg.setDirectory(saveFileName);
-    }
-  else
-    {
-      dlg.selectFile(saveFileName);
-    }
-  dlg.setNameFilter(SAVE_FILE_FILTER);
-  dlg.setDefaultSuffix("m");
-  dlg.setAcceptMode(QFileDialog::AcceptSave);
-  dlg.setViewMode(QFileDialog::Detail);
-  if ( dlg.exec() )
-    {
-      saveFileName = dlg.selectedFiles().at(0);
-      if (saveFileName.isEmpty ())
-        return;
-      saveFile(saveFileName);
-    }
-}
-
-// handle the run command
-void
-FileEditorMdiSubWindow::runFile ()
-{
-  if (m_editor->isModified ())
-    saveFile(m_fileName);
-  m_terminalView->sendText (QString ("run \'%1\'\n").arg (m_fileName));
-  //m_terminalView->widget ()->setFocus ();
-}
-
-
-// (un)comment selected text
-void
-FileEditorMdiSubWindow::commentSelectedText ()
-{
-  doCommentSelectedText (true);
-}
-void
-FileEditorMdiSubWindow::uncommentSelectedText ()
-{
-  doCommentSelectedText (false);
-}
-void
-FileEditorMdiSubWindow::doCommentSelectedText (bool comment)
-{
-  if ( m_editor->hasSelectedText() )
-    {
-      int lineFrom, lineTo, colFrom, colTo, i;
-      m_editor->getSelection (&lineFrom,&colFrom,&lineTo,&colTo);
-      if ( colTo == 0 )  // the beginning of last line is not selected
-        lineTo--;        // stop at line above
-      m_editor->beginUndoAction ();
-      for ( i=lineFrom; i<=lineTo; i++ )
-        {
-          if ( comment )
-            m_editor->insertAt("%",i,0);
-          else
-            {
-               QString line(m_editor->text(i));
-               if ( line.startsWith("%") )
-                {
-                  m_editor->setSelection(i,0,i,1);
-                  m_editor->removeSelectedText();
-                }
-            }
-        }
-      m_editor->endUndoAction ();
-    }
-}
-
-
-// remove bookmarks
-void
-FileEditorMdiSubWindow::removeBookmark ()
-{
-  m_editor->markerDeleteAll(MARKER_BOOKMARK);
-}
-// toggle bookmark
-void
-FileEditorMdiSubWindow::toggleBookmark ()
-{
-  int line,cur;
-  m_editor->getCursorPosition(&line,&cur);
-  if ( m_editor->markersAtLine (line) && (1 << MARKER_BOOKMARK) )
-    m_editor->markerDelete(line,MARKER_BOOKMARK);
-  else
-    m_editor->markerAdd(line,MARKER_BOOKMARK);
-}
-// goto next bookmark
-void
-FileEditorMdiSubWindow::nextBookmark ()
-{
-  int line,cur,nextline;
-  m_editor->getCursorPosition(&line,&cur);
-  if ( m_editor->markersAtLine(line) && (1 << MARKER_BOOKMARK) )
-    line++; // we have a bookmark here, so start search from next line
-  nextline = m_editor->markerFindNext(line,(1 << MARKER_BOOKMARK));
-  m_editor->setCursorPosition(nextline,0);
-}
-// goto previous bookmark
-void
-FileEditorMdiSubWindow::prevBookmark ()
-{
-  int line,cur,prevline;
-  m_editor->getCursorPosition(&line,&cur);
-  if ( m_editor->markersAtLine(line) && (1 << MARKER_BOOKMARK) )
-    line--; // we have a bookmark here, so start search from prev line
-  prevline = m_editor->markerFindPrevious(line,(1 << MARKER_BOOKMARK));
-  m_editor->setCursorPosition(prevline,0);
-}
-
-// function for setting the already existing lexer from MainWindow
-void
-FileEditorMdiSubWindow::initEditor (AbstractTerminalView* terminalView,
-                                    LexerOctaveGui* lexer,
-                                    MainWindow* mainWindow)
-{
-  m_editor->setLexer(lexer);
-  m_terminalView = terminalView; // for sending commands to octave
-                       // TODO: make a global commandOctave function?
-  m_mainWindow = mainWindow;  // get the MainWindow for chekcing state at subwindow close
-}
-
-// TODO: Do we still need tool tips in the status bar? Tool tips are now
-//       shown directly at the theme icons
-void
-FileEditorMdiSubWindow::showToolTipNew ()
-{
-  m_statusBar->showMessage ("Create a new file", 2000);
-}
-
-void
-FileEditorMdiSubWindow::showToolTipOpen ()
-{
-  m_statusBar->showMessage ("Open a file", 2000);
-}
-
-void
-FileEditorMdiSubWindow::showToolTipSave ()
-{
-  m_statusBar->showMessage ("Save the file", 2000);
-}
-
-void
-FileEditorMdiSubWindow::showToolTipSaveAs ()
-{
-  m_statusBar->showMessage ("Save the file as", 2000);
-}
-
-void
-FileEditorMdiSubWindow::showToolTipUndo ()
-{
-  m_statusBar->showMessage ("Revert previous changes", 2000);
-}
-
-void
-FileEditorMdiSubWindow::showToolTipRedo ()
-{
-  m_statusBar->showMessage ("Append previous changes", 2000);
-}
-
-void
-FileEditorMdiSubWindow::registerModified (bool modified)
-{
-  m_modified = modified;
-}
-
-void
-FileEditorMdiSubWindow::construct ()
-{
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  QStyle *style = QApplication::style ();
-  setWidget (new QWidget ());
-
-  m_menuBar = new QMenuBar (this);
-  m_toolBar = new QToolBar (this);
-  m_statusBar = new QStatusBar (this);
-  m_editor = new QsciScintilla (this);
-
-  // markers
-  m_editor->setMarginType (1, QsciScintilla::SymbolMargin);
-  m_editor->setMarginSensitivity(1,true);
-  m_editor->markerDefine(QsciScintilla::RightTriangle,MARKER_BOOKMARK);
-  connect(m_editor,SIGNAL(marginClicked(int,int,Qt::KeyboardModifiers)),
-          this,SLOT(handleMarginClicked(int,int,Qt::KeyboardModifiers)));
-
-  // line numbers
-  m_editor->setMarginsForegroundColor(QColor(96,96,96));
-  m_editor->setMarginsBackgroundColor(QColor(232,232,220));
-  if ( settings->value ("editor/showLineNumbers",true).toBool () )
-    {
-      QFont marginFont( settings->value ("editor/fontName","Courier").toString () ,
-                        settings->value ("editor/fontSize",10).toInt () );
-      m_editor->setMarginsFont( marginFont );
-      QFontMetrics metrics(marginFont);
-      m_editor->setMarginType (2, QsciScintilla::TextMargin);
-      m_editor->setMarginWidth(2, metrics.width("99999"));
-      m_editor->setMarginLineNumbers(2, true);
-    }
-  // code folding
-  m_editor->setMarginType (3, QsciScintilla::SymbolMargin);
-  m_editor->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3);
-  // other features
-  if ( settings->value ("editor/highlightActualLine",true).toBool () )
-    {
-      m_editor->setCaretLineVisible(true);
-      m_editor->setCaretLineBackgroundColor(QColor(255,255,200));
-    }
-  m_editor->setBraceMatching (QsciScintilla::SloppyBraceMatch);
-  m_editor->setAutoIndent (true);
-  m_editor->setIndentationWidth (2);
-  m_editor->setIndentationsUseTabs (false);
-  if ( settings->value ("editor/codeCompletion",true).toBool () )
-    {
-      m_editor->autoCompleteFromAll();
-      m_editor->setAutoCompletionSource(QsciScintilla::AcsAPIs);
-      m_editor->setAutoCompletionThreshold (3);
-    }
-  m_editor->setUtf8 (true);
-  m_longTitle = settings->value ("editor/longWindowTitle",true).toBool ();
-
-  // The Actions
-
-  // Theme icons with QStyle icons as fallback
-  QAction *closeAction = new QAction (
-        QIcon::fromTheme("window-close",style->standardIcon (QStyle::SP_DialogCloseButton)),
-        tr("&Close File"), m_toolBar);
-  QAction *newAction = new QAction (
-        QIcon::fromTheme("document-new",style->standardIcon (QStyle::SP_FileIcon)),
-        tr("&New File"), m_toolBar);
-  QAction *openAction = new QAction (
-        QIcon::fromTheme("document-open",style->standardIcon (QStyle::SP_DirOpenIcon)),
-        tr("&Open File"), m_toolBar);
-  QAction *saveAction = new QAction (
-        QIcon::fromTheme("document-save",style->standardIcon (QStyle::SP_DriveHDIcon)),
-        tr("&Save File"), m_toolBar);
-  QAction *saveAsAction = new QAction (
-        QIcon::fromTheme("document-save-as",style->standardIcon (QStyle::SP_DriveFDIcon)),
-        tr("Save File &As"), m_toolBar);
-  QAction *undoAction = new QAction (
-        QIcon::fromTheme("edit-undo",style->standardIcon (QStyle::SP_ArrowLeft)),
-        tr("&Undo"), m_toolBar);
-  QAction *redoAction = new QAction (
-        QIcon::fromTheme("edit-redo",style->standardIcon (QStyle::SP_ArrowRight)),
-        tr("&Redo"), m_toolBar);
-  m_copyAction = new QAction (QIcon::fromTheme("edit-copy"),tr("&Copy"),m_toolBar);
-  m_cutAction = new QAction (QIcon::fromTheme("edit-cut"),tr("Cu&t"),m_toolBar);
-  QAction *pasteAction = new QAction (QIcon::fromTheme("edit-paste"),tr("&Paste"),m_toolBar);
-  QAction *nextBookmarkAction = new QAction (tr("&Next Bookmark"),m_toolBar);
-  QAction *prevBookmarkAction = new QAction (tr("Pre&vious Bookmark"),m_toolBar);
-  QAction *toggleBookmarkAction = new QAction (tr("Toggle &Bookmark"),m_toolBar);
-  QAction *removeBookmarkAction = new QAction (tr("&Remove All Bookmarks"),m_toolBar);
-  QAction *commentSelectedAction = new QAction (tr("&Comment Selected Text"),m_toolBar);
-  QAction *uncommentSelectedAction = new QAction (tr("&Uncomment Selected Text"),m_toolBar);
-  QAction *runAction = new QAction (
-        QIcon::fromTheme("media-play",style->standardIcon (QStyle::SP_MediaPlay)),
-        tr("&Run File"), m_toolBar);
-
-  // some actions are disabled from the beginning
-  m_copyAction->setEnabled(false);
-  m_cutAction->setEnabled(false);
-  connect(m_editor,SIGNAL(copyAvailable(bool)),this,SLOT(handleCopyAvailable(bool)));
-
-  // short cuts
-  newAction->setShortcut(QKeySequence::New);
-  openAction->setShortcut(QKeySequence::Open);
-  saveAction->setShortcut(QKeySequence::Save);
-  saveAsAction->setShortcut(QKeySequence::SaveAs);
-  undoAction->setShortcut(QKeySequence::Undo);
-  redoAction->setShortcut(QKeySequence::Redo);
-  m_copyAction->setShortcut(QKeySequence::Copy);
-  m_cutAction->setShortcut(QKeySequence::Cut);
-  pasteAction->setShortcut(QKeySequence::Paste);
-  runAction->setShortcut(Qt::Key_F5);
-  nextBookmarkAction->setShortcut(Qt::Key_F2);
-  prevBookmarkAction->setShortcut(Qt::SHIFT + Qt::Key_F2);
-  toggleBookmarkAction->setShortcut(Qt::Key_F7);
-  commentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_R);
-  uncommentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_T);
-
-  // toolbar
-  m_toolBar->setIconSize(QSize(16,16)); // smaller icons (make configurable in user settings?)
-  m_toolBar->addAction (closeAction);
-  m_toolBar->addAction (newAction);
-  m_toolBar->addAction (openAction);
-  m_toolBar->addAction (saveAction);
-  m_toolBar->addAction (saveAsAction);
-  m_toolBar->addSeparator();
-  m_toolBar->addAction (undoAction);
-  m_toolBar->addAction (redoAction);
-  m_toolBar->addAction (m_copyAction);
-  m_toolBar->addAction (m_cutAction);
-  m_toolBar->addAction (pasteAction);
-  m_toolBar->addSeparator();
-  m_toolBar->addAction (runAction);
-
-  // menu bar  
-  QMenu *fileMenu = new QMenu(tr("&File"),m_menuBar);
-  fileMenu->addAction(newAction);
-  fileMenu->addAction(openAction);
-  fileMenu->addAction(saveAction);
-  fileMenu->addAction(saveAsAction);
-  fileMenu->addSeparator();
-  fileMenu->addAction (closeAction);
-  m_menuBar->addMenu(fileMenu);
-  QMenu *editMenu = new QMenu(tr("&Edit"),m_menuBar);
-  editMenu->addAction(undoAction);
-  editMenu->addAction(redoAction);
-  editMenu->addSeparator();
-  editMenu->addAction(m_copyAction);
-  editMenu->addAction(m_cutAction);
-  editMenu->addAction(pasteAction);
-  editMenu->addSeparator();
-  editMenu->addAction(commentSelectedAction);
-  editMenu->addAction(uncommentSelectedAction);
-  editMenu->addSeparator();
-  editMenu->addAction(toggleBookmarkAction);
-  editMenu->addAction(nextBookmarkAction);
-  editMenu->addAction(prevBookmarkAction);
-  editMenu->addAction(removeBookmarkAction);
-  m_menuBar->addMenu(editMenu);
-  QMenu *runMenu = new QMenu(tr("&Run"),m_menuBar);
-  runMenu->addAction(runAction);
-  m_menuBar->addMenu(runMenu);
-
-
-  QVBoxLayout *layout = new QVBoxLayout ();
-  layout->addWidget (m_menuBar);
-  layout->addWidget (m_toolBar);
-  layout->addWidget (m_editor);
-  layout->addWidget (m_statusBar);
-  layout->setMargin (2);
-  widget ()->setLayout (layout);
-
-  connect (closeAction, SIGNAL (triggered()), this, SLOT (close()));
-  connect (newAction, SIGNAL (triggered ()), this, SLOT (newFile ()));
-  connect (openAction, SIGNAL (triggered ()), this, SLOT (openFile ()));
-  connect (undoAction, SIGNAL (triggered ()), m_editor, SLOT (undo ()));
-  connect (redoAction, SIGNAL (triggered ()), m_editor, SLOT (redo ()));
-  connect (m_copyAction, SIGNAL (triggered ()), m_editor, SLOT (copy ()));
-  connect (m_cutAction, SIGNAL (triggered ()), m_editor, SLOT (cut ()));
-  connect (pasteAction, SIGNAL (triggered ()), m_editor, SLOT (paste ()));
-  connect (saveAction, SIGNAL (triggered ()), this, SLOT (saveFile ()));
-  connect (saveAsAction, SIGNAL (triggered ()), this, SLOT (saveFileAs ()));
-  connect (runAction, SIGNAL (triggered ()), this, SLOT (runFile ()));
-  connect (toggleBookmarkAction, SIGNAL (triggered ()), this, SLOT (toggleBookmark ()));
-  connect (nextBookmarkAction, SIGNAL (triggered ()), this, SLOT (nextBookmark ()));
-  connect (prevBookmarkAction, SIGNAL (triggered ()), this, SLOT (prevBookmark ()));
-  connect (removeBookmarkAction, SIGNAL (triggered ()), this, SLOT (removeBookmark ()));
-  connect (commentSelectedAction, SIGNAL (triggered ()), this, SLOT (commentSelectedText ()));
-  connect (uncommentSelectedAction, SIGNAL (triggered ()), this, SLOT (uncommentSelectedText ()));
-
-  // TODO: Do we still need tool tips in the status bar? Tool tips are now
-  //       shown directly at the theme icons
-  connect (newAction, SIGNAL (hovered ()), this, SLOT (showToolTipNew ()));
-  connect (openAction, SIGNAL (hovered ()), this, SLOT (showToolTipOpen ()));
-  connect (undoAction, SIGNAL (hovered ()), this, SLOT (showToolTipUndo ()));
-  connect (redoAction, SIGNAL (hovered ()), this, SLOT (showToolTipRedo ()));
-  connect (saveAction, SIGNAL (hovered ()), this, SLOT (showToolTipSave ()));
-  connect (saveAsAction, SIGNAL (hovered ()), this,SLOT (showToolTipSaveAs ()));
-
-  // connect modified signal
-  connect (m_editor, SIGNAL (modificationChanged(bool)), this, SLOT (newWindowTitle(bool)) );
-
-  m_fileName = "";
-  newWindowTitle (false);
-  setWindowIcon(QIcon::fromTheme("accessories-text-editor",style->standardIcon (QStyle::SP_FileIcon)));
-  show ();
-}
--- a/gui/src/FileEditorMdiSubWindow.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef FILEEDITORMDISUBWINDOW_H
-#define FILEEDITORMDISUBWINDOW_H
-
-#include "MainWindow.h"
-#include "AbstractTerminalView.h"
-#include <QMdiSubWindow>
-#include <QToolBar>
-#include <QAction>
-#include <QMenuBar>
-#include <QStatusBar>
-#include <QCloseEvent>
-#include <Qsci/qsciscintilla.h>
-// Not available in the Debian repos yet!
-// #include <Qsci/qscilexeroctave.h>
-#include "lexer/lexeroctavegui.h"
-
-const char UNNAMED_FILE[]     = "<unnamed>";
-const char SAVE_FILE_FILTER[] = "Octave Files (*.m);;All Files (*.*)";
-enum MARKER
-  {
-    MARKER_BOOKMARK,
-    MARKER_BREAKPOINT
-  };
-
-class FileEditorMdiSubWindow:public QMdiSubWindow
-{
-Q_OBJECT public:
-  FileEditorMdiSubWindow (QWidget * parent = 0);
-  ~FileEditorMdiSubWindow ();
-  void loadFile (QString fileName);
-  void initEditor (AbstractTerminalView *terminalView,
-                   LexerOctaveGui *lexer,
-                   MainWindow *mainWindow);
-
-public slots:
-
-  void newFile ();
-  void openFile ();
-  void saveFile ();
-  void saveFile (QString fileName);
-  void saveFileAs ();
-
-  void showToolTipNew ();
-  void showToolTipOpen ();
-  void showToolTipSave ();
-  void showToolTipSaveAs ();
-  void showToolTipUndo ();
-  void showToolTipRedo ();
-  void registerModified (bool modified);
-
-protected:
-  void closeEvent(QCloseEvent *event);
-
-private:
-  int checkFileModified (QString msg, int cancelButton);
-  void construct ();
-  void doCommentSelectedText (bool comment);
-  QMenuBar *m_menuBar;
-  QToolBar *m_toolBar;
-  QsciScintilla *m_editor;
-  QStatusBar *m_statusBar;
-  QString m_fileName;
-  QString m_fileNameShort;
-  AbstractTerminalView* m_terminalView;
-  QAction* m_copyAction;
-  QAction* m_cutAction;
-  MainWindow* m_mainWindow;
-  int m_markerBookmark;
-  bool m_modified;
-  bool m_longTitle;
-
-private slots:
-  void newWindowTitle(bool modified);
-  void handleMarginClicked(int line, int margin, Qt::KeyboardModifiers state);
-  void handleCopyAvailable(bool enableCopy);
-  void runFile();
-  void removeBookmark ();
-  void toggleBookmark ();
-  void nextBookmark();
-  void prevBookmark();
-  void commentSelectedText();
-  void uncommentSelectedText();
-
-};
-
-#endif // FILEEDITORMDISUBWINDOW_H
--- a/gui/src/FilesDockWidget.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ResourceManager.h"
-#include "FilesDockWidget.h"
-
-#include <QApplication>
-#include <QFileInfo>
-#include <QCompleter>
-#include <QSettings>
-#include <QProcess>
-#include <QDebug>
-
-FilesDockWidget::FilesDockWidget (QWidget * parent):QDockWidget (parent)
-{
-  setObjectName ("FilesDockWidget");
-  setWindowTitle (tr ("Current Directory"));
-  setWidget (new QWidget (this));
-
-  // Create a toolbar
-  m_navigationToolBar = new QToolBar ("", widget ());
-  m_navigationToolBar->setAllowedAreas (Qt::TopToolBarArea);
-  m_navigationToolBar->setMovable (false);
-  m_navigationToolBar->setIconSize (QSize (20, 20));
-
-  // Add a button to the toolbar with the QT standard icon for up-directory
-  // TODO: Maybe change this to be an up-directory icon that is OS specific???
-  QStyle *style = QApplication::style ();
-  m_directoryIcon = style->standardIcon (QStyle::SP_FileDialogToParent);
-  m_directoryUpAction = new QAction (m_directoryIcon, "", m_navigationToolBar);
-  m_directoryUpAction->setStatusTip (tr ("Move up one directory."));
-
-  m_currentDirectory = new QLineEdit (m_navigationToolBar);
-  m_currentDirectory->setStatusTip (tr ("Enter the path or filename."));
-
-  m_navigationToolBar->addAction (m_directoryUpAction);
-  m_navigationToolBar->addWidget (m_currentDirectory);
-  connect (m_directoryUpAction, SIGNAL (triggered ()), this,
-	   SLOT (onUpDirectory ()));
-
-  // TODO: Add other buttons for creating directories
-
-  // Create the QFileSystemModel starting in the home directory
-  QString
-    homePath = QDir::homePath ();
-  // TODO: This should occur after Octave has been initialized and the startup directory of Octave is established
-
-  m_fileSystemModel = new QFileSystemModel (this);
-  m_fileSystemModel->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries);
-  QModelIndex
-    rootPathIndex = m_fileSystemModel->setRootPath (homePath);
-
-  // Attach the model to the QTreeView and set the root index
-  m_fileTreeView = new QTreeView (widget ());
-  m_fileTreeView->setModel (m_fileSystemModel);
-  m_fileTreeView->setRootIndex (rootPathIndex);
-  m_fileTreeView->setSortingEnabled (true);
-  m_fileTreeView->setAlternatingRowColors (true);
-  m_fileTreeView->setAnimated (true);
-  m_fileTreeView->setColumnHidden (1, true);
-  m_fileTreeView->setColumnHidden (2, true);
-  m_fileTreeView->setColumnHidden (3, true);
-  m_fileTreeView->setStatusTip (tr ("Doubleclick a file to open it."));
-
-  setCurrentDirectory (m_fileSystemModel->fileInfo (rootPathIndex).
-		       absoluteFilePath ());
-
-  connect (m_fileTreeView, SIGNAL (doubleClicked (const QModelIndex &)), this,
-	   SLOT (itemDoubleClicked (const QModelIndex &)));
-
-  // Layout the widgets vertically with the toolbar on top
-  QVBoxLayout *
-    layout = new QVBoxLayout ();
-  layout->setSpacing (0);
-  layout->addWidget (m_navigationToolBar);
-  layout->addWidget (m_fileTreeView);
-  layout->setMargin (1);
-  widget ()->setLayout (layout);
-  // TODO: Add right-click contextual menus for copying, pasting, deleting files (and others)
-
-  connect (m_currentDirectory, SIGNAL (returnPressed ()), this,
-	   SLOT (currentDirectoryEntered ()));
-  QCompleter *
-    completer = new QCompleter (m_fileSystemModel, this);
-  m_currentDirectory->setCompleter (completer);
-
-  connect (this,
-           SIGNAL (visibilityChanged(bool)),
-           this,
-           SLOT(handleVisibilityChanged(bool)));
-}
-
-void
-FilesDockWidget::itemDoubleClicked (const QModelIndex & index)
-{
-  // Retrieve the file info associated with the model index.
-  QFileInfo fileInfo = m_fileSystemModel->fileInfo (index);
-
-  // If it is a directory, cd into it.
-  if (fileInfo.isDir ())
-    {
-      m_fileSystemModel->setRootPath (fileInfo.absolutePath ());
-      m_fileTreeView->setRootIndex (index);
-      setCurrentDirectory (m_fileSystemModel->fileInfo (index).
-			   absoluteFilePath ());
-    }
-  // Otherwise attempt to open it.
-  else
-    {
-      // Check if the user wants to use a custom file editor.
-      QSettings *settings = ResourceManager::instance ()->settings ();
-      if (settings->value ("useCustomFileEditor").toBool ())
-        {
-          QString editor = settings->value ("customFileEditor").toString ();
-          QStringList arguments;
-          arguments << fileInfo.filePath ();
-          QProcess::execute (editor, arguments);
-        }
-      else
-        {
-          emit openFile (fileInfo.filePath ());
-        }
-    }
-}
-
-void
-FilesDockWidget::setCurrentDirectory (QString currentDirectory)
-{
-  m_currentDirectory->setText (currentDirectory);
-}
-
-void
-FilesDockWidget::onUpDirectory (void)
-{
-  QDir dir =
-    QDir (m_fileSystemModel->filePath (m_fileTreeView->rootIndex ()));
-  dir.cdUp ();
-  m_fileSystemModel->setRootPath (dir.absolutePath ());
-  m_fileTreeView->setRootIndex (m_fileSystemModel->
-				index (dir.absolutePath ()));
-  setCurrentDirectory (dir.absolutePath ());
-}
-
-void
-FilesDockWidget::currentDirectoryEntered ()
-{
-  QFileInfo fileInfo (m_currentDirectory->text ());
-  if (fileInfo.isDir ())
-    {
-      m_fileTreeView->setRootIndex (m_fileSystemModel->
-				    index (fileInfo.absolutePath ()));
-      m_fileSystemModel->setRootPath (fileInfo.absolutePath ());
-      setCurrentDirectory (fileInfo.absoluteFilePath ());
-    }
-  else
-    {
-      if (QFile::exists (fileInfo.absoluteFilePath ()))
-	emit openFile (fileInfo.absoluteFilePath ());
-    }
-}
-
-void
-FilesDockWidget::noticeSettings ()
-{
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  m_fileTreeView->setColumnHidden (0, !settings->value ("showFilenames").toBool ());
-  m_fileTreeView->setColumnHidden (1, !settings->value ("showFileSize").toBool ());
-  m_fileTreeView->setColumnHidden (2, !settings->value ("showFileType").toBool ());
-  m_fileTreeView->setColumnHidden (3, !settings->value ("showLastModified").toBool ());
-  m_fileTreeView->setAlternatingRowColors (settings->value ("useAlternatingRowColors").toBool ());
-  //if (settings.value ("showHiddenFiles").toBool ())
-  // TODO: React on option for hidden files.
-}
-
-void
-FilesDockWidget::handleVisibilityChanged (bool visible)
-{
-  if (visible)
-    emit activeChanged (true);
-}
-
-void
-FilesDockWidget::closeEvent (QCloseEvent *event)
-{
-  emit activeChanged (false);
-  QDockWidget::closeEvent (event);
-}
--- a/gui/src/FilesDockWidget.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef FILESDOCKWIDGET_H
-#define FILESDOCKWIDGET_H
-
-#include <QListView>
-#include <QDate>
-#include <QObject>
-#include <QWidget>
-#include <QListWidget>
-#include <QFileSystemModel>
-#include <QToolBar>
-#include <QToolButton>
-#include <QVBoxLayout>
-#include <QAction>
-#include <QTreeView>
-
-#include <QDockWidget>
-#include <QLineEdit>
-
-class FilesDockWidget:public QDockWidget
-{
-  Q_OBJECT
-public:
-  FilesDockWidget (QWidget * parent = 0);
-
-public slots:
-  /** Slot for handling a change in directory via double click. */
-  void itemDoubleClicked (const QModelIndex & index);
-
-  /** Slot for handling the up-directory button in the toolbar. */
-  void onUpDirectory ();
-
-  void setCurrentDirectory (QString currentDirectory);
-
-  void currentDirectoryEntered ();
-
-  /** Tells the widget to notice settings that are probably new. */
-  void noticeSettings ();
-  void handleVisibilityChanged (bool visible);
-
-signals:
-  void openFile (QString fileName);
-
-  /** Custom signal that tells if a user has clicke away that dock widget. */
-  void activeChanged (bool active);
-
-protected:
-  void closeEvent (QCloseEvent *event);
-
-private:
-  // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc
-
-    /** Toolbar for file and directory manipulation. */
-    QToolBar * m_navigationToolBar;
-
-    /** Variables for the up-directory action. */
-  QIcon m_directoryIcon;
-  QAction *m_directoryUpAction;
-  QToolButton *upDirectoryButton;
-
-    /** The file system model. */
-  QFileSystemModel *m_fileSystemModel;
-
-    /** The file system view. */
-  QTreeView *m_fileTreeView;
-  QLineEdit *m_currentDirectory;
-};
-
-#endif // FILESDOCKWIDGET_H
--- a/gui/src/HistoryDockWidget.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "HistoryDockWidget.h"
-#include <QVBoxLayout>
-
-HistoryDockWidget::HistoryDockWidget (QWidget * parent):QDockWidget (parent)
-{
-  setObjectName ("HistoryDockWidget");
-  construct ();
-}
-
-void
-HistoryDockWidget::construct ()
-{
-  m_sortFilterProxyModel.setSourceModel(OctaveLink::instance ()->historyModel());
-  m_historyListView = new QListView (this);
-  m_historyListView->setModel (&m_sortFilterProxyModel);
-  m_historyListView->setAlternatingRowColors (true);
-  m_historyListView->setEditTriggers (QAbstractItemView::NoEditTriggers);
-  m_historyListView->setStatusTip (tr ("Doubleclick a command to transfer it to the terminal."));
-  m_filterLineEdit = new QLineEdit (this);
-  m_filterLineEdit->setStatusTip (tr ("Enter text to filter the command history."));
-  QVBoxLayout *layout = new QVBoxLayout ();
-
-  setWindowTitle (tr ("Command History"));
-  setWidget (new QWidget ());
-
-  layout->addWidget (m_historyListView);
-  layout->addWidget (m_filterLineEdit);
-  layout->setMargin (2);
-
-  widget ()->setLayout (layout);
-
-  connect (m_filterLineEdit,
-           SIGNAL (textEdited (QString)),
-           &m_sortFilterProxyModel,
-           SLOT (setFilterWildcard(QString)));
-
-  connect (m_historyListView,
-           SIGNAL (doubleClicked (QModelIndex)),
-           this,
-           SLOT (handleDoubleClick (QModelIndex)));
-
-  connect (this,
-           SIGNAL (visibilityChanged(bool)),
-           this,
-           SLOT(handleVisibilityChanged(bool)));
-}
-
-void
-HistoryDockWidget::handleDoubleClick (QModelIndex modelIndex)
-{
-  emit commandDoubleClicked (modelIndex.data().toString());
-}
-
-void
-HistoryDockWidget::handleVisibilityChanged (bool visible)
-{
-  if (visible)
-    emit activeChanged (true);
-}
-
-void
-HistoryDockWidget::noticeSettings ()
-{
-    // TODO: React on a settings change.
-}
-
-void
-HistoryDockWidget::closeEvent (QCloseEvent *event)
-{
-  emit activeChanged (false);
-  QDockWidget::closeEvent (event);
-}
--- a/gui/src/HistoryDockWidget.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef HISTORYDOCKWIDGET_H
-#define HISTORYDOCKWIDGET_H
-
-#include <QDockWidget>
-#include <QLineEdit>
-#include <QListView>
-#include <QSortFilterProxyModel>
-#include "OctaveLink.h"
-
-class HistoryDockWidget:public QDockWidget
-{
-Q_OBJECT
-public:
-  HistoryDockWidget (QWidget *parent = 0);
-  void updateHistory (QStringList history);
-
-public slots:
-  void handleVisibilityChanged (bool visible);
-  void noticeSettings ();
-
-signals:
-  void information (QString message);
-  void commandDoubleClicked (QString command);
-  /** Custom signal that tells if a user has clicked away that dock widget. */
-  void activeChanged (bool active);
-protected:
-  void closeEvent (QCloseEvent *event);
-private slots:
-  void handleDoubleClick (QModelIndex modelIndex);
-
-private:
-  void construct ();
-  QListView *m_historyListView;
-  QLineEdit *m_filterLineEdit;
-  QSortFilterProxyModel m_sortFilterProxyModel;
-};
-
-#endif // HISTORYDOCKWIDGET_H
--- a/gui/src/ImageViewerMdiSubWindow.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ImageViewerMdiSubWindow.h"
-#include <QLabel>
-#include <QPixmap>
-#include <QScrollArea>
-
-ImageViewerMdiSubWindow::ImageViewerMdiSubWindow (QPixmap pixmap, QWidget * parent):QMdiSubWindow (parent),
-m_pixmap
-(pixmap)
-{
-  construct ();
-}
-
-void
-ImageViewerMdiSubWindow::construct ()
-{
-  QLabel *label = new QLabel ();
-  label->setBackgroundRole (QPalette::Base);
-  label->setSizePolicy (QSizePolicy::Ignored, QSizePolicy::Ignored);
-  label->setScaledContents (true);
-  label->setPixmap (m_pixmap);
-
-  QScrollArea *scrollArea = new QScrollArea (this);
-  scrollArea->setBackgroundRole (QPalette::Dark);
-  scrollArea->setWidget (label);
-  setWidget (scrollArea);
-}
--- a/gui/src/ImageViewerMdiSubWindow.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef IMAGEVIEWERMDISUBWINDOW_H
-#define IMAGEVIEWERMDISUBWINDOW_H
-
-#include <QMdiSubWindow>
-
-class ImageViewerMdiSubWindow:public QMdiSubWindow
-{
-public:
-  ImageViewerMdiSubWindow (QPixmap pixmap, QWidget * parent = 0);
-
-private:
-  void construct ();
-  QPixmap m_pixmap;
-};
-
-#endif // IMAGEVIEWERMDISUBWINDOW_H
--- a/gui/src/MainWindow.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,409 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <QMenuBar>
-#include <QMenu>
-#include <QAction>
-#include <QSettings>
-#include <QDesktopServices>
-#include <QFileDialog>
-#include <QMessageBox>
-#include "MainWindow.h"
-#include "FileEditorMdiSubWindow.h"
-#include "ImageViewerMdiSubWindow.h"
-#include "SettingsDialog.h"
-
-#define VERSION_STRING "Octave GUI (0.8.5)"
-
-MainWindow::MainWindow (QWidget * parent):QMainWindow (parent)
-{
-  construct ();
-  OctaveLink::instance ()->launchOctave();
-}
-
-MainWindow::~MainWindow ()
-{
-}
-
-void
-MainWindow::handleOpenFileRequest (QString fileName)
-{
-  reportStatusMessage (tr ("Opening file."));
-  QPixmap pixmap;
-  if (pixmap.load (fileName))
-    {
-//        ImageViewerMdiSubWindow *subWindow = new ImageViewerMdiSubWindow(pixmap, this);
-//        subWindow->setAttribute(Qt::WA_DeleteOnClose);
-//        m_centralMdiArea->addSubWindow(subWindow);
-//        subWindow->setWindowTitle(fileName);
-    }
-  else
-    {
-      openEditorFile(fileName);
-    }
-}
-
-void
-MainWindow::openEditor ()
-{
-  openEditorFile(QString());
-}
-void
-MainWindow::openEditorFile (QString fileName)
-{
-  FileEditorMdiSubWindow *subWindow = new FileEditorMdiSubWindow (m_centralMdiArea);
-  subWindow->setAttribute (Qt::WA_DeleteOnClose);
-  // check whether lexer is already prepared and prepare it if not
-  if ( m_lexer == NULL )
-    {
-      // this has to be done only once, not for each editor
-      m_lexer = new LexerOctaveGui();
-      // Editor font (default or from settings)
-      QSettings *settings = ResourceManager::instance ()->settings ();
-      m_lexer->setDefaultFont( QFont(
-                  settings->value ("editor/fontName","Courier").toString (),
-                  settings->value ("editor/fontSize",10).toInt () ) );
-      // TODO: Autoindent not working as it should
-      m_lexer->setAutoIndentStyle(QsciScintilla::AiMaintain ||
-                                  QsciScintilla::AiOpening  ||
-                                  QsciScintilla::AiClosing);
-      // The API info that is used for auto completion
-      // TODO: Where to store a file with API info (raw or prepared?)?
-      // TODO: Also provide infos on octave-forge functions?
-      // TODO: Also provide infos on function parameters?
-      // By now, use the keywords-list from syntax highlighting
-       m_lexerAPI = new QsciAPIs(m_lexer);
-       QString keyword;
-       QStringList keywordList;
-       keyword     = m_lexer->keywords(1);  // get whole string with all keywords
-       keywordList = keyword.split(QRegExp("\\s+"));  // split into single strings
-       int i;
-       for ( i=0; i<keywordList.size(); i++ )
-         {
-           m_lexerAPI->add(keywordList.at(i));  // add single strings to the API
-         }
-       m_lexerAPI->prepare();           // prepare API info ... this make take some time
-    }
-  subWindow->initEditor(m_terminalView, m_lexer, this);   // init necessary informations for editor
-
-  if ( fileName.isEmpty() )
-    subWindow->newFile ();
-  else
-    subWindow->loadFile (fileName);
-}
-
-
-void
-MainWindow::reportStatusMessage (QString statusMessage)
-{
-  m_statusBar->showMessage (statusMessage, 1000);
-}
-
-void
-MainWindow::openWebPage (QString url)
-{
-  m_documentationWidget->load (QUrl (url));
-}
-
-void
-MainWindow::handleSaveWorkspaceRequest ()
-{
-  QString selectedFile =
-    QFileDialog::getSaveFileName (this, tr ("Save Workspace"),
-                                  ResourceManager::instance ()->homePath ());
-  m_terminalView->sendText (QString ("save \'%1\'\n").arg (selectedFile));
-  m_terminalView->widget ()->setFocus ();
-}
-
-void
-MainWindow::handleLoadWorkspaceRequest ()
-{
-  QString selectedFile =
-    QFileDialog::getOpenFileName (this, tr ("Load Workspace"),
-                                  ResourceManager::instance ()->homePath ());
-  m_terminalView->sendText (QString ("load \'%1\'\n").arg (selectedFile));
-  m_terminalView->widget ()->setFocus ();
-}
-
-void
-MainWindow::handleClearWorkspaceRequest ()
-{
-  m_terminalView->sendText ("clear\n");
-  m_terminalView->widget ()->setFocus ();
-}
-
-void
-MainWindow::handleCommandDoubleClicked (QString command)
-{
-  m_terminalView->sendText (command);
-  m_terminalView->widget ()->setFocus ();
-}
-
-void
-MainWindow::handleUnreadMessages (bool yes)
-{
-  if (yes)
-    {
-      m_ircWidgetSubWindow
-        ->setWindowIcon
-          (ResourceManager::instance ()->icon (ResourceManager::ChatNewMessage));
-    }
-  else
-    {
-      m_ircWidgetSubWindow
-        ->setWindowIcon
-          (ResourceManager::instance ()->icon (ResourceManager::Chat));
-    }
-}
-
-void
-MainWindow::alignMdiWindows ()
-{
-  m_centralMdiArea->tileSubWindows ();
-}
-
-void
-MainWindow::openBugTrackerPage ()
-{
-  QDesktopServices::openUrl (QUrl ("http://savannah.gnu.org/bugs/?group=octave"));
-}
-
-void
-MainWindow::openAgoraPage ()
-{
-  QDesktopServices::openUrl (QUrl ("http://agora.panocha.org.mx/"));
-}
-
-void
-MainWindow::openOctaveForgePage ()
-{
-  QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/"));
-}
-
-void
-MainWindow::processSettingsDialogRequest ()
-{
-  SettingsDialog settingsDialog (this);
-  settingsDialog.exec ();
-  emit settingsChanged ();
-  ResourceManager::instance ()->updateNetworkSettings ();
-}
-
-void
-MainWindow::showAboutOctave ()
-{
-  QString message =
-      "GNU Octave\n"
-      "Copyright (C) 2009 John W. Eaton and others.\n"
-      "This is free software; see the source code for copying conditions."
-      "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or"
-      "FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.\n"
-      "\n"
-      "Octave was configured for \"x86_64-pc-linux-gnu\".\n"
-      "\n"
-      "Additional information about Octave is available at http://www.octave.org.\n"
-      "\n"
-      "Please contribute if you find this software useful."
-      "For more information, visit http://www.octave.org/help-wanted.html\n"
-      "\n"
-      "Report bugs to <bug@octave.org> (but first, please read"
-      "http://www.octave.org/bugs.html to learn how to write a helpful report).\n"
-      "\n"
-      "For information about changes from previous versions, type `news'.\n";
-
-  QMessageBox::about (this, tr ("About Octave"), message);
-}
-
-void
-MainWindow::showAboutQt ()
-{
-  QMessageBox::aboutQt (this);
-}
-
-void
-MainWindow::closeEvent (QCloseEvent * closeEvent)
-{
-  reportStatusMessage (tr ("Saving data and shutting down."));
-  writeSettings ();
-  m_closeApplication = true;  // inform editor window that whole application is closed
-  OctaveLink::instance ()->terminateOctave();
-  m_centralMdiArea->closeAllSubWindows();   // send close events to subwindows
-                                            // (editor files can be saved!)
-  QMainWindow::closeEvent (closeEvent);
-}
-
-void
-MainWindow::readSettings ()
-{
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
-  restoreState (settings->value ("MainWindow/windowState").toByteArray ());
-  m_centralMdiArea->restoreGeometry (settings->value ("MdiArea/geometry").toByteArray ());
-  emit settingsChanged ();
-}
-
-void
-MainWindow::writeSettings ()
-{
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  settings->setValue ("MainWindow/geometry", saveGeometry ());
-  settings->setValue ("MainWindow/windowState", saveState ());
-  settings->setValue ("MdiArea/geometry", m_centralMdiArea->saveGeometry ());
-}
-
-void
-MainWindow::construct ()
-{
-  m_closeApplication = false;   // flag for editor files when closed
-  setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Octave));
-
-  // Initialize MDI area.
-  m_centralMdiArea = new QMdiArea (this);
-  m_centralMdiArea->setObjectName ("CentralMdiArea");
-  m_centralMdiArea->setViewMode (QMdiArea::TabbedView);
-
-  // Setup dockable widgets and the status bar.
-  m_workspaceView = new WorkspaceView (this);
-  m_workspaceView->setStatusTip (tr ("View the variables in the active workspace."));
-  m_historyDockWidget = new HistoryDockWidget (this);
-  m_historyDockWidget->setStatusTip (tr ("Browse and search the command history."));
-  m_filesDockWidget = new FilesDockWidget (this);
-  m_filesDockWidget->setStatusTip (tr ("Browse your files."));
-  m_statusBar = new QStatusBar (this);
-
-  // Setup essential MDI Windows.
-  m_terminalView = AbstractTerminalView::create (this);
-  m_documentationWidget = new BrowserWidget (this);
-  m_ircWidget = new IRCWidget (this);
-
-  // Octave Terminal subwindow.
-  m_terminalViewSubWindow = new NonClosableMdiSubWindow (this);
-  m_terminalViewSubWindow->setWidget (m_terminalView->widget ());
-  m_centralMdiArea->addSubWindow (m_terminalViewSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
-
-  m_terminalViewSubWindow->setObjectName ("OctaveTerminalSubWindow");
-  m_terminalViewSubWindow->setWindowTitle (tr ("Terminal"));
-  m_terminalViewSubWindow
-      ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Terminal));
-  m_terminalViewSubWindow->setFocusProxy (m_terminalView->widget ());
-  m_terminalViewSubWindow->setStatusTip (tr ("Enter your commands into the Octave terminal."));
-  m_terminalViewSubWindow->setMinimumSize (300, 300);
-
-  // Documentation subwindow.
-  m_documentationWidgetSubWindow = new NonClosableMdiSubWindow (this);
-  m_documentationWidgetSubWindow->setWidget (m_documentationWidget);
-  m_centralMdiArea->addSubWindow (m_documentationWidgetSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
-
-  m_documentationWidgetSubWindow->setObjectName ("DocumentationWidgetSubWindow");
-  m_documentationWidgetSubWindow->setWindowTitle (tr ("Documentation"));
-  m_documentationWidgetSubWindow
-      ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Documentation));
-  m_documentationWidgetSubWindow->setFocusProxy (m_documentationWidget);
-  m_documentationWidgetSubWindow->setStatusTip (tr ("Browse the Octave documentation for help."));
-  m_documentationWidgetSubWindow->setMinimumSize (300, 300);
-
-  // Chat subwindow.
-  m_ircWidgetSubWindow = new NonClosableMdiSubWindow (this);
-  m_ircWidgetSubWindow->setWidget (m_ircWidget);
-  m_centralMdiArea->addSubWindow (m_ircWidgetSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
-
-  m_ircWidgetSubWindow->setObjectName ("ChatWidgetSubWindow");
-  m_ircWidgetSubWindow->setWindowTitle (tr ("Chat"));
-  m_ircWidgetSubWindow
-      ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Chat));
-  m_ircWidgetSubWindow->setStatusTip(tr ("Instantly chat with other Octave users for help."));
-  m_ircWidgetSubWindow->setFocusProxy (m_ircWidget);
-  m_ircWidgetSubWindow->setMinimumSize (300, 300);
-  connect (m_ircWidget, SIGNAL (unreadMessages (bool)), this, SLOT (handleUnreadMessages (bool)));
-
-  m_lexer = NULL;  // initialise the empty lexer for the edtiors
-
-  QMenu *controlMenu = menuBar ()->addMenu (tr ("Octave"));
-  QAction *settingsAction = controlMenu->addAction (tr ("Settings"));
-  controlMenu->addSeparator ();
-  QAction *exitAction = controlMenu->addAction (tr ("Exit"));
-
-  QMenu *interfaceMenu = menuBar ()->addMenu (tr ("Interface"));
-
-  QAction *alignWindowsAction = interfaceMenu->addAction (tr ("Align Windows"));
-  interfaceMenu->addSeparator ();
-  QAction *showWorkspaceAction = interfaceMenu->addAction (tr ("Workspace"));
-  showWorkspaceAction->setCheckable (true);
-
-  QAction *showHistoryAction = interfaceMenu->addAction (tr ("History"));
-  showHistoryAction->setCheckable (true);
-
-  QAction *showFileBrowserAction = interfaceMenu->addAction (tr ("File Browser"));
-  showFileBrowserAction->setCheckable (true);
-
-  interfaceMenu->addSeparator ();
-  QAction *openEditorAction = interfaceMenu->addAction (tr ("Open New Editor Window"));
-
-  QMenu *workspaceMenu = menuBar ()->addMenu (tr ("Workspace"));
-  QAction *loadWorkspaceAction = workspaceMenu->addAction (tr ("Load"));
-  QAction *saveWorkspaceAction = workspaceMenu->addAction (tr ("Save"));
-  workspaceMenu->addSeparator ();
-  QAction *clearWorkspaceAction = workspaceMenu->addAction (tr ("Clear"));
-
-  QMenu *communityMenu = menuBar ()->addMenu (tr ("Community"));
-  QAction *reportBugAction = communityMenu->addAction (tr ("Report Bug"));
-  QAction *agoraAction = communityMenu->addAction (tr ("Agora"));
-  QAction *octaveForgeAction = communityMenu->addAction (tr ("Octave Forge"));
-  communityMenu->addSeparator ();
-  QAction *aboutOctaveAction = communityMenu->addAction (tr ("About Octave"));
-  QAction *aboutQt = communityMenu->addAction (tr ("About Qt"));
-
-  connect (settingsAction, SIGNAL (triggered ()), this, SLOT (processSettingsDialogRequest ()));
-  connect (exitAction, SIGNAL (triggered ()), this, SLOT (close ()));
-  connect (alignWindowsAction, SIGNAL (triggered ()), this, SLOT (alignMdiWindows ()));
-  connect (openEditorAction, SIGNAL (triggered ()), this, SLOT (openEditor ()));
-  connect (reportBugAction, SIGNAL (triggered ()), this, SLOT (openBugTrackerPage ()));
-  connect (agoraAction, SIGNAL (triggered ()), this, SLOT (openAgoraPage ()));
-  connect (octaveForgeAction, SIGNAL (triggered ()), this, SLOT (openOctaveForgePage ()));
-  connect (aboutOctaveAction, SIGNAL (triggered ()), this, SLOT (showAboutOctave ()));
-  connect (aboutQt, SIGNAL (triggered ()), this, SLOT (showAboutQt ()));
-
-  connect (showWorkspaceAction, SIGNAL (toggled (bool)), m_workspaceView, SLOT (setShown (bool)));
-  connect (m_workspaceView, SIGNAL (activeChanged (bool)), showWorkspaceAction, SLOT (setChecked (bool)));
-  connect (showHistoryAction, SIGNAL (toggled (bool)), m_historyDockWidget, SLOT (setShown (bool)));
-  connect (m_historyDockWidget, SIGNAL (activeChanged (bool)), showHistoryAction, SLOT (setChecked (bool)));
-  connect (showFileBrowserAction, SIGNAL (toggled (bool)), m_filesDockWidget, SLOT (setShown (bool)));
-  connect (m_filesDockWidget, SIGNAL (activeChanged (bool)), showFileBrowserAction, SLOT (setChecked (bool)));
-
-  connect (this, SIGNAL (settingsChanged ()), m_workspaceView, SLOT (noticeSettings ()));
-  connect (this, SIGNAL (settingsChanged ()), m_historyDockWidget, SLOT (noticeSettings ()));
-  connect (this, SIGNAL (settingsChanged ()), m_filesDockWidget, SLOT (noticeSettings ()));
-
-  connect (m_filesDockWidget, SIGNAL (openFile (QString)), this, SLOT (handleOpenFileRequest (QString)));
-  connect (m_historyDockWidget, SIGNAL (information (QString)), this, SLOT (reportStatusMessage (QString)));
-  connect (m_historyDockWidget, SIGNAL (commandDoubleClicked (QString)), this, SLOT (handleCommandDoubleClicked (QString)));
-  connect (saveWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleSaveWorkspaceRequest ()));
-  connect (loadWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleLoadWorkspaceRequest ()));
-  connect (clearWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleClearWorkspaceRequest ()));
-
-  setWindowTitle (QString (VERSION_STRING));
-
-  setCentralWidget (m_centralMdiArea);
-  addDockWidget (Qt::LeftDockWidgetArea, m_workspaceView);
-  addDockWidget (Qt::LeftDockWidgetArea, m_historyDockWidget);
-  addDockWidget (Qt::RightDockWidgetArea, m_filesDockWidget);
-  setStatusBar (m_statusBar);
-
-  readSettings ();
-  openWebPage ("http://www.gnu.org/software/octave/doc/interpreter/");
-}
-
--- a/gui/src/MainWindow.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QtGui/QMainWindow>
-#include <QThread>
-#include <QTabWidget>
-#include <QMdiArea>
-#include <QStatusBar>
-#include <QToolBar>
-#include <QQueue>
-#include <Qsci/qsciapis.h>
-#include <QMdiSubWindow>
-#include "ResourceManager.h"
-#include "AbstractTerminalView.h"
-#include "OctaveLink.h"
-#include "WorkspaceView.h"
-#include "HistoryDockWidget.h"
-#include "FilesDockWidget.h"
-#include "BrowserWidget.h"
-#include "irc/IRCWidget.h"
-#include "lexer/lexeroctavegui.h"
-
-class NonClosableMdiSubWindow : public QMdiSubWindow
-{
-  Q_OBJECT
-public:
-  explicit NonClosableMdiSubWindow (QWidget *parent = 0)
-    : QMdiSubWindow (parent) { }
-  virtual ~NonClosableMdiSubWindow () { }
-protected:
-  void closeEvent (QCloseEvent *closeEvent)
-  {
-    closeEvent->ignore ();
-  }
-};
-
-/**
-  * \class MainWindow
-  *
-  * Represents the main window.
-  */
-class MainWindow:public QMainWindow
-{
-Q_OBJECT public:
-  MainWindow (QWidget * parent = 0);
-  ~MainWindow ();
-
-  AbstractTerminalView *terminalView ()
-  {
-    return m_terminalView;
-  }
-
-  HistoryDockWidget *historyDockWidget ()
-  {
-    return m_historyDockWidget;
-  }
-  FilesDockWidget *filesDockWidget ()
-  {
-    return m_filesDockWidget;
-  }
-  bool isCloseApplication ()
-  {
-    return m_closeApplication;
-  }
-
-signals:
-  void settingsChanged ();
-
-public slots:
-  void handleOpenFileRequest (QString fileName);
-  void reportStatusMessage (QString statusMessage);
-  void openWebPage (QString url);
-  void handleSaveWorkspaceRequest ();
-  void handleLoadWorkspaceRequest ();
-  void handleClearWorkspaceRequest ();
-  void handleCommandDoubleClicked (QString command);
-  void handleUnreadMessages (bool yes);
-  void alignMdiWindows ();
-  void openEditor ();
-  void openEditorFile (QString fileName);
-  void openBugTrackerPage ();
-  void openAgoraPage ();
-  void openOctaveForgePage ();
-  void processSettingsDialogRequest ();
-  void showAboutOctave ();
-  void showAboutQt ();
-
-protected:
-  void closeEvent (QCloseEvent * closeEvent);
-  void readSettings ();
-  void writeSettings ();
-
-private:
-  void construct ();
-  void establishOctaveLink ();
-  QMdiArea *m_centralMdiArea;
-
-  // Mdi sub windows.
-  AbstractTerminalView *m_terminalView;
-  BrowserWidget *m_documentationWidget;
-  IRCWidget *m_ircWidget;
-
-  NonClosableMdiSubWindow *m_terminalViewSubWindow;
-  NonClosableMdiSubWindow *m_documentationWidgetSubWindow;
-  NonClosableMdiSubWindow *m_ircWidgetSubWindow;
-
-  // Dock widgets.
-  WorkspaceView *m_workspaceView;
-  HistoryDockWidget *m_historyDockWidget;
-  FilesDockWidget *m_filesDockWidget;
-
-  // Editor's lexer
-  LexerOctaveGui *m_lexer;
-  QsciAPIs *m_lexerAPI;
-
-  // Toolbars.
-  QStatusBar *m_statusBar;
-
-  // Flag for closing whole application
-  bool m_closeApplication;
-
-};
-
-#endif // MAINWINDOW_H
--- a/gui/src/OctaveGUI.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <QtGui/QApplication>
-#include <QTranslator>
-#include <QSettings>
-#include "CommandLineParser.h"
-#include "WelcomeWizard.h"
-#include "ResourceManager.h"
-#include "MainWindow.h"
-
-int
-main (int argc, char *argv[])
-{
-  QApplication application (argc, argv);
-  while (true)
-    {
-      if (ResourceManager::instance ()->isFirstRun ())
-        {
-          WelcomeWizard welcomeWizard;
-          int returnCode = welcomeWizard.exec ();
-
-          QSettings *settings = ResourceManager::instance ()->settings ();
-          settings->setValue ("connectOnStartup", true);
-          settings->setValue ("showMessageOfTheDay", true);
-          settings->setValue ("showTopic", true);
-          settings->setValue ("autoIdentification", false);
-          settings->setValue ("nickServPassword", "");
-          settings->setValue ("useCustomFileEditor", false);
-          settings->setValue ("customFileEditor", "emacs");
-          settings->setValue ("editor/showLineNumbers", true);
-          settings->setValue ("editor/highlightActualLine", true);
-          settings->setValue ("editor/codeCompletion", true);
-          settings->setValue ("editor/fontName", "Monospace");
-          settings->setValue ("editor/fontSize", 10);
-          settings->setValue ("editor/shortWindowTitle", true);
-          settings->setValue ("showFilenames", true);
-          settings->setValue ("showFileSize", false);
-          settings->setValue ("showFileType", false);
-          settings->setValue ("showLastModified", false);
-          settings->setValue ("showHiddenFiles", false);
-          settings->setValue ("useAlternatingRowColors", true);
-          settings->setValue ("useProxyServer", false);
-          settings->setValue ("proxyType", "Sock5Proxy");
-          settings->setValue ("proxyHostName", "none");
-          settings->setValue ("proxyPort", 8080);
-          settings->setValue ("proxyUserName", "");
-          settings->setValue ("proxyPassword", "");
-          settings->sync ();
-          ResourceManager::instance ()->reloadSettings ();
-
-          application.quit ();
-          // We are in an infinite loop, so everything else than a return
-          // will cause the application to restart from the very beginning.
-          if (returnCode == QDialog::Rejected)
-            return 0;
-        }
-      else
-        {
-          CommandLineParser commandLineParser;
-          commandLineParser.registerOption ("--config", "-c", "Tells OctaveGUI to use that configuration file.", true);
-          commandLineParser.parse (argc, argv);
-
-          QSettings *settings = ResourceManager::instance ()->settings ();
-          QString language = settings->value ("language").toString ();
-
-          QString translatorFile = ResourceManager::instance ()->findTranslatorFile (language);
-          QTranslator translator;
-          translator.load (translatorFile);
-          application.installTranslator (&translator);
-
-          ResourceManager::instance ()->updateNetworkSettings ();
-          ResourceManager::instance ()->loadIcons ();
-
-          MainWindow w;
-          w.show ();
-          w.activateWindow();
-          return application.exec ();
-        }
-    }
-}
--- a/gui/src/ResourceManager.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1687 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ResourceManager.h"
-#include <QFile>
-#include <QNetworkProxy>
-
-ResourceManager ResourceManager::m_singleton;
-
-ResourceManager::ResourceManager ()
-{
-  m_settings = 0;
-  reloadSettings ();
-}
-
-ResourceManager::~ResourceManager ()
-{
-  delete m_settings;
-}
-
-QSettings *
-ResourceManager::settings ()
-{
-  return m_settings;
-}
-
-QString
-ResourceManager::homePath ()
-{
-  return m_homePath;
-}
-
-void
-ResourceManager::reloadSettings ()
-{
-  QDesktopServices desktopServices;
-  m_homePath = desktopServices.storageLocation (QDesktopServices::HomeLocation);
-  setSettings(m_homePath + "/.octave-gui");
-}
-
-void
-ResourceManager::setSettings (QString file)
-{
-  delete m_settings;
-
-  m_firstRun = false;
-  if (!QFile::exists (file))
-    m_firstRun = true;
-
-  // If the settings file does not exist, QSettings automatically creates it.
-  // Therefore we have to check if it exists before instantiating the settings object.
-  // That way we can detect if the user ran this application before.
-  m_settings = new QSettings (file, QSettings::IniFormat);
-}
-
-QString
-ResourceManager::findTranslatorFile (QString language)
-{
-  // TODO: Quick hack to be able to test language files.
-  return QString("../languages/%1.qm").arg(language);
-}
-
-QIcon
-ResourceManager::icon (Icon icon)
-{
-  if (m_icons.contains (icon))
-    {
-      return m_icons [icon];
-    }
-  return QIcon ();
-}
-
-bool
-ResourceManager::isFirstRun ()
-{
-  return m_firstRun;
-}
-
-void
-ResourceManager::updateNetworkSettings ()
-{
-  QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy;
-  if (m_settings->value ("useProxyServer").toBool ())
-    {
-      QString proxyTypeString = m_settings->value ("proxyType").toString ();
-      if (proxyTypeString == "Socks5Proxy")
-        {
-          proxyType = QNetworkProxy::Socks5Proxy;
-        }
-      else if (proxyTypeString == "HttpProxy")
-        {
-          proxyType = QNetworkProxy::HttpProxy;
-        }
-    }
-
-  QNetworkProxy proxy;
-  proxy.setType (proxyType);
-  proxy.setHostName (m_settings->value ("proxyHostName").toString ());
-  proxy.setPort (m_settings->value ("proxyPort").toInt ());
-  proxy.setUser (m_settings->value ("proxyUserName").toString ());
-  proxy.setPassword (m_settings->value ("proxyPassword").toString ());
-  QNetworkProxy::setApplicationProxy (proxy);
-}
-
-void
-ResourceManager::loadIcons ()
-{
-  m_icons [ResourceManager::Octave] = QIcon ("../media/logo.png");
-  m_icons [ResourceManager::Terminal] = QIcon ("../media/terminal.png");
-  m_icons [ResourceManager::Documentation] = QIcon ("../media/help_index.png");
-  m_icons [ResourceManager::Chat] = QIcon ("../media/chat.png");
-  m_icons [ResourceManager::ChatNewMessage] = QIcon ("../media/jabber_protocol.png");
-}
-
-const char*
-ResourceManager::octaveKeywords ()
-{
-  return
-      ".nargin. "
-      "EDITOR "
-      "EXEC_PATH "
-      "F_DUPFD "
-      "F_GETFD "
-      "F_GETFL "
-      "F_SETFD "
-      "F_SETFL "
-      "I "
-      "IMAGE_PATH "
-      "Inf "
-      "J "
-      "NA "
-      "NaN "
-      "OCTAVE_HOME "
-      "OCTAVE_VERSION "
-      "O_APPEND "
-      "O_ASYNC "
-      "O_CREAT "
-      "O_EXCL "
-      "O_NONBLOCK "
-      "O_RDONLY "
-      "O_RDWR "
-      "O_SYNC "
-      "O_TRUNC "
-      "O_WRONLY "
-      "PAGER "
-      "PAGER_FLAGS "
-      "PS1 "
-      "PS2 "
-      "PS4 "
-      "P_tmpdir "
-      "SEEK_CUR "
-      "SEEK_END "
-      "SEEK_SET "
-      "SIG "
-      "S_ISBLK "
-      "S_ISCHR "
-      "S_ISDIR "
-      "S_ISFIFO "
-      "S_ISLNK "
-      "S_ISREG "
-      "S_ISSOCK "
-      "WCONTINUE "
-      "WCOREDUMP "
-      "WEXITSTATUS "
-      "WIFCONTINUED "
-      "WIFEXITED "
-      "WIFSIGNALED "
-      "WIFSTOPPED "
-      "WNOHANG "
-      "WSTOPSIG "
-      "WTERMSIG "
-      "WUNTRACED "
-      "__accumarray_max__ "
-      "__accumarray_min__ "
-      "__accumarray_sum__ "
-      "__accumdim_sum__ "
-      "__all_opts__ "
-      "__builtins__ "
-      "__calc_dimensions__ "
-      "__contourc__ "
-      "__current_scope__ "
-      "__delaunayn__ "
-      "__dispatch__ "
-      "__display_tokens__ "
-      "__dsearchn__ "
-      "__dump_symtab_info__ "
-      "__end__ "
-      "__error_text__ "
-      "__finish__ "
-      "__fltk_ginput__ "
-      "__fltk_print__ "
-      "__fltk_uigetfile__ "
-      "__ftp__ "
-      "__ftp_ascii__ "
-      "__ftp_binary__ "
-      "__ftp_close__ "
-      "__ftp_cwd__ "
-      "__ftp_delete__ "
-      "__ftp_dir__ "
-      "__ftp_mget__ "
-      "__ftp_mkdir__ "
-      "__ftp_mode__ "
-      "__ftp_mput__ "
-      "__ftp_pwd__ "
-      "__ftp_rename__ "
-      "__ftp_rmdir__ "
-      "__get__ "
-      "__glpk__ "
-      "__gnuplot_drawnow__ "
-      "__gnuplot_get_var__ "
-      "__gnuplot_ginput__ "
-      "__gnuplot_has_feature__ "
-      "__gnuplot_open_stream__ "
-      "__gnuplot_print__ "
-      "__gnuplot_version__ "
-      "__go_axes__ "
-      "__go_axes_init__ "
-      "__go_close_all__ "
-      "__go_delete__ "
-      "__go_draw_axes__ "
-      "__go_draw_figure__ "
-      "__go_execute_callback__ "
-      "__go_figure__ "
-      "__go_figure_handles__ "
-      "__go_handles__ "
-      "__go_hggroup__ "
-      "__go_image__ "
-      "__go_line__ "
-      "__go_patch__ "
-      "__go_surface__ "
-      "__go_text__ "
-      "__go_uimenu__ "
-      "__gud_mode__ "
-      "__image_pixel_size__ "
-      "__init_fltk__ "
-      "__isa_parent__ "
-      "__keywords__ "
-      "__lexer_debug_flag__ "
-      "__lin_interpn__ "
-      "__list_functions__ "
-      "__magick_finfo__ "
-      "__magick_format_list__ "
-      "__magick_read__ "
-      "__magick_write__ "
-      "__makeinfo__ "
-      "__marching_cube__ "
-      "__next_line_color__ "
-      "__next_line_style__ "
-      "__operators__ "
-      "__parent_classes__ "
-      "__parser_debug_flag__ "
-      "__pathorig__ "
-      "__pchip_deriv__ "
-      "__plt_get_axis_arg__ "
-      "__print_parse_opts__ "
-      "__qp__ "
-      "__request_drawnow__ "
-      "__sort_rows_idx__ "
-      "__strip_html_tags__ "
-      "__token_count__ "
-      "__varval__ "
-      "__version_info__ "
-      "__voronoi__ "
-      "__which__ "
-      "abs "
-      "accumarray "
-      "accumdim "
-      "acos "
-      "acosd "
-      "acosh "
-      "acot "
-      "acotd "
-      "acoth "
-      "acsc "
-      "acscd "
-      "acsch "
-      "add_input_event_hook "
-      "addlistener "
-      "addpath "
-      "addproperty "
-      "addtodate "
-      "airy "
-      "all "
-      "allchild "
-      "allow_noninteger_range_as_index "
-      "amd "
-      "ancestor "
-      "and "
-      "angle "
-      "anova "
-      "ans "
-      "any "
-      "arch_fit "
-      "arch_rnd "
-      "arch_test "
-      "area "
-      "arg "
-      "argnames "
-      "argv "
-      "arma_rnd "
-      "arrayfun "
-      "asctime "
-      "asec "
-      "asecd "
-      "asech "
-      "asin "
-      "asind "
-      "asinh "
-      "assert "
-      "assignin "
-      "atan "
-      "atan2 "
-      "atand "
-      "atanh "
-      "atexit "
-      "autocor "
-      "autocov "
-      "autoload "
-      "autoreg_matrix "
-      "autumn "
-      "available_graphics_toolkits "
-      "axes "
-      "axis "
-      "balance "
-      "bar "
-      "barh "
-      "bartlett "
-      "bartlett_test "
-      "base2dec "
-      "beep "
-      "beep_on_error "
-      "bessel "
-      "besselh "
-      "besseli "
-      "besselj "
-      "besselk "
-      "bessely "
-      "beta "
-      "betacdf "
-      "betai "
-      "betainc "
-      "betainv "
-      "betaln "
-      "betapdf "
-      "betarnd "
-      "bicgstab "
-      "bicubic "
-      "bin2dec "
-      "bincoeff "
-      "binocdf "
-      "binoinv "
-      "binopdf "
-      "binornd "
-      "bitand "
-      "bitcmp "
-      "bitget "
-      "bitmax "
-      "bitor "
-      "bitpack "
-      "bitset "
-      "bitshift "
-      "bitunpack "
-      "bitxor "
-      "blackman "
-      "blanks "
-      "blkdiag "
-      "blkmm "
-      "bone "
-      "box "
-      "break "
-      "brighten "
-      "bsxfun "
-      "bug_report "
-      "builtin "
-      "bunzip2 "
-      "bzip2 "
-      "calendar "
-      "canonicalize_file_name "
-      "cart2pol "
-      "cart2sph "
-      "case "
-      "cast "
-      "cat "
-      "catch "
-      "cauchy_cdf "
-      "cauchy_inv "
-      "cauchy_pdf "
-      "cauchy_rnd "
-      "caxis "
-      "cbrt "
-      "ccolamd "
-      "cd "
-      "ceil "
-      "cell "
-      "cell2mat "
-      "cell2struct "
-      "celldisp "
-      "cellfun "
-      "cellidx "
-      "cellindexmat "
-      "cellslices "
-      "cellstr "
-      "center "
-      "cgs "
-      "char "
-      "chdir "
-      "chi2cdf "
-      "chi2inv "
-      "chi2pdf "
-      "chi2rnd "
-      "chisquare_test_homogeneity "
-      "chisquare_test_independence "
-      "chol "
-      "chol2inv "
-      "choldelete "
-      "cholinsert "
-      "cholinv "
-      "cholshift "
-      "cholupdate "
-      "chop "
-      "circshift "
-      "cla "
-      "clabel "
-      "class "
-      "clc "
-      "clear "
-      "clf "
-      "clg "
-      "clock "
-      "cloglog "
-      "close "
-      "closereq "
-      "colamd "
-      "colloc "
-      "colon "
-      "colorbar "
-      "colormap "
-      "colperm "
-      "colstyle "
-      "columns "
-      "comet "
-      "comet3 "
-      "comma "
-      "command_line_path "
-      "common_size "
-      "commutation_matrix "
-      "compan "
-      "compare_versions "
-      "compass "
-      "complement "
-      "completion_append_char "
-      "completion_matches "
-      "complex "
-      "computer "
-      "cond "
-      "condest "
-      "confirm_recursive_rmdir "
-      "conj "
-      "continue "
-      "contour "
-      "contour3 "
-      "contourc "
-      "contourf "
-      "contrast "
-      "conv "
-      "conv2 "
-      "convhull "
-      "convhulln "
-      "convn "
-      "cool "
-      "copper "
-      "copyfile "
-      "cor "
-      "cor_test "
-      "corrcoef "
-      "cos "
-      "cosd "
-      "cosh "
-      "cot "
-      "cotd "
-      "coth "
-      "cov "
-      "cplxpair "
-      "cputime "
-      "cquad "
-      "crash_dumps_octave_core "
-      "create_set "
-      "cross "
-      "csc "
-      "cscd "
-      "csch "
-      "cstrcat "
-      "csvread "
-      "csvwrite "
-      "csymamd "
-      "ctime "
-      "ctranspose "
-      "cummax "
-      "cummin "
-      "cumprod "
-      "cumsum "
-      "cumtrapz "
-      "curl "
-      "cut "
-      "cylinder "
-      "daspect "
-      "daspk "
-      "daspk_options "
-      "dasrt "
-      "dasrt_options "
-      "dassl "
-      "dassl_options "
-      "date "
-      "datenum "
-      "datestr "
-      "datetick "
-      "datevec "
-      "dbclear "
-      "dbcont "
-      "dbdown "
-      "dblquad "
-      "dbnext "
-      "dbquit "
-      "dbstack "
-      "dbstatus "
-      "dbstep "
-      "dbstop "
-      "dbtype "
-      "dbup "
-      "dbwhere "
-      "deal "
-      "deblank "
-      "debug "
-      "debug_on_error "
-      "debug_on_interrupt "
-      "debug_on_warning "
-      "dec2base "
-      "dec2bin "
-      "dec2hex "
-      "deconv "
-      "default_save_options "
-      "del2 "
-      "delaunay "
-      "delaunay3 "
-      "delaunayn "
-      "delete "
-      "dellistener "
-      "demo "
-      "det "
-      "detrend "
-      "diag "
-      "diary "
-      "diff "
-      "diffpara "
-      "diffuse "
-      "dir "
-      "discrete_cdf "
-      "discrete_inv "
-      "discrete_pdf "
-      "discrete_rnd "
-      "disp "
-      "dispatch "
-      "display "
-      "divergence "
-      "dlmread "
-      "dlmwrite "
-      "dmperm "
-      "dmult "
-      "do "
-      "do_braindead_shortcircuit_evaluation "
-      "do_string_escapes "
-      "doc "
-      "doc_cache_file "
-      "dos "
-      "dot "
-      "double "
-      "drawnow "
-      "dsearch "
-      "dsearchn "
-      "dump_prefs "
-      "dup2 "
-      "duplication_matrix "
-      "durbinlevinson "
-      "e "
-      "echo "
-      "echo_executing_commands "
-      "edit "
-      "edit_history "
-      "eig "
-      "eigs "
-      "ellipsoid "
-      "else "
-      "elseif "
-      "empirical_cdf "
-      "empirical_inv "
-      "empirical_pdf "
-      "empirical_rnd "
-      "end "
-      "end_try_catch "
-      "end_unwind_protect "
-      "endfor "
-      "endfunction "
-      "endgrent "
-      "endif "
-      "endpwent "
-      "endswitch "
-      "endwhile "
-      "eomday "
-      "eps "
-      "eq "
-      "erf "
-      "erfc "
-      "erfcx "
-      "erfinv "
-      "errno "
-      "errno_list "
-      "error "
-      "error_text "
-      "errorbar "
-      "etime "
-      "etree "
-      "etreeplot "
-      "eval "
-      "evalin "
-      "example "
-      "exec "
-      "exist "
-      "exit "
-      "exp "
-      "expcdf "
-      "expinv "
-      "expm "
-      "expm1 "
-      "exppdf "
-      "exprnd "
-      "eye "
-      "ezcontour "
-      "ezcontourf "
-      "ezmesh "
-      "ezmeshc "
-      "ezplot "
-      "ezplot3 "
-      "ezpolar "
-      "ezsurf "
-      "ezsurfc "
-      "f_test_regression "
-      "factor "
-      "factorial "
-      "fail "
-      "false "
-      "fcdf "
-      "fclear "
-      "fclose "
-      "fcntl "
-      "fdisp "
-      "feather "
-      "feof "
-      "ferror "
-      "feval "
-      "fflush "
-      "fft "
-      "fft2 "
-      "fftconv "
-      "fftfilt "
-      "fftn "
-      "fftshift "
-      "fftw "
-      "fgetl "
-      "fgets "
-      "fieldnames "
-      "figure "
-      "file_in_loadpath "
-      "file_in_path "
-      "fileattrib "
-      "filemarker "
-      "fileparts "
-      "fileread "
-      "filesep "
-      "fill "
-      "filter "
-      "filter2 "
-      "find "
-      "find_dir_in_path "
-      "findall "
-      "findobj "
-      "findstr "
-      "finite "
-      "finv "
-      "fix "
-      "fixed_point_format "
-      "flag "
-      "flipdim "
-      "fliplr "
-      "flipud "
-      "floor "
-      "fminbnd "
-      "fminunc "
-      "fmod "
-      "fnmatch "
-      "fopen "
-      "for "
-      "fork "
-      "format "
-      "formula "
-      "fpdf "
-      "fplot "
-      "fprintf "
-      "fputs "
-      "fractdiff "
-      "fread "
-      "freport "
-      "freqz "
-      "freqz_plot "
-      "frewind "
-      "frnd "
-      "fscanf "
-      "fseek "
-      "fskipl "
-      "fsolve "
-      "fstat "
-      "ftell "
-      "full "
-      "fullfile "
-      "func2str "
-      "function "
-      "functions "
-      "fwrite "
-      "fzero "
-      "gamcdf "
-      "gaminv "
-      "gamma "
-      "gammai "
-      "gammainc "
-      "gammaln "
-      "gampdf "
-      "gamrnd "
-      "gca "
-      "gcbf "
-      "gcbo "
-      "gcd "
-      "gcf "
-      "ge "
-      "gen_doc_cache "
-      "genpath "
-      "genvarname "
-      "geocdf "
-      "geoinv "
-      "geopdf "
-      "geornd "
-      "get "
-      "get_first_help_sentence "
-      "get_help_text "
-      "get_help_text_from_file "
-      "getappdata "
-      "getegid "
-      "getenv "
-      "geteuid "
-      "getfield "
-      "getgid "
-      "getgrent "
-      "getgrgid "
-      "getgrnam "
-      "gethostname "
-      "getpgrp "
-      "getpid "
-      "getppid "
-      "getpwent "
-      "getpwnam "
-      "getpwuid "
-      "getrusage "
-      "getuid "
-      "ginput "
-      "givens "
-      "glob "
-      "global "
-      "glpk "
-      "glpkmex "
-      "gls "
-      "gmap40 "
-      "gmres "
-      "gmtime "
-      "gnuplot_binary "
-      "gplot "
-      "gradient "
-      "graphics_toolkit "
-      "gray "
-      "gray2ind "
-      "grid "
-      "griddata "
-      "griddata3 "
-      "griddatan "
-      "gt "
-      "gtext "
-      "gunzip "
-      "gzip "
-      "hadamard "
-      "hamming "
-      "hankel "
-      "hanning "
-      "help "
-      "hess "
-      "hex2dec "
-      "hex2num "
-      "hggroup "
-      "hidden "
-      "hilb "
-      "hist "
-      "histc "
-      "history "
-      "history_control "
-      "history_file "
-      "history_size "
-      "history_timestamp_format_string "
-      "hold "
-      "home "
-      "horzcat "
-      "hot "
-      "hotelling_test "
-      "hotelling_test_2 "
-      "housh "
-      "hsv "
-      "hsv2rgb "
-      "hurst "
-      "hygecdf "
-      "hygeinv "
-      "hygepdf "
-      "hygernd "
-      "hypot "
-      "i "
-      "idivide "
-      "if "
-      "ifelse "
-      "ifft "
-      "ifft2 "
-      "ifftn "
-      "ifftshift "
-      "ignore_function_time_stamp "
-      "imag "
-      "image "
-      "imagesc "
-      "imfinfo "
-      "imread "
-      "imshow "
-      "imwrite "
-      "ind2gray "
-      "ind2rgb "
-      "ind2sub "
-      "index "
-      "inf "
-      "inferiorto "
-      "info "
-      "info_file "
-      "info_program "
-      "inline "
-      "inpolygon "
-      "input "
-      "inputname "
-      "int16 "
-      "int2str "
-      "int32 "
-      "int64 "
-      "int8 "
-      "interp1 "
-      "interp1q "
-      "interp2 "
-      "interp3 "
-      "interpft "
-      "interpn "
-      "intersect "
-      "intmax "
-      "intmin "
-      "intwarning "
-      "inv "
-      "inverse "
-      "invhilb "
-      "ipermute "
-      "iqr "
-      "is_absolute_filename "
-      "is_duplicate_entry "
-      "is_global "
-      "is_leap_year "
-      "is_rooted_relative_filename "
-      "is_valid_file_id "
-      "isa "
-      "isalnum "
-      "isalpha "
-      "isappdata "
-      "isargout "
-      "isascii "
-      "isbool "
-      "iscell "
-      "iscellstr "
-      "ischar "
-      "iscntrl "
-      "iscolumn "
-      "iscommand "
-      "iscomplex "
-      "isdebugmode "
-      "isdefinite "
-      "isdeployed "
-      "isdigit "
-      "isdir "
-      "isempty "
-      "isequal "
-      "isequalwithequalnans "
-      "isfield "
-      "isfigure "
-      "isfinite "
-      "isfloat "
-      "isglobal "
-      "isgraph "
-      "ishandle "
-      "ishermitian "
-      "ishghandle "
-      "ishold "
-      "isieee "
-      "isindex "
-      "isinf "
-      "isinteger "
-      "iskeyword "
-      "isletter "
-      "islogical "
-      "islower "
-      "ismac "
-      "ismatrix "
-      "ismember "
-      "ismethod "
-      "isna "
-      "isnan "
-      "isnull "
-      "isnumeric "
-      "isobject "
-      "isocolors "
-      "isonormals "
-      "isosurface "
-      "ispc "
-      "isprime "
-      "isprint "
-      "isprop "
-      "ispunct "
-      "israwcommand "
-      "isreal "
-      "isrow "
-      "isscalar "
-      "issorted "
-      "isspace "
-      "issparse "
-      "issquare "
-      "isstr "
-      "isstrprop "
-      "isstruct "
-      "issymmetric "
-      "isunix "
-      "isupper "
-      "isvarname "
-      "isvector "
-      "isxdigit "
-      "j "
-      "jet "
-      "kbhit "
-      "kendall "
-      "keyboard "
-      "kill "
-      "kolmogorov_smirnov_cdf "
-      "kolmogorov_smirnov_test "
-      "kolmogorov_smirnov_test_2 "
-      "kron "
-      "kruskal_wallis_test "
-      "krylov "
-      "krylovb "
-      "kurtosis "
-      "laplace_cdf "
-      "laplace_inv "
-      "laplace_pdf "
-      "laplace_rnd "
-      "lasterr "
-      "lasterror "
-      "lastwarn "
-      "lchol "
-      "lcm "
-      "ldivide "
-      "le "
-      "legend "
-      "legendre "
-      "length "
-      "lgamma "
-      "license "
-      "lin2mu "
-      "line "
-      "link "
-      "linkprop "
-      "linspace "
-      "list "
-      "list_in_columns "
-      "list_primes "
-      "load "
-      "loadaudio "
-      "loadimage "
-      "loadobj "
-      "localtime "
-      "log "
-      "log10 "
-      "log1p "
-      "log2 "
-      "logical "
-      "logistic_cdf "
-      "logistic_inv "
-      "logistic_pdf "
-      "logistic_regression "
-      "logistic_rnd "
-      "logit "
-      "loglog "
-      "loglogerr "
-      "logm "
-      "logncdf "
-      "logninv "
-      "lognpdf "
-      "lognrnd "
-      "logspace "
-      "lookfor "
-      "lookup "
-      "lower "
-      "ls "
-      "ls_command "
-      "lsode "
-      "lsode_options "
-      "lsqnonneg "
-      "lstat "
-      "lt "
-      "lu "
-      "luinc "
-      "luupdate "
-      "magic "
-      "mahalanobis "
-      "make_absolute_filename "
-      "makeinfo_program "
-      "manova "
-      "mark_as_command "
-      "mark_as_rawcommand "
-      "mat2cell "
-      "mat2str "
-      "matlabroot "
-      "matrix_type "
-      "max "
-      "max_recursion_depth "
-      "mcnemar_test "
-      "md5sum "
-      "mean "
-      "meansq "
-      "median "
-      "menu "
-      "merge "
-      "mesh "
-      "meshc "
-      "meshgrid "
-      "meshz "
-      "methods "
-      "mex "
-      "mexext "
-      "mfilename "
-      "mgorth "
-      "min "
-      "minus "
-      "mislocked "
-      "missing_function_hook "
-      "mist "
-      "mkdir "
-      "mkfifo "
-      "mkoctfile "
-      "mkpp "
-      "mkstemp "
-      "mktime "
-      "mldivide "
-      "mlock "
-      "mod "
-      "mode "
-      "moment "
-      "more "
-      "most "
-      "movefile "
-      "mpoles "
-      "mpower "
-      "mrdivide "
-      "mtimes "
-      "mu2lin "
-      "munlock "
-      "namelengthmax "
-      "nan "
-      "nargchk "
-      "nargin "
-      "nargout "
-      "nargoutchk "
-      "native_float_format "
-      "nbincdf "
-      "nbininv "
-      "nbinpdf "
-      "nbinrnd "
-      "nchoosek "
-      "ndgrid "
-      "ndims "
-      "ne "
-      "newplot "
-      "news "
-      "nextpow2 "
-      "nfields "
-      "nnz "
-      "nonzeros "
-      "norm "
-      "normcdf "
-      "normest "
-      "norminv "
-      "normpdf "
-      "normrnd "
-      "not "
-      "now "
-      "nproc "
-      "nth_element "
-      "nthroot "
-      "ntsc2rgb "
-      "null "
-      "num2cell "
-      "num2hex "
-      "num2str "
-      "numel "
-      "nzmax "
-      "ocean "
-      "octave_config_info "
-      "octave_core_file_limit "
-      "octave_core_file_name "
-      "octave_core_file_options "
-      "octave_tmp_file_name "
-      "ols "
-      "onCleanup "
-      "onenormest "
-      "ones "
-      "optimget "
-      "optimize_subsasgn_calls "
-      "optimset "
-      "or "
-      "orderfields "
-      "orient "
-      "orth "
-      "otherwise "
-      "output_max_field_width "
-      "output_precision "
-      "pack "
-      "page_output_immediately "
-      "page_screen_output "
-      "paren "
-      "pareto "
-      "parseparams "
-      "pascal "
-      "patch "
-      "path "
-      "pathdef "
-      "pathsep "
-      "pause "
-      "pbaspect "
-      "pcg "
-      "pchip "
-      "pclose "
-      "pcolor "
-      "pcr "
-      "peaks "
-      "periodogram "
-      "perl "
-      "perms "
-      "permute "
-      "perror "
-      "persistent "
-      "pi "
-      "pie "
-      "pie3 "
-      "pink "
-      "pinv "
-      "pipe "
-      "pkg "
-      "planerot "
-      "playaudio "
-      "plot "
-      "plot3 "
-      "plotmatrix "
-      "plotyy "
-      "plus "
-      "poisscdf "
-      "poissinv "
-      "poisspdf "
-      "poissrnd "
-      "pol2cart "
-      "polar "
-      "poly "
-      "polyaffine "
-      "polyarea "
-      "polyder "
-      "polyderiv "
-      "polyfit "
-      "polygcd "
-      "polyint "
-      "polyout "
-      "polyreduce "
-      "polyval "
-      "polyvalm "
-      "popen "
-      "popen2 "
-      "postpad "
-      "pow2 "
-      "power "
-      "powerset "
-      "ppder "
-      "ppint "
-      "ppjumps "
-      "ppplot "
-      "ppval "
-      "pqpnonneg "
-      "prctile "
-      "prepad "
-      "primes "
-      "print "
-      "print_empty_dimensions "
-      "print_struct_array_contents "
-      "print_usage "
-      "printf "
-      "prism "
-      "probit "
-      "prod "
-      "program_invocation_name "
-      "program_name "
-      "prop_test_2 "
-      "putenv "
-      "puts "
-      "pwd "
-      "qp "
-      "qqplot "
-      "qr "
-      "qrdelete "
-      "qrinsert "
-      "qrshift "
-      "qrupdate "
-      "quad "
-      "quad_options "
-      "quadcc "
-      "quadgk "
-      "quadl "
-      "quadv "
-      "quantile "
-      "quit "
-      "quiver "
-      "quiver3 "
-      "qz "
-      "qzhess "
-      "rainbow "
-      "rand "
-      "rande "
-      "randg "
-      "randi "
-      "randn "
-      "randp "
-      "randperm "
-      "range "
-      "rank "
-      "ranks "
-      "rat "
-      "rats "
-      "rcond "
-      "rdivide "
-      "re_read_readline_init_file "
-      "read_readline_init_file "
-      "readdir "
-      "readlink "
-      "real "
-      "reallog "
-      "realmax "
-      "realmin "
-      "realpow "
-      "realsqrt "
-      "record "
-      "rectangle "
-      "rectint "
-      "refresh "
-      "refreshdata "
-      "regexp "
-      "regexpi "
-      "regexprep "
-      "regexptranslate "
-      "rehash "
-      "rem "
-      "remove_input_event_hook "
-      "rename "
-      "repelems "
-      "replot "
-      "repmat "
-      "reset "
-      "reshape "
-      "residue "
-      "resize "
-      "restoredefaultpath "
-      "rethrow "
-      "return "
-      "rgb2hsv "
-      "rgb2ind "
-      "rgb2ntsc "
-      "ribbon "
-      "rindex "
-      "rmappdata "
-      "rmdir "
-      "rmfield "
-      "rmpath "
-      "roots "
-      "rose "
-      "rosser "
-      "rot90 "
-      "rotdim "
-      "round "
-      "roundb "
-      "rows "
-      "rref "
-      "rsf2csf "
-      "run "
-      "run_count "
-      "run_history "
-      "run_test "
-      "rundemos "
-      "runlength "
-      "runtests "
-      "save "
-      "save_header_format_string "
-      "save_precision "
-      "saveas "
-      "saveaudio "
-      "saveimage "
-      "saveobj "
-      "savepath "
-      "saving_history "
-      "scanf "
-      "scatter "
-      "scatter3 "
-      "schur "
-      "sec "
-      "secd "
-      "sech "
-      "semicolon "
-      "semilogx "
-      "semilogxerr "
-      "semilogy "
-      "semilogyerr "
-      "set "
-      "setappdata "
-      "setaudio "
-      "setdiff "
-      "setenv "
-      "setfield "
-      "setgrent "
-      "setpwent "
-      "setstr "
-      "setxor "
-      "shading "
-      "shell_cmd "
-      "shg "
-      "shift "
-      "shiftdim "
-      "sighup_dumps_octave_core "
-      "sign "
-      "sign_test "
-      "sigterm_dumps_octave_core "
-      "silent_functions "
-      "sin "
-      "sinc "
-      "sind "
-      "sinetone "
-      "sinewave "
-      "single "
-      "sinh "
-      "size "
-      "size_equal "
-      "sizemax "
-      "sizeof "
-      "skewness "
-      "sleep "
-      "slice "
-      "sombrero "
-      "sort "
-      "sortrows "
-      "source "
-      "spalloc "
-      "sparse "
-      "sparse_auto_mutate "
-      "spatan2 "
-      "spaugment "
-      "spchol "
-      "spchol2inv "
-      "spcholinv "
-      "spconvert "
-      "spcumprod "
-      "spcumsum "
-      "spdet "
-      "spdiag "
-      "spdiags "
-      "spearman "
-      "spectral_adf "
-      "spectral_xdf "
-      "specular "
-      "speed "
-      "spencer "
-      "speye "
-      "spfind "
-      "spfun "
-      "sph2cart "
-      "sphcat "
-      "sphere "
-      "spinmap "
-      "spinv "
-      "spkron "
-      "splchol "
-      "spline "
-      "split "
-      "split_long_rows "
-      "splu "
-      "spmax "
-      "spmin "
-      "spones "
-      "spparms "
-      "spprod "
-      "spqr "
-      "sprand "
-      "sprandn "
-      "sprandsym "
-      "sprank "
-      "spring "
-      "sprintf "
-      "spstats "
-      "spsum "
-      "spsumsq "
-      "spvcat "
-      "spy "
-      "sqp "
-      "sqrt "
-      "sqrtm "
-      "squeeze "
-      "sscanf "
-      "stairs "
-      "stat "
-      "static "
-      "statistics "
-      "std "
-      "stderr "
-      "stdin "
-      "stdnormal_cdf "
-      "stdnormal_inv "
-      "stdnormal_pdf "
-      "stdnormal_rnd "
-      "stdout "
-      "stem "
-      "stem3 "
-      "stft "
-      "str2double "
-      "str2func "
-      "str2mat "
-      "str2num "
-      "strcat "
-      "strchr "
-      "strcmp "
-      "strcmpi "
-      "strerror "
-      "strfind "
-      "strftime "
-      "string_fill_char "
-      "strjust "
-      "strmatch "
-      "strncmp "
-      "strncmpi "
-      "strptime "
-      "strread "
-      "strrep "
-      "strsplit "
-      "strtok "
-      "strtrim "
-      "strtrunc "
-      "struct "
-      "struct2cell "
-      "struct_levels_to_print "
-      "structfun "
-      "strvcat "
-      "studentize "
-      "sub2ind "
-      "subplot "
-      "subsasgn "
-      "subsindex "
-      "subspace "
-      "subsref "
-      "substr "
-      "substruct "
-      "sum "
-      "summer "
-      "sumsq "
-      "superiorto "
-      "suppress_verbose_help_message "
-      "surf "
-      "surface "
-      "surfc "
-      "surfl "
-      "surfnorm "
-      "svd "
-      "svd_driver "
-      "svds "
-      "swapbytes "
-      "switch "
-      "syl "
-      "sylvester_matrix "
-      "symamd "
-      "symbfact "
-      "symlink "
-      "symrcm "
-      "symvar "
-      "synthesis "
-      "system "
-      "t_test "
-      "t_test_2 "
-      "t_test_regression "
-      "table "
-      "tan "
-      "tand "
-      "tanh "
-      "tar "
-      "tcdf "
-      "tempdir "
-      "tempname "
-      "terminal_size "
-      "test "
-      "test2 "
-      "test3 "
-      "text "
-      "textread "
-      "textscan "
-      "tic "
-      "tilde_expand "
-      "time "
-      "times "
-      "tinv "
-      "title "
-      "tmpfile "
-      "tmpnam "
-      "toascii "
-      "toc "
-      "toeplitz "
-      "tolower "
-      "toupper "
-      "tpdf "
-      "trace "
-      "transpose "
-      "trapz "
-      "treelayout "
-      "treeplot "
-      "tril "
-      "trimesh "
-      "triplequad "
-      "triplot "
-      "trisurf "
-      "triu "
-      "trnd "
-      "true "
-      "try "
-      "tsearch "
-      "tsearchn "
-      "type "
-      "typecast "
-      "typeinfo "
-      "u_test "
-      "uigetdir "
-      "uigetfile "
-      "uimenu "
-      "uint16 "
-      "uint32 "
-      "uint64 "
-      "uint8 "
-      "uiputfile "
-      "umask "
-      "uminus "
-      "uname "
-      "undo_string_escapes "
-      "unidcdf "
-      "unidinv "
-      "unidpdf "
-      "unidrnd "
-      "unifcdf "
-      "unifinv "
-      "unifpdf "
-      "unifrnd "
-      "unimplemented "
-      "union "
-      "unique "
-      "unix "
-      "unlink "
-      "unmark_command "
-      "unmark_rawcommand "
-      "unmkpp "
-      "unpack "
-      "untabify "
-      "untar "
-      "until "
-      "unwind_protect "
-      "unwind_protect_cleanup "
-      "unwrap "
-      "unzip "
-      "uplus "
-      "upper "
-      "urlread "
-      "urlwrite "
-      "usage "
-      "usleep "
-      "validatestring "
-      "values "
-      "vander "
-      "var "
-      "var_test "
-      "varargin "
-      "varargout "
-      "vec "
-      "vech "
-      "vectorize "
-      "ver "
-      "version "
-      "vertcat "
-      "view "
-      "voronoi "
-      "voronoin "
-      "waitforbuttonpress "
-      "waitpid "
-      "warning "
-      "warning_ids "
-      "warranty "
-      "wavread "
-      "wavwrite "
-      "wblcdf "
-      "wblinv "
-      "wblpdf "
-      "wblrnd "
-      "weekday "
-      "weibcdf "
-      "weibinv "
-      "weibpdf "
-      "weibrnd "
-      "welch_test "
-      "what "
-      "which "
-      "while "
-      "white "
-      "whitebg "
-      "who "
-      "whos "
-      "whos_line_format "
-      "wienrnd "
-      "wilcoxon_test "
-      "wilkinson "
-      "winter "
-      "xlabel "
-      "xlim "
-      "xor "
-      "yes_or_no "
-      "ylabel "
-      "ylim "
-      "yulewalker "
-      "z_test "
-      "z_test_2 "
-      "zeros "
-      "zip "
-      "zlabel "
-      "zlim ";
-  /*            "break case catch continue do else elseif end end_unwind_protect "
-              "endfor endfunction endif endswitch endwhile for function "
-              "global if otherwise persistent return switch try until "
-              "unwind_protect unwind_protect_cleanup while";
-  */
-}
--- a/gui/src/ResourceManager.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef RESOURCEMANAGER_H
-#define RESOURCEMANAGER_H
-
-#include <QSettings>
-#include <QDesktopServices>
-#include <QMap>
-#include <QIcon>
-
-class ResourceManager
-{
-public:
-  enum Icon
-  {
-    Octave,
-    Terminal,
-    Documentation,
-    Chat,
-    ChatNewMessage
-  };
-
-  ~ResourceManager ();
-
-  static ResourceManager *
-  instance ()
-  {
-    return &m_singleton;
-  }
-
-  QSettings *settings ();
-  QString homePath ();
-  void reloadSettings ();
-  void setSettings (QString file);
-  QString findTranslatorFile (QString language);
-  void updateNetworkSettings ();
-  void loadIcons ();
-  QIcon icon (Icon icon);
-  bool isFirstRun ();
-
-  const char *octaveKeywords ();
-private:
-  ResourceManager ();
-
-  QSettings *m_settings;
-  QString m_homePath;
-  QMap <Icon, QIcon> m_icons;
-  static ResourceManager m_singleton;
-  bool m_firstRun;
-};
-
-#endif // RESOURCEMANAGER_H
--- a/gui/src/SettingsDialog.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ResourceManager.h"
-#include "SettingsDialog.h"
-#include "ui_SettingsDialog.h"
-#include <QSettings>
-
-SettingsDialog::SettingsDialog (QWidget * parent):
-QDialog (parent), ui (new Ui::SettingsDialog)
-{
-  ui->setupUi (this);
-
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  ui->connectOnStartup->setChecked (settings->value ("connectOnStartup").toBool ());
-  ui->showMessageOfTheDay->setChecked (settings->value ("showMessageOfTheDay").toBool ());
-  ui->showTopic->setChecked (settings->value ("showTopic").toBool ());
-  ui->autoIdentification->setChecked (settings->value ("autoIdentification").toBool ());
-  ui->nickServPassword->setText (settings->value ("nickServPassword").toString ());
-  ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor").toBool ());
-  ui->customFileEditor->setText (settings->value ("customFileEditor").toString ());
-  ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () );
-  ui->editor_highlightActualLine->setChecked (settings->value ("editor/highlightActualLine",true).toBool () );
-  ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () );
-  ui->editor_fontName->setCurrentFont (QFont (settings->value ("editor/fontName","Courier").toString()) );
-  ui->editor_fontSize->setValue (settings->value ("editor/fontSize",10).toInt ());
-  ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",true).toBool ());
-  ui->showFilenames->setChecked (settings->value ("showFilenames").toBool());
-  ui->showFileSize->setChecked (settings->value ("showFileSize").toBool());
-  ui->showFileType->setChecked (settings->value ("showFileType").toBool());
-  ui->showLastModified->setChecked (settings->value ("showLastModified").toBool());
-  ui->showHiddenFiles->setChecked (settings->value ("showHiddenFiles").toBool());
-  ui->useAlternatingRowColors->setChecked (settings->value ("useAlternatingRowColors").toBool());
-  ui->useProxyServer->setChecked (settings->value ("useProxyServer").toBool ());
-  ui->proxyHostName->setText (settings->value ("proxyHostName").toString ());
-
-  int currentIndex = 0;
-  QString proxyTypeString = settings->value ("proxyType").toString ();
-  while ( (currentIndex < ui->proxyType->count ()) && (ui->proxyType->currentText () != proxyTypeString))
-    {
-      currentIndex++;
-      ui->proxyType->setCurrentIndex (currentIndex);
-    }
-
-  ui->proxyPort->setText (settings->value ("proxyPort").toString ());
-  ui->proxyUserName->setText (settings->value ("proxyUserName").toString ());
-  ui->proxyPassword->setText (settings->value ("proxyPassword").toString ());
-}
-
-SettingsDialog::~SettingsDialog ()
-{
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  settings->setValue ("connectOnStartup", ui->connectOnStartup->isChecked ());
-  settings->setValue ("showMessageOfTheDay", ui->showMessageOfTheDay->isChecked ());
-  settings->setValue ("showTopic", ui->showTopic->isChecked ());
-  settings->setValue ("autoIdentification", ui->autoIdentification->isChecked ());
-  settings->setValue ("nickServPassword", ui->nickServPassword->text ());
-  settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ());
-  settings->setValue ("customFileEditor", ui->customFileEditor->text ());
-  settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ());
-  settings->setValue ("editor/highlightActualLine", ui->editor_highlightActualLine->isChecked ());
-  settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ());
-  settings->setValue ("editor/fontName", ui->editor_fontName->currentFont().family());
-  settings->setValue ("editor/fontSize", ui->editor_fontSize->value());
-  settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked());
-  settings->setValue ("showFilenames", ui->showFilenames->isChecked ());
-  settings->setValue ("showFileSize", ui->showFileSize->isChecked ());
-  settings->setValue ("showFileType", ui->showFileType->isChecked ());
-  settings->setValue ("showLastModified", ui->showLastModified->isChecked ());
-  settings->setValue ("showHiddenFiles", ui->showHiddenFiles->isChecked ());
-  settings->setValue ("useAlternatingRowColors", ui->useAlternatingRowColors->isChecked ());
-  settings->setValue ("useProxyServer", ui->useProxyServer->isChecked ());
-  settings->setValue ("proxyType", ui->proxyType->currentText ());
-  settings->setValue ("proxyHostName", ui->proxyHostName->text ());
-  settings->setValue ("proxyPort", ui->proxyPort->text ());
-  settings->setValue ("proxyUserName", ui->proxyUserName->text ());
-  settings->setValue ("proxyPassword", ui->proxyPassword->text ());
-  delete ui;
-}
--- a/gui/src/SettingsDialog.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef SETTINGSDIALOG_H
-#define SETTINGSDIALOG_H
-
-#include <QDialog>
-
-namespace Ui
-{
-  class SettingsDialog;
-}
-
-class SettingsDialog:public QDialog
-{
-Q_OBJECT public:
-  explicit SettingsDialog (QWidget * parent);
-  ~SettingsDialog ();
-
-private:
-  Ui::SettingsDialog * ui;
-};
-
-#endif // SETTINGSDIALOG_H
--- a/gui/src/SettingsDialog.ui	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,680 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SettingsDialog</class>
- <widget class="QDialog" name="SettingsDialog">
-  <property name="windowModality">
-   <enum>Qt::ApplicationModal</enum>
-  </property>
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>500</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>500</width>
-    <height>300</height>
-   </size>
-  </property>
-  <property name="maximumSize">
-   <size>
-    <width>500</width>
-    <height>300</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>Settings</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <item>
-    <widget class="QTabWidget" name="tabWidget">
-     <property name="currentIndex">
-      <number>0</number>
-     </property>
-     <widget class="QWidget" name="chatTab">
-      <attribute name="title">
-       <string>Chat</string>
-      </attribute>
-      <layout class="QGridLayout" name="gridLayout_2">
-       <item row="0" column="0">
-        <layout class="QVBoxLayout" name="verticalLayout">
-         <item>
-          <widget class="QCheckBox" name="connectOnStartup">
-           <property name="text">
-            <string>Connect to #octave on startup</string>
-           </property>
-           <property name="checked">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="showMessageOfTheDay">
-           <property name="text">
-            <string>Show message of the day</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="showTopic">
-           <property name="text">
-            <string>Show topic</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="autoIdentification">
-           <property name="text">
-            <string>Automatically identify on NickServ</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="label_2">
-           <property name="text">
-            <string>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</string>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout">
-           <item>
-            <spacer name="horizontalSpacer">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QLabel" name="label">
-             <property name="text">
-              <string>Password:</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QLineEdit" name="nickServPassword">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="echoMode">
-              <enum>QLineEdit::Password</enum>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="tab">
-      <attribute name="title">
-       <string>Editor</string>
-      </attribute>
-      <layout class="QGridLayout" name="gridLayout">
-       <item row="3" column="0">
-        <spacer name="verticalSpacer">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>158</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="1" column="0">
-        <layout class="QVBoxLayout" name="verticalLayout_7">
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_3">
-           <item>
-            <widget class="QCheckBox" name="useCustomFileEditor">
-             <property name="enabled">
-              <bool>true</bool>
-             </property>
-             <property name="text">
-              <string>Use custom file editor:</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QLineEdit" name="customFileEditor">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="text">
-              <string>emacs</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="editor_showLineNumbers">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="text">
-            <string>Show line numbers</string>
-           </property>
-           <property name="checked">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="editor_highlightActualLine">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="text">
-            <string>Highlight actual line</string>
-           </property>
-           <property name="checked">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="editor_codeCompletion">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="text">
-            <string>Code completion</string>
-           </property>
-           <property name="checked">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="editor_longWindowTitle">
-           <property name="text">
-            <string>Show complete path in window title</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item row="2" column="0">
-        <layout class="QHBoxLayout" name="horizontalLayout_4">
-         <item>
-          <widget class="QLabel" name="label_8">
-           <property name="text">
-            <string>Font</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QFontComboBox" name="editor_fontName">
-           <property name="editable">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="label_9">
-           <property name="text">
-            <string>Font Size</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="editor_fontSize">
-           <property name="minimum">
-            <number>2</number>
-           </property>
-           <property name="maximum">
-            <number>96</number>
-           </property>
-           <property name="value">
-            <number>10</number>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer_4">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="tab_2">
-      <attribute name="title">
-       <string>File Browser</string>
-      </attribute>
-      <layout class="QVBoxLayout" name="verticalLayout_3">
-       <item>
-        <widget class="QCheckBox" name="showFilenames">
-         <property name="text">
-          <string>Show filenames</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QCheckBox" name="showFileSize">
-         <property name="text">
-          <string>Show file size</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QCheckBox" name="showFileType">
-         <property name="text">
-          <string>Show file type</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QCheckBox" name="showLastModified">
-         <property name="text">
-          <string>Show date of last modification</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QCheckBox" name="showHiddenFiles">
-         <property name="text">
-          <string>Show hidden files</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QCheckBox" name="useAlternatingRowColors">
-         <property name="text">
-          <string>Alternating row colors</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="tab_3">
-      <attribute name="title">
-       <string>Network</string>
-      </attribute>
-      <layout class="QVBoxLayout" name="verticalLayout_4">
-       <item>
-        <widget class="QCheckBox" name="useProxyServer">
-         <property name="text">
-          <string>Use proxy server</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <layout class="QFormLayout" name="formLayout">
-         <item row="0" column="0">
-          <widget class="QLabel" name="label_3">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <property name="text">
-            <string>Proxy Type:</string>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="1">
-          <widget class="QComboBox" name="proxyType">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <item>
-            <property name="text">
-             <string>HttpProxy</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>Socks5Proxy</string>
-            </property>
-           </item>
-          </widget>
-         </item>
-         <item row="1" column="0">
-          <widget class="QLabel" name="label_4">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <property name="text">
-            <string>Hostname:</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="1">
-          <widget class="QLineEdit" name="proxyHostName">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="2" column="0">
-          <widget class="QLabel" name="label_5">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <property name="text">
-            <string>Port:</string>
-           </property>
-          </widget>
-         </item>
-         <item row="2" column="1">
-          <widget class="QLineEdit" name="proxyPort">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="3" column="0">
-          <widget class="QLabel" name="label_6">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <property name="text">
-            <string>Username:</string>
-           </property>
-          </widget>
-         </item>
-         <item row="3" column="1">
-          <widget class="QLineEdit" name="proxyUserName">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="4" column="0">
-          <widget class="QLabel" name="label_7">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <property name="text">
-            <string>Password:</string>
-           </property>
-          </widget>
-         </item>
-         <item row="4" column="1">
-          <widget class="QLineEdit" name="proxyPassword">
-           <property name="enabled">
-            <bool>false</bool>
-           </property>
-           <property name="echoMode">
-            <enum>QLineEdit::Password</enum>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>useCustomFileEditor</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>customFileEditor</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>111</x>
-     <y>62</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>343</x>
-     <y>63</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>autoIdentification</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>nickServPassword</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>261</x>
-     <y>139</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>384</x>
-     <y>229</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>proxyType</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>291</x>
-     <y>91</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>proxyHostName</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>291</x>
-     <y>124</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>proxyPort</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>364</x>
-     <y>154</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>label_3</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>59</x>
-     <y>91</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>label_4</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>69</x>
-     <y>122</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>label_5</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>44</x>
-     <y>152</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>proxyUserName</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>364</x>
-     <y>184</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>proxyPassword</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>364</x>
-     <y>214</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>label_6</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>68</x>
-     <y>182</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>useProxyServer</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>label_7</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>59</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>67</x>
-     <y>212</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_showLineNumbers</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_showLineNumbers</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>87</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>87</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_highlightActualLine</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_highlightActualLine</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>112</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>112</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_codeCompletion</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_codeCompletion</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>137</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>137</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
--- a/gui/src/TerminalHighlighter.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ResourceManager.h"
-#include "TerminalHighlighter.h"
-
-TerminalHighlighter::TerminalHighlighter(QTextDocument *parent)
-  : QSyntaxHighlighter(parent)
-{
-  HighlightingRule rule;
-
-  keywordFormat.setForeground(Qt::darkBlue);
-  QStringList keywordPatterns
-      = QString(ResourceManager::instance ()->octaveKeywords ()).split(" ", QString::SkipEmptyParts);
-   keywordPatterns << "GNU" << "Octave" << "OctaveGUI";
-
-  for (int i = 0; i < keywordPatterns.size (); i++)
-    keywordPatterns.replace(i, QString("\\b%1\\b").arg(keywordPatterns.at (i)));
-
-  foreach (const QString &pattern, keywordPatterns)
-    {
-      rule.pattern = QRegExp(pattern);
-      rule.format = keywordFormat;
-      highlightingRules.append(rule);
-    }
-
-  numberFormat.setForeground(Qt::darkRed);
-  rule.pattern = QRegExp("\\b[0-9\\.\\+\\-\\^]+\\b");
-  rule.format = numberFormat;
-  highlightingRules.append(rule);
-
-  doubleQouteFormat.setForeground(Qt::darkGreen);
-  rule.pattern = QRegExp("\"[^\"]*\"");
-  rule.format = doubleQouteFormat;
-  highlightingRules.append(rule);
-
-  functionFormat.setFontItalic(true);
-  functionFormat.setForeground(Qt::blue);
-  rule.pattern = QRegExp("\\b[A-Za-z0-9_]+\\s*(?=\\()");
-  rule.format = functionFormat;
-  highlightingRules.append(rule);
-
-  urlFormat.setForeground(Qt::darkYellow);
-  rule.pattern = QRegExp("((?:https?|ftp)://\\S+)");
-  rule.format = urlFormat;
-  highlightingRules.append(rule);
-
-  subCaptionFormat.setForeground (Qt::black);
-  subCaptionFormat.setFontItalic (true);
-  rule.pattern = QRegExp("^\\s+\\*.+$");
-  rule.format = subCaptionFormat;
-  highlightingRules.append(rule);
-
-  captionFormat.setForeground(Qt::black);
-  captionFormat.setFontWeight(QFont::Bold);
-  rule.pattern = QRegExp("^\\s+\\*\\*.+$");
-  rule.format = captionFormat;
-  highlightingRules.append(rule);
-}
-
-void TerminalHighlighter::highlightBlock(const QString &text)
-{
-  foreach (const HighlightingRule &rule, highlightingRules)
-    {
-      QRegExp expression(rule.pattern);
-      int index = expression.indexIn(text);
-      while (index >= 0)
-        {
-          int length = expression.matchedLength();
-          setFormat(index, length, rule.format);
-          index = expression.indexIn(text, index + length);
-        }
-    }
-}
--- a/gui/src/TerminalHighlighter.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TERMINALHIGHLIGHTER_H
-#define TERMINALHIGHLIGHTER_H
-
-#include <QSyntaxHighlighter>
-
-#include <QHash>
-#include <QTextCharFormat>
-
-class QTextDocument;
-
-class TerminalHighlighter : public QSyntaxHighlighter
-{
-    Q_OBJECT
-
-public:
-    TerminalHighlighter(QTextDocument *parent = 0);
-
-protected:
-    void highlightBlock(const QString &text);
-
-private:
-    struct HighlightingRule
-    {
-        QRegExp pattern;
-        QTextCharFormat format;
-    };
-
-    QVector<HighlightingRule> highlightingRules;
-    QTextCharFormat keywordFormat;
-    QTextCharFormat doubleQouteFormat;
-    QTextCharFormat functionFormat;
-    QTextCharFormat urlFormat;
-    QTextCharFormat captionFormat;
-    QTextCharFormat subCaptionFormat;
-    QTextCharFormat numberFormat;
-};
-
-
-#endif // TERMINALHIGHLIGHTER_H
--- a/gui/src/TerminalView.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "TerminalHighlighter.h"
-#include "TerminalView.h"
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QStringListModel>
-#include <QStringList>
-#include <QScrollBar>
-
-TerminalView::TerminalView (QWidget * parent)
-  : QPlainTextEdit (parent), Terminal ()
-{
-  setFont (QFont ("Monospace", 10));
-  setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
-  m_terminalEmulation = TerminalEmulation::newTerminalEmulation (this);
-
-  TerminalHighlighter *terminalHighlighter = new TerminalHighlighter ();
-  terminalHighlighter->setDocument (document ());
-}
-
-TerminalView::~TerminalView ()
-{
-}
-
-QTextCursor
-TerminalView::textCursor ()
-{
-  return QPlainTextEdit::textCursor();
-}
-
-void
-TerminalView::setTextCursor (const QTextCursor &cursor)
-{
-  QPlainTextEdit::setTextCursor (cursor);
-}
-
-void
-TerminalView::bell ()
-{
-}
-
-void
-TerminalView::keyPressEvent (QKeyEvent * keyEvent)
-{
-  if(m_terminalEmulation)
-    m_terminalEmulation->processKeyEvent (keyEvent);
-}
-
-void
-TerminalView::mousePressEvent (QMouseEvent *mouseEvent)
-{
-  // TODO: Pass mouse events to the terminal emulation.
-  mouseEvent->accept();
-}
-
-void
-TerminalView::mouseDoubleClickEvent (QMouseEvent *mouseEvent)
-{
-  // TODO: Pass mouse events to the terminal emulation.
-  mouseEvent->accept();
-}
-
-void
-TerminalView::wheelEvent (QWheelEvent *wheelEvent)
-{
-  // TODO: Pass mouse events to the terminal emulation.
-  wheelEvent->accept();
-}
--- a/gui/src/TerminalView.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef OCTAVETERMINAL_H
-#define OCTAVETERMINAL_H
-#include <QPlainTextEdit>
-#include "AbstractTerminalView.h"
-#include "TerminalEmulation.h"
-
-class TerminalView:
-  public QPlainTextEdit,
-  public AbstractTerminalView,
-  Terminal
-{
-Q_OBJECT
-public:
-  TerminalView (QWidget * parent = 0);
-  ~TerminalView ();
-
-  TerminalEmulation *terminalEmulation ()
-  {
-    return m_terminalEmulation;
-  }
-
-  // AbstractTerminalView interface
-  void sendText (const QString& text)
-    { m_terminalEmulation->transmitText(text); }
-  QWidget* widget (void) { return this; }
-
-  // Terminal Interface
-  QTextCursor textCursor();
-  void setTextCursor (const QTextCursor &cursor);
-  void bell ();
-
-protected:
-  void keyPressEvent (QKeyEvent *keyEvent);
-  void mousePressEvent (QMouseEvent *mouseEvent);
-  void mouseDoubleClickEvent (QMouseEvent *mouseEvent);
-  void wheelEvent (QWheelEvent *wheelEvent);
-
-private:
-  TerminalEmulation *m_terminalEmulation;
-};
-#endif // OCTAVETERMINAL_H
--- a/gui/src/WelcomeWizard.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "WelcomeWizard.h"
-#include "ui_WelcomeWizard.h"
-
-WelcomeWizard::WelcomeWizard (QWidget *parent) :
-  QDialog (parent),
-  ui (new Ui::WelcomeWizard)
-{
-  ui->setupUi (this);
-  connect (ui->nextButton1, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (ui->nextButton2, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (ui->nextButton3, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (ui->nextButton4, SIGNAL (clicked ()), this, SLOT (next ()));
-
-  connect (ui->previousButton2, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (ui->previousButton3, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (ui->previousButton4, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (ui->previousButton5, SIGNAL (clicked ()), this, SLOT (previous ()));
-}
-
-WelcomeWizard::~WelcomeWizard()
-{
-  delete ui;
-}
-
-void
-WelcomeWizard::next ()
-{
-  ui->stackedWidget->setCurrentIndex (ui->stackedWidget->currentIndex () + 1);
-}
-
-void
-WelcomeWizard::previous ()
-{
-  ui->stackedWidget->setCurrentIndex (ui->stackedWidget->currentIndex () - 1);
-}
-
--- a/gui/src/WelcomeWizard.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef WELCOMEWIZARD_H
-#define WELCOMEWIZARD_H
-
-#include <QDialog>
-
-namespace Ui {
-class WelcomeWizard;
-}
-
-class WelcomeWizard : public QDialog
-{
-  Q_OBJECT
-
-public:
-  explicit WelcomeWizard(QWidget *parent = 0);
-  ~WelcomeWizard();
-
-public slots:
-  void next ();
-  void previous ();
-
-private:
-  Ui::WelcomeWizard *ui;
-};
-
-#endif // WELCOMEWIZARD_H
--- a/gui/src/WelcomeWizard.ui	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,319 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>WelcomeWizard</class>
- <widget class="QDialog" name="WelcomeWizard">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>647</width>
-    <height>400</height>
-   </rect>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>647</width>
-    <height>400</height>
-   </size>
-  </property>
-  <property name="maximumSize">
-   <size>
-    <width>647</width>
-    <height>400</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>Welcome to GNU Octave</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <item>
-    <widget class="QStackedWidget" name="stackedWidget">
-     <property name="currentIndex">
-      <number>4</number>
-     </property>
-     <widget class="QWidget" name="page">
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <widget class="QLabel" name="label">
-         <property name="text">
-          <string>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at '~/.octave-gui'. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignJustify|Qt::AlignVCenter</set>
-         </property>
-         <property name="wordWrap">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="verticalSpacer">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>218</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <spacer name="horizontalSpacer">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QPushButton" name="nextButton1">
-           <property name="text">
-            <string>Next</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_2">
-      <layout class="QVBoxLayout" name="verticalLayout_4">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_3">
-         <item>
-          <spacer name="verticalSpacer_2">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout">
-           <item>
-            <widget class="QPushButton" name="previousButton2">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_2">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="nextButton2">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_3">
-      <layout class="QHBoxLayout" name="horizontalLayout_4">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_5">
-         <item>
-          <spacer name="verticalSpacer_3">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_3">
-           <item>
-            <widget class="QPushButton" name="previousButton3">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_3">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="nextButton3">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_4">
-      <layout class="QHBoxLayout" name="horizontalLayout_6">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_6">
-         <item>
-          <spacer name="verticalSpacer_4">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_5">
-           <item>
-            <widget class="QPushButton" name="previousButton4">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_4">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="nextButton4">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_5">
-      <layout class="QHBoxLayout" name="horizontalLayout_8">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_7">
-         <item>
-          <spacer name="verticalSpacer_5">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_7">
-           <item>
-            <widget class="QPushButton" name="previousButton5">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_5">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>40</width>
-               <height>20</height>
-              </size>
-             </property>
-            </spacer>
-           </item>
-           <item>
-            <widget class="QPushButton" name="finishButton">
-             <property name="text">
-              <string>Finish</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>finishButton</sender>
-   <signal>clicked()</signal>
-   <receiver>WelcomeWizard</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>577</x>
-     <y>372</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>323</x>
-     <y>199</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
--- a/gui/src/WinTerminalView.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "WinTerminalView.h"
-
-WinTerminalView::WinTerminalView (QWidget* parent)
-    : QConsole (parent)
-{
-}
-
-WinTerminalView::~WinTerminalView (void)
-{
-}
-
-void WinTerminalView::sendText (const QString& txt)
-{
-  QConsole::sendText (txt);
-}
--- a/gui/src/WinTerminalView.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Michael Goffioul (michael.goffioul@gmail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef WINTERMINALVIEW_H
-#define WINTERMINALVIEW_H
-
-#include "QConsole.h"
-#include "AbstractTerminalView.h"
-
-/**
-  * @class WinTerminalView
-  * A Windows terminal widget, based on QConsole.
-  */
-class WinTerminalView : public QConsole, public AbstractTerminalView
-{
-public:
-  WinTerminalView (QWidget* parent = 0);
-  ~WinTerminalView (void);
-
-  // AbstractTerminalView interface
-  void sendText (const QString&);
-  QWidget* widget (void) { return this; }
-};
-
-#endif // WINTERMINALVIEW_H
--- a/gui/src/WorkspaceView.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "WorkspaceView.h"
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QPushButton>
-
-WorkspaceView::WorkspaceView (QWidget * parent) : QDockWidget
-  (parent)
-{
-  setObjectName ("WorkspaceView");
-  setWindowTitle (tr ("Workspace"));
-
-  m_updateSemaphore = new QSemaphore (1);
-  QStringList headerLabels;
-  headerLabels << tr ("Name") << tr ("Type") << tr ("Value");
-  m_variablesTreeWidget = new QTreeWidget (this);
-  m_variablesTreeWidget->setHeaderHidden (false);
-  m_variablesTreeWidget->setHeaderLabels (headerLabels);
-
-  setWidget (new QWidget (this));
-  QVBoxLayout *layout = new QVBoxLayout ();
-  layout->addWidget (m_variablesTreeWidget);
-  layout->setMargin (2);
-  widget ()->setLayout (layout);
-
-  QTreeWidgetItem *treeWidgetItem = new QTreeWidgetItem ();
-  treeWidgetItem->setData (0, 0, QString (tr ("Local")));
-  m_variablesTreeWidget->insertTopLevelItem (0, treeWidgetItem);
-
-  treeWidgetItem = new QTreeWidgetItem ();
-  treeWidgetItem->setData (0, 0, QString (tr ("Global")));
-  m_variablesTreeWidget->insertTopLevelItem (1, treeWidgetItem);
-
-  treeWidgetItem = new QTreeWidgetItem ();
-  treeWidgetItem->setData (0, 0, QString (tr ("Persistent")));
-  m_variablesTreeWidget->insertTopLevelItem (2, treeWidgetItem);
-
-  treeWidgetItem = new QTreeWidgetItem ();
-  treeWidgetItem->setData (0, 0, QString (tr ("Hidden")));
-  m_variablesTreeWidget->insertTopLevelItem (3, treeWidgetItem);
-
-  m_variablesTreeWidget->expandAll ();
-  m_variablesTreeWidget->setAlternatingRowColors (true);
-  m_variablesTreeWidget->setAnimated (true);
-
-  connect (this,
-           SIGNAL (visibilityChanged(bool)),
-           this,
-           SLOT(handleVisibilityChanged(bool)));
-
-  connect (OctaveLink::instance(),
-           SIGNAL (symbolTableChanged()),
-           this,
-           SLOT (fetchSymbolTable()));
-}
-
-void
-WorkspaceView::noticeSettings ()
-{
-    // TODO: React on a settings change.
-}
-
-void
-WorkspaceView::updateTreeEntry (QTreeWidgetItem * treeItem, SymbolRecord symbolRecord)
-{
-  treeItem->setData (0, 0, QString (symbolRecord.name ().c_str ()));
-  treeItem->setData (1, 0,
-		     QString (symbolRecord.varval ().type_name ().c_str ()));
-  treeItem->setData (2, 0,
-		     OctaveLink::octaveValueAsQString (symbolRecord.
-						       varval ()));
-}
-
-void
-WorkspaceView::updateFromSymbolTable (QList < SymbolRecord > symbolTable)
-{
-  m_updateSemaphore->acquire ();
-  // Split the symbol table into its different scopes.
-  QList < SymbolRecord > localSymbolTable;
-  QList < SymbolRecord > globalSymbolTable;
-  QList < SymbolRecord > persistentSymbolTable;
-  QList < SymbolRecord > hiddenSymbolTable;
-
-  foreach (SymbolRecord symbolRecord, symbolTable)
-  {
-    // It's true that being global or hidden includes it's can mean it's also locally visible,
-    // but we want to distinguish that here.
-    if (symbolRecord.is_local () && !symbolRecord.is_global ()
-        && !symbolRecord.is_hidden ())
-      {
-        localSymbolTable.append (symbolRecord);
-      }
-
-    if (symbolRecord.is_global ())
-      {
-        globalSymbolTable.append (symbolRecord);
-      }
-
-    if (symbolRecord.is_persistent ())
-      {
-        persistentSymbolTable.append (symbolRecord);
-      }
-
-    if (symbolRecord.is_hidden ())
-      {
-        hiddenSymbolTable.append (symbolRecord);
-      }
-  }
-
-  updateScope (0, localSymbolTable);
-  updateScope (1, globalSymbolTable);
-  updateScope (2, persistentSymbolTable);
-  updateScope (3, hiddenSymbolTable);
-  m_updateSemaphore->release ();
-}
-
-void
-WorkspaceView::updateScope (int topLevelItemIndex, QList < SymbolRecord > symbolTable)
-{
-  // This method may be a little bit confusing; variablesList is a complete list of all
-  // variables that are in the workspace currently.
-  QTreeWidgetItem *topLevelItem =
-    m_variablesTreeWidget->topLevelItem (topLevelItemIndex);
-
-  // First we check, if any variables that exist in the model tree have to be updated
-  // or created. So we walk the variablesList check against the tree.
-  foreach (SymbolRecord symbolRecord, symbolTable)
-  {
-    int childCount = topLevelItem->childCount ();
-    bool alreadyExists = false;
-    QTreeWidgetItem *child;
-
-    // Search for the corresponding item in the tree. If it has been found, child
-    // will contain the appropriate QTreeWidgetItem* pointing at it.
-    for (int i = 0; i < childCount; i++)
-      {
-        child = topLevelItem->child (i);
-        if (child->data (0, 0).toString () ==
-            QString (symbolRecord.name ().c_str ()))
-          {
-            alreadyExists = true;
-            break;
-          }
-      }
-
-    // If it already exists, just update it.
-    if (alreadyExists)
-      {
-        updateTreeEntry (child, symbolRecord);
-      }
-    else
-      {
-        // It does not exist, so create a new one and set the right values.
-        child = new QTreeWidgetItem ();
-        updateTreeEntry (child, symbolRecord);
-        topLevelItem->addChild (child);
-      }
-  }
-
-  // Check the tree against the list for deleted variables.
-  for (int i = 0; i < topLevelItem->childCount (); i++)
-    {
-      bool existsInVariableList = false;
-      QTreeWidgetItem *child = topLevelItem->child (i);
-      foreach (SymbolRecord symbolRecord, symbolTable)
-        {
-          if (QString (symbolRecord.name ().c_str ()) ==
-              child->data (0, 0).toString ())
-            {
-              existsInVariableList = true;
-            }
-        }
-
-      if (!existsInVariableList)
-        {
-          topLevelItem->removeChild (child);
-          delete child;
-          i--;
-        }
-    }
-}
-
-void
-WorkspaceView::fetchSymbolTable ()
-{
-  OctaveLink::instance ()->acquireSymbolTable();
-  QList < SymbolRecord > symbolTable = OctaveLink::instance ()->symbolTable();
-  updateFromSymbolTable (symbolTable);
-  OctaveLink::instance ()->releaseSymbolTable();
-}
-
-void
-WorkspaceView::handleVisibilityChanged (bool visible)
-{
-  if (visible)
-  emit activeChanged (true);
-}
-
-void
-WorkspaceView::closeEvent (QCloseEvent *event)
-{
-  emit activeChanged (false);
-  QDockWidget::closeEvent (event);
-}
--- a/gui/src/WorkspaceView.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef WORKSPACEVIEW_H
-#define WORKSPACEVIEW_H
-
-#include <QDockWidget>
-#include <QTreeWidget>
-#include <QSemaphore>
-#include "OctaveLink.h"
-
-class WorkspaceView:public QDockWidget
-{
-  Q_OBJECT
-public:
-  WorkspaceView (QWidget * parent = 0);
-
-public slots:
-  void fetchSymbolTable ();
-  void handleVisibilityChanged (bool visible);
-  void noticeSettings ();
-
-signals:
-  /** Custom signal that tells if a user has clicke away that dock widget. */
-  void activeChanged (bool active);
-
-protected:
-  void closeEvent (QCloseEvent *event);
-
-private:
-  void updateFromSymbolTable (QList < SymbolRecord > symbolTable);
-  void updateTreeEntry (QTreeWidgetItem * treeItem, SymbolRecord symbolRecord);
-  void updateScope (int topLevelItemIndex, QList < SymbolRecord > symbolTable);
-
-  QTreeWidget *m_variablesTreeWidget;
-  QSemaphore *m_updateSemaphore;
-};
-
-#endif // WORKSPACEVIEW_H
--- a/gui/src/backend/OctaveCallbackThread.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "OctaveCallbackThread.h"
-#include "MainWindow.h"
-
-OctaveCallbackThread::OctaveCallbackThread (QObject * parent)
-  : QThread (parent)
-{
-  m_runningSemaphore = new QSemaphore(1);
-  m_running = true;
-}
-
-void
-OctaveCallbackThread::halt ()
-{
-  m_runningSemaphore->acquire ();
-  m_running = false;
-  m_runningSemaphore->release ();
-}
-
-void
-OctaveCallbackThread::run ()
-{
-  bool running = true;
-  while (running)
-    {
-      OctaveLink::instance ()->emitSymbolTableChanged();
-      OctaveLink::instance ()->updateHistoryModel ();
-      usleep (500000);
-
-      m_runningSemaphore->acquire ();
-      running = m_running;
-      m_runningSemaphore->release ();
-    }
-}
--- a/gui/src/backend/OctaveCallbackThread.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef OCTAVECALLBACKTHREAD_H
-#define OCTAVECALLBACKTHREAD_H
-
-#include <QThread>
-#include <QSemaphore>
-
-class OctaveCallbackThread:public QThread
-{
-  Q_OBJECT
-public:
-  void halt();
-  OctaveCallbackThread (QObject * parent);
-protected:
-  void run ();
-private:
-  QSemaphore *m_runningSemaphore;
-  bool m_running;
-};
-
-#endif // OCTAVECALLBACKTHREAD_H
--- a/gui/src/backend/OctaveLink.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 John P. Swensen, Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "OctaveLink.h"
-
-OctaveLink OctaveLink::m_singleton;
-
-OctaveLink::OctaveLink ():QObject ()
-{
-  m_symbolTableSemaphore = new QSemaphore (1);
-  m_historyModel = new QStringListModel (this);
-}
-
-OctaveLink::~OctaveLink ()
-{
-}
-
-QString
-OctaveLink::octaveValueAsQString (OctaveValue octaveValue)
-{
-  // Convert single qouted string.
-  if (octaveValue.is_sq_string ())
-    {
-      return QString ("\'%1\'").arg (octaveValue.string_value ().c_str ());
-
-      // Convert double qouted string.
-    }
-  else if (octaveValue.is_dq_string ())
-    {
-      return QString ("\"%1\"").arg (octaveValue.string_value ().c_str ());
-
-      // Convert real scalar.
-    }
-  else if (octaveValue.is_real_scalar ())
-    {
-      return QString ("%1").arg (octaveValue.scalar_value ());
-
-      // Convert complex scalar.
-    }
-  else if (octaveValue.is_complex_scalar ())
-    {
-      return QString ("%1 + %2i").arg (octaveValue.scalar_value ()).
-	arg (octaveValue.complex_value ().imag ());
-
-      // Convert range.
-    }
-  else if (octaveValue.is_range ())
-    {
-      return QString ("%1 : %2 : %3").arg (octaveValue.range_value ().
-					   base ()).arg (octaveValue.
-							 range_value ().
-							 inc ()).
-	arg (octaveValue.range_value ().limit ());
-
-      // Convert real matrix.
-    }
-  else if (octaveValue.is_real_matrix ())
-    {
-      return QString ("%1x%2 matrix")
-          .arg (octaveValue.matrix_value ().rows ())
-          .arg (octaveValue.matrix_value ().cols ());
-
-      // Convert complex matrix.
-    }
-  else if (octaveValue.is_complex_matrix ())
-    {
-    return QString ("%1x%2 complex matrix")
-        .arg (octaveValue.matrix_value ().rows ())
-        .arg (octaveValue.matrix_value ().cols ());
-
-      // If everything else does not fit, we could not recognize the type.
-    }
-  else
-    {
-      return QString ("<Type not recognized>");
-    }
-}
-
-void
-OctaveLink::launchOctave ()
-{
-  // Create both threads.
-  m_octaveMainThread = new OctaveMainThread (this);
-  m_octaveCallbackThread = new OctaveCallbackThread (this);
-
-  // Launch the second as soon as the first ist ready.
-  connect (m_octaveMainThread, SIGNAL(ready()), m_octaveCallbackThread, SLOT(start()));
-
-  // Start the first one.
-  m_octaveMainThread->start ();
-}
-
-void
-OctaveLink::terminateOctave ()
-{
-  m_octaveCallbackThread->halt();
-  m_octaveCallbackThread->wait ();
-
-  m_octaveMainThread->terminate ();
-  //m_octaveMainThread->wait();
-}
-
-QList < SymbolRecord > OctaveLink::symbolTable ()
-{
-  m_symbolTableBuffer.clear ();
-  std::list < SymbolRecord > allVariables = symbol_table::all_variables ();
-  std::list < SymbolRecord >::iterator iterator;
-  for (iterator = allVariables.begin (); iterator != allVariables.end ();
-       iterator++)
-    m_symbolTableBuffer.append (iterator->dup());
-  return m_symbolTableBuffer;
-}
-
-void
-OctaveLink::updateHistoryModel ()
-{
-  // Determine the client's (our) history length and the one of the server.
-  int clientHistoryLength = m_historyModel->rowCount ();
-  int serverHistoryLength = command_history::length ();
-
-  // If were behind the server, iterate through all new entries and add them to our history.
-  if (clientHistoryLength < serverHistoryLength)
-    {
-      for (int i = clientHistoryLength; i < serverHistoryLength; i++)
-        {
-          m_historyModel->insertRow (0);
-          m_historyModel->setData (m_historyModel->index (0), QString (command_history::get_entry (i).c_str ()));
-        }
-    }
-}
-
-QStringListModel *
-OctaveLink::historyModel ()
-{
-  return m_historyModel;
-}
--- a/gui/src/backend/OctaveLink.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 John P. Swensen, Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef OCTAVELINK_H
-#define OCTAVELINK_H
-
-// Octave includes
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-#undef PACKAGE_URL
-#include "octave/config.h"
-#include "octave/cmd-edit.h"
-#include "octave/error.h"
-#include "octave/file-io.h"
-#include "octave/input.h"
-#include "octave/lex.h"
-#include "octave/load-path.h"
-#include "octave/octave.h"
-#include "octave/oct-hist.h"
-#include "octave/oct-map.h"
-#include "octave/oct-obj.h"
-#include "octave/ops.h"
-#include "octave/ov.h"
-#include "octave/ov-usr-fcn.h"
-#include "octave/symtab.h"
-#include "octave/pt.h"
-#include "octave/pt-eval.h"
-#include "octave/config.h"
-#include "octave/Range.h"
-#include "octave/toplev.h"
-#include "octave/procstream.h"
-#include "octave/sighandlers.h"
-#include "octave/debug.h"
-#include "octave/sysdep.h"
-#include "octave/ov.h"
-#include "octave/unwind-prot.h"
-#include "octave/utils.h"
-#include "octave/variables.h"
-
-// Standard includes
-#include <iostream>
-#include <string>
-#include <vector>
-#include <readline/readline.h>
-
-// Qt includes
-#include <QMutexLocker>
-#include <QMutex>
-#include <QFileInfo>
-#include <QList>
-#include <QString>
-#include <QStringList>
-#include <QVector>
-#include <QSemaphore>
-#include <QObject>
-#include <QStringListModel>
-
-#include "OctaveCallbackThread.h"
-#include "OctaveMainThread.h"
-
-typedef symbol_table::symbol_record SymbolRecord;
-typedef octave_value OctaveValue;
-
-/**
-  * \class OctaveLink
-  * Manages a link to an octave instance.
-  */
-class OctaveLink:public QObject
-{
-  Q_OBJECT
-public:
-  static OctaveLink *
-  instance ()
-  {
-    return &m_singleton;
-  }
-  static QString
-  octaveValueAsQString (OctaveValue octaveValue);
-
-  void launchOctave ();
-  void terminateOctave ();
-  void acquireSymbolTable () { m_symbolTableSemaphore->acquire (); }
-  void releaseSymbolTable () { m_symbolTableSemaphore->release (); }
-
-  /**
-    * For performance reasons this is not thread safe. Before you use this,
-    * acquire a lock with acquireSymbolTable and releaseSymbolTable.
-    */
-  QList < SymbolRecord > symbolTable ();
-
-  /**
-    * Returns a copy of the current symbol table buffer.
-    * \return Copy of the current symbol table buffer.
-    */
-  QList < SymbolRecord > copyCurrentSymbolTable ();
-
-  void updateHistoryModel ();
-  QStringListModel *historyModel ();
-  void emitSymbolTableChanged() { emit symbolTableChanged(); }
-
-signals:
-  void symbolTableChanged ();
-
-private:
-  OctaveLink ();
-  ~OctaveLink ();
-
-  /** Variable related member variables. */
-  QSemaphore * m_symbolTableSemaphore;
-  QList < SymbolRecord > m_symbolTableBuffer;
-
-  /** History related member variables. */
-  QStringListModel *m_historyModel;
-
-  // Threads for running octave and managing the data interaction.
-  OctaveMainThread *m_octaveMainThread;
-  OctaveCallbackThread *m_octaveCallbackThread;
-
-  static OctaveLink m_singleton;
-};
-#endif // OCTAVELINK_H
--- a/gui/src/backend/OctaveMainThread.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "OctaveMainThread.h"
-#include "OctaveLink.h"
-
-OctaveMainThread::OctaveMainThread (QObject * parent):QThread (parent)
-{
-}
-
-void
-OctaveMainThread::run ()
-{
-  int argc = 3;
-  const char *argv[] = { "OctaveGUI", "--interactive", "--line-editing" };
-  octave_main (argc, (char **) argv, 1);
-  emit ready();
-  main_loop ();
-  // TODO: Close application on quit.
-  clean_up_and_exit (0);
-}
--- a/gui/src/backend/OctaveMainThread.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef OCTAVEMAINTHREAD_H
-#define OCTAVEMAINTHREAD_H
-
-#include <QThread>
-class OctaveMainThread:public QThread
-{
-  Q_OBJECT
-public:
-  OctaveMainThread (QObject * parent);
-
-signals:
-  void ready();
-
-protected:
-  void run ();
-};
-
-#endif // OCTAVEMAINTHREAD_H
--- a/gui/src/backend/ReadlineAdapter.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ReadlineAdapter.h"
-
-ReadlineAdapter::ReadlineAdapter (QObject *parent) :
-  QObject (parent), command_editor ()
-{
-}
--- a/gui/src/backend/ReadlineAdapter.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef READLINEADAPTER_H
-#define READLINEADAPTER_H
-
-#include "octave/config.h"
-#include "octave/cmd-edit.h"
-#include <QObject>
-
-class ReadlineAdapter : public QObject, public command_editor
-{
-  Q_OBJECT
-public:
-  explicit ReadlineAdapter (QObject *parent = 0);
-
-signals:
-
-public slots:
-
-};
-
-#endif // READLINEADAPTER_H
--- a/gui/src/irc/IRCClientImpl.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,513 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "IRCClientImpl.h"
-
-IRCServerMessage::IRCServerMessage (const QString& serverMessage)
-{
-  if (serverMessage.isEmpty ())
-    return;
-
-  int position = 0;
-  QString buffer;
-
-  m_nick = "";
-  m_user = "";
-  m_host = "";
-
-  // A server message starting with a prefix indicates
-  // a prefix. A prefix has the format:
-  // :nick!user@host
-  // followed by a space character.
-  if (serverMessage.startsWith (":"))
-    {
-      position++;
-      while ((position < serverMessage.size ())
-             &&(serverMessage.at (position) != '!')
-             && !serverMessage.at (position).isSpace ())
-        {
-          buffer.append (serverMessage.at (position));
-          position++;
-        }
-      m_nick = buffer, buffer.clear (), position++;
-
-      // If it belongs to the prefix, it must be concatenanted neatlessly without
-      // any spaces.
-      if (position < serverMessage.size())
-      if (!serverMessage.at (position - 1).isSpace ())
-        {
-          while ((position < serverMessage.size ())
-                 && serverMessage.at (position) != '@')
-            {
-              buffer.append (serverMessage.at (position));
-              position++;
-            }
-          m_user = buffer, buffer.clear (), position++;
-        }
-
-      // If it belongs to the prefix, it must be concatenanted neatlessly without
-      // any spaces.
-      if (position < serverMessage.size())
-      if (!serverMessage.at (position - 1).isSpace ())
-        {
-          while ((position < serverMessage.size ())
-                 && serverMessage.at (position) != ' ')
-            {
-              buffer.append (serverMessage.at (position));
-              position++;
-            }
-          m_host = buffer, buffer.clear (), position++;
-        }
-    }
-
-  // The next part is the command. The command can either be numeric
-  // or a written command.
-  while ((position < serverMessage.size ())
-         && !serverMessage.at (position).isSpace ())
-    {
-      buffer.append (serverMessage.at (position));
-      position++;
-    }
-  m_command = buffer.toUpper (), buffer.clear (), position++;
-  m_codeNumber = m_command.toInt (&m_isNumeric);
-
-  // Next: a list of parameters. If any of these parameters
-  // starts with a colon, we have to read everything that follows
-  // as a single parameter.
-  bool readUntilEnd = false;
-  while (position < serverMessage.size ())
-    {
-      if (buffer.isEmpty () && !readUntilEnd && (serverMessage.at (position) == ':'))
-        {
-          readUntilEnd = true;
-        }
-      else
-        {
-          if (readUntilEnd)
-            {
-              buffer.append (serverMessage.at (position));
-            }
-          else
-            {
-              if (serverMessage.at (position).isSpace ())
-                {
-                  if (!buffer.isEmpty ())
-                    {
-                      m_parameters.append (buffer);
-                      buffer.clear ();
-                    }
-                }
-              else
-                {
-                  buffer.append (serverMessage.at (position));
-                }
-            }
-        }
-      position++;
-    }
-
-  if (!buffer.isEmpty ())
-    {
-      // We need to chop off \r\n here.
-      buffer.chop (2);
-      m_parameters.append (buffer);
-    }
-}
-
-int
-IRCServerMessage::numericValue ()
-{
-  if (m_isNumeric)
-    return m_codeNumber;
-  return -1;
-}
-
-QString
-IRCServerMessage::parameter (int index)
-{
-  if (index >= 0 && index < m_parameters.size ())
-    return m_parameters.at (index);
-  return "";
-}
-
-
-IRCChannelProxyImpl::IRCChannelProxyImpl (IRCClientInterface *clientInterface, const QString& channelName, QObject *parent)
-  : IRCChannelProxyInterface (clientInterface, channelName, parent),
-    m_clientInterface (clientInterface)
-{
-  m_channelName = channelName;
-  connect (clientInterface, SIGNAL (nicknameChanged (QString,QString)),
-           this, SLOT (handleNickChange (QString,QString)));
-}
-
-QTextDocument *
-IRCChannelProxyImpl::conversationModel ()
-{
-  return &m_conversationModel;
-}
-
-QStringListModel *
-IRCChannelProxyImpl::userListModel ()
-{
-  return &m_userListModel;
-}
-
-QString
-IRCChannelProxyImpl::channelName ()
-{
-  return m_channelName;
-}
-
-void
-IRCChannelProxyImpl::setNickList (const QStringList &nickList)
-{
-  m_userList = nickList;
-  m_userListModel.setStringList (nickList);
-}
-
-void
-IRCChannelProxyImpl::sendMessage (const QString& message)
-{
-  QStringList arguments;
-  arguments << m_channelName;
-  arguments << message;
-  m_clientInterface->sendIRCCommand (IRCCommand::PrivateMessage, arguments);
-}
-
-void
-IRCChannelProxyImpl::sendJoinRequest ()
-{
-  m_clientInterface->sendIRCCommand (IRCCommand::Join, QStringList (m_channelName));
-}
-
-
-void
-IRCChannelProxyImpl::leave (const QString& reason)
-{
-  Q_UNUSED (reason);
-}
-
-void
-IRCChannelProxyImpl::handleNickChange (const QString &oldNick, const QString &newNick)
-{
-  m_userList = m_userListModel.stringList ();
-  m_userList.removeAll (oldNick);
-  m_userList.append (newNick);
-  m_userListModel.setStringList (m_userList);
-}
-
-void
-IRCChannelProxyImpl::handleJoin (const QString &nick)
-{
-  m_userList = m_userListModel.stringList ();
-  m_userList.append (nick);
-  m_userListModel.setStringList (m_userList);
-}
-
-IRCClientImpl::IRCClientImpl (QObject *parent)
-  : IRCClientInterface (parent)
-{
-  m_loggedIn = false;
-  connect (&m_tcpSocket, SIGNAL (connected ()), this, SLOT (handleConnected ()));
-  connect (&m_tcpSocket, SIGNAL (disconnected ()), this, SLOT (handleDisconnected ()));
-  connect (&m_tcpSocket, SIGNAL (readyRead ()), this, SLOT (handleReadyRead ()));
-}
-
-IRCClientImpl::~IRCClientImpl ()
-{
-  foreach (IRCChannelProxyInterface *ircChannelProxy, m_channels)
-    {
-      delete ircChannelProxy;
-    }
-}
-
-void
-IRCClientImpl::connectToHost (const QHostAddress& host, int port, const QString& initialNick)
-{
-  m_host = host;
-  m_nickname = initialNick;
-  m_tcpSocket.connectToHost(host, port);
-}
-
-void
-IRCClientImpl::disconnect ()
-{
-  m_tcpSocket.disconnect ();
-}
-
-void
-IRCClientImpl::reconnect ()
-{
-  disconnect ();
-  connectToHost (m_host, m_port, m_nickname);
-}
-
-bool
-IRCClientImpl::isConnected ()
-{
-  return m_connected;
-}
-
-bool
-IRCClientImpl::isLoggedIn ()
-{
-  return m_loggedIn;
-}
-
-const QHostAddress&
-IRCClientImpl::host()
-{
-  return m_host;
-}
-
-int
-IRCClientImpl::port()
-{
-  return m_port;
-}
-
-IRCChannelProxyInterface *
-IRCClientImpl::ircChannelProxy (const QString &channel)
-{
-  if (!m_channels.contains (channel))
-      m_channels[channel] = new IRCChannelProxyImpl(this, channel);
-  return m_channels[channel];
-}
-
-void
-IRCClientImpl::sendNicknameChangeRequest (const QString &nickname)
-{
-  sendIRCCommand (IRCCommand::Nick, QStringList (nickname));
-}
-
-void
-IRCClientImpl::sendPrivateMessage (const QString &recipient, const QString &message)
-{
-  QStringList arguments;
-  arguments << recipient;
-  arguments << message;
-  sendIRCCommand (IRCCommand::PrivateMessage, arguments);
-}
-
-const QString&
-IRCClientImpl::nickname ()
-{
-  return m_nickname;
-}
-
-void
-IRCClientImpl::handleConnected ()
-{
-  m_connected = true;
-  QStringList arguments;
-  arguments << "na" << "0" << "0" << "na";
-  sendIRCCommand (IRCCommand::User, arguments);
-  sendNicknameChangeRequest (m_nickname);
-  emit connected (m_host.toString ());
-}
-
-void
-IRCClientImpl::handleDisconnected ()
-{
-  m_connected = false;
-  emit disconnected ();
-}
-
-void
-IRCClientImpl::handleReadyRead ()
-{
-  QByteArray line;
-  do
-    {
-      line = m_tcpSocket.readLine();
-      if (line.size ())
-        handleIncomingLine(QString::fromUtf8(line.data ()));
-      else
-        break;
-    }
-  while (true);
-}
-
-void
-IRCClientImpl::handleNicknameChanged (const QString &oldNick, const QString &newNick)
-{
-  // Check if our nickname changed.
-  if (oldNick == m_nickname)
-    {
-      m_nickname = newNick;
-      emit userNicknameChanged (m_nickname);
-    }
-  emit nicknameChanged (oldNick, newNick);
-}
-
-void
-IRCClientImpl::handleUserJoined (const QString &nick, const QString &channel)
-{
-  ircChannelProxy (channel)->handleJoin (nick);
-  emit userJoined (nick, channel);
-}
-
-void
-IRCClientImpl::handleUserQuit (const QString &nick, const QString &reason)
-{
-  emit userQuit (nick, reason);
-}
-
-void
-IRCClientImpl::handleIncomingLine (const QString &line)
-{
-  if (m_connected && !line.isEmpty())
-    {
-      IRCServerMessage ircServerMessage(line);
-      if (ircServerMessage.isNumeric () == true)
-        {
-          switch (ircServerMessage.numericValue ())
-            {
-              case IRCReply::Welcome:
-                m_loggedIn = true;
-                emit userNicknameChanged (nickname ());
-                emit loggedIn (nickname ());
-                break;
-              case IRCError::NicknameInUse:
-              case IRCError::NickCollision:
-                // If we are already logged in, the user attempted to
-                // switch to a username that is already existing.
-                // In that case warn him.
-                if (isLoggedIn ())
-                  {
-                    emit error ("The nickname is already in use.");
-                  }
-                // Otherwise we are attempting to log in to the server.
-                // Change the nick so that we can at least log in.
-                else
-                  {
-                    m_nickname += "_";
-                    sendNicknameChangeRequest (m_nickname);
-                  }
-                break;
-              case IRCError::PasswordMismatch:
-                emit error ("The password you provided is not correct.");
-                break;
-              case IRCReply::MessageOfTheDayStart:
-              case IRCReply::MessageOfTheDay:
-              case IRCReply::MessageOfTheDayEnd:
-              case IRCError::NoMessageOfTheDay:
-                break;
-              case IRCReply::NoTopic:
-              case IRCReply::Topic:
-                break;
-              case IRCReply::NameReply:
-                QString channel = ircServerMessage.parameter (2);
-                QString nickList = ircServerMessage.parameter (3);
-                emit debugMessage (nickList);
-                ircChannelProxy (channel)->setNickList (nickList.split (QRegExp ("\\s+"), QString::SkipEmptyParts));
-                break;
-            }
-        }
-      else
-        {
-          QString command = ircServerMessage.command ();
-          if (command == IRCCommand::Nick)
-            {
-              handleNicknameChanged (ircServerMessage.nick(), ircServerMessage.parameter (0));
-            }
-          else if (command == IRCCommand::Quit)
-            {
-              handleUserQuit (ircServerMessage.nick (), ircServerMessage.parameter (0));
-            }
-          else if (command == IRCCommand::Join)
-            {
-              handleUserJoined(ircServerMessage.nick (), ircServerMessage.parameter (0));
-            }
-          else if (command == IRCCommand::Part)
-            {
-              emit debugMessage ("WRITEME: Received part.");
-              //emit part (ircEvent.getNick ().toStdString ().c_str (),
-              //           ircEvent.getParam (0).toStdString ().c_str (),
-              //           ircEvent.getParam (1).toStdString ().c_str ());
-            }
-          else if (command == IRCCommand::Mode)
-            {
-              emit debugMessage ("WRITEME: Received mode.");
-              //emit mode (&ircEvent);
-            }
-          else if (command == IRCCommand::Topic)
-            {
-              emit debugMessage
-                (QString("WRITEME: Received topic: %1")
-                  .arg (ircServerMessage.parameter (0)));
-            }
-          else if (command == IRCCommand::Kick)
-            {
-              emit debugMessage ("WRITEME: Received kick command.");
-            }
-          else if (command == IRCCommand::Invite)
-            {
-              emit debugMessage ("WRITEME: Received invite command.");
-
-            }
-          else if (command == IRCCommand::PrivateMessage)
-            {
-              emit message (ircServerMessage.parameter (0), ircServerMessage.nick (), ircServerMessage.parameter (1));
-            }
-          else if (command == IRCCommand::Notice)
-            {
-              emit notification (ircServerMessage.nick ().toStdString ().c_str (),
-                                 ircServerMessage.parameter (1).toStdString ().c_str ());
-            }
-          else if (command == IRCCommand::Ping)
-            {
-              sendIRCCommand (IRCCommand::Pong, QStringList (m_nickname));
-            }
-          else if (command == IRCCommand::Error)
-            {
-              emit error (ircServerMessage.parameter (0));
-            }
-          else
-            {
-              emit debugMessage (QString("FIXME: Received unknown reply: %1").arg(command));
-            }
-        }
-    }
-}
-
-void
-IRCClientImpl::sendLine (const QString &line)
-{
-  if (m_connected)
-    m_tcpSocket.write ( (line +  + "\r\n").toUtf8 ());
-}
-
-void
-IRCClientImpl::sendIRCCommand (const QString &command, const QStringList &arguments)
-{
-  QString line = command;
-  for (int i = 0; i < arguments.size (); i++)
-    {
-      bool applyColon = false;
-      // Usually all parameters are separated by spaces.
-      // The last parameter of the message may contain spaces, it is usually used
-      // to transmit messages. In order to parse it correctly, if needs to be prefixed
-      // with a colon, so the server knows to ignore all forthcoming spaces and has to treat
-      // all remaining characters as a single parameter. If we detect any whitespace in the
-      // last argument, prefix it with a colon:
-      if ((i == arguments.size () - 1) && arguments.at (i).contains (QRegExp("\\s")))
-        applyColon = true;
-      line += QString (" %1%2").arg (applyColon ? ":" : "").arg (arguments.at (i));
-    }
-  sendLine (line);
-}
--- a/gui/src/irc/IRCClientImpl.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,355 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef IRCCLIENTIMPL_H
-#define IRCCLIENTIMPL_H
-
-#include <QTcpSocket>
-#include <QHostInfo>
-#include <QStringList>
-#include <QTextDocument>
-#include <QStringListModel>
-#include "IRCClientInterface.h"
-
-/**
-  * \namespace IRCCommand
-  * This namespace includes all IRC commands.
-  */
-namespace IRCCommand
-{
-  const QString Password = "PASS";
-  const QString Nick = "NICK";
-  const QString User = "USER";
-  const QString Operation = "OPER";
-  const QString Service = "SERVICE";
-  const QString Quit = "QUIT";
-  const QString ServerQuit = "SQUIT";
-
-  const QString Join = "JOIN";
-  const QString Part = "PART";
-  const QString Mode = "MODE";
-  const QString Topic = "TOPIC";
-  const QString Names = "NAMES";
-  const QString List = "LIST";
-  const QString Invite = "INVITE";
-  const QString Kick = "KICK";
-
-  const QString PrivateMessage = "PRIVMSG";
-  const QString Notice = "NOTICE";
-
-  const QString MessageOfTheDay = "MOTD";
-  const QString ListUsers = "LUSERS";
-  const QString Version = "VERSION";
-  const QString Stats = "STATS";
-  const QString Links = "LINKS";
-  const QString Time = "TIME";
-  const QString Command = "CONNECT";
-  const QString Trace = "TRACE";
-  const QString Admin = "ADMIN";
-  const QString Info = "INFO";
-
-  const QString ServerList = "SERVLIST";
-  const QString ServerQuery = "SQUERY";
-
-  const QString Who = "WHO";
-  const QString WhoIs = "WHOIS";
-  const QString WhoWas = "WHOWAS";
-
-  const QString Kill = "KILL";
-  const QString Ping = "PING";
-  const QString Pong = "PONG";
-  const QString Error = "ERROR";
-
-  const QString Away = "AWAY";
-  const QString Rehash = "REHASH";
-  const QString Die = "DIE";
-  const QString Restart = "RESTART";
-  const QString Summon = "SUMMON";
-  const QString Users = "USERS";
-  const QString OperatorWall = "OPERWALL";
-  const QString UserHost = "USERHOST";
-  const QString IsOn = "ISON";
-};
-
-/**
-  * \namespace IRCReply
-  * This namespace includes all numeric IRC replies.
-  */
-namespace IRCReply
-{
-  const int Welcome = 1;
-  const int YourHost = 2;
-  const int Created = 3;
-  const int MyInfo = 4;
-  const int ReplyBounce = 5;
-  const int UserHost = 302;
-  const int IsOn = 303;
-  const int Away = 301;
-  const int UnAway = 305;
-  const int NoAway = 306;
-  const int WhoIsUser = 311;
-  const int WhoIsServer = 312;
-  const int WhoIsOperator = 313;
-  const int WhoIsIdle = 317;
-  const int EndOfWhoIs = 318;
-  const int WhoIsChannels = 319;
-  const int WhoWasUser = 314;
-  const int EndOfWhoWas = 369;
-  const int ListStart = 321;
-  const int List = 322;
-  const int ListEnd = 323;
-  const int UniqueOpIs = 325;
-  const int ChannelModeIs = 324;
-  const int NoTopic = 331;
-  const int Topic = 332;
-  const int Inviting = 341;
-  const int Summoning = 342;
-  const int InviteList = 346;
-  const int EndOfInviteList = 347;
-  const int ExceptList = 348;
-  const int EndOfExceptList = 349;
-  const int Version = 351;
-  const int WhoReply = 352;
-  const int EndOfWho = 315;
-  const int NameReply = 353;
-  const int EndOfNames = 366;
-  const int Links = 364;
-  const int EndOfLinks = 367;
-  const int BanList = 368;
-  const int Info = 371;
-  const int EndOfInfo = 374;
-  const int MessageOfTheDayStart = 375;
-  const int MessageOfTheDay = 372;
-  const int MessageOfTheDayEnd = 376;
-  const int YouAreOperator = 381;
-  const int Rehashing = 382;
-  const int YouAreService = 383;
-  const int Time = 391;
-  const int UserStart = 392;
-  const int Users = 393;
-  const int EndOfUsers = 394;
-  const int NoUsers = 395;
-  const int TraceLink = 200;
-  const int TraceConnecting = 201;
-  const int TraceHandshake = 202;
-  const int TraceUnknown = 203;
-  const int TraceOperator = 204;
-  const int TraceUser = 205;
-  const int TraceServer = 206;
-  const int TraceService = 207;
-  const int TraceNewType = 208;
-  const int TraceClass = 209;
-  const int TraceConnect = 210;
-  const int TraceLog = 261;
-  const int TraceEnd = 262;
-  const int StatsLinkInfo = 211;
-  const int StatsCommands = 212;
-  const int EndOfStats = 219;
-  const int StatsUptime = 242;
-  const int StatsOnline = 243;
-  const int UModeIs = 221;
-  const int ServerList = 234;
-  const int ServerListEnd = 235;
-  const int ListUserClient = 251;
-  const int ListUserOperator = 252;
-  const int ListUserUnknown = 253;
-  const int ListUserChannels = 254;
-  const int ListUserMe = 255;
-  const int AdminMe = 256;
-  const int AdminLoc1 = 257;
-  const int AdminLoc2 = 258;
-  const int AdminEmail = 259;
-  const int TryAgain = 263;
-};
-
-/**
-  * \namespace IRCError
-  * This namespace includes all numeric IRC errors.
-  */
-namespace IRCError
-{
-  const int NoSuchNick = 401;
-  const int NoSuchServer = 402;
-  const int NoSuchChannel = 403;
-  const int CannotSendToChannel = 404;
-  const int TooManyChannels = 405;
-  const int WasNoSuchNick = 406;
-  const int TooManyTargets = 407;
-  const int NoSuchService = 408;
-  const int NoOrigin = 409;
-  const int NoRecipient = 411;
-  const int NoTextToSend = 412;
-  const int NoTopLevel = 413;
-  const int WildTopLevel = 414;
-  const int BasMask = 415;
-  const int UnknownCommand = 421;
-  const int NoMessageOfTheDay = 422;
-  const int NoAdminInfo = 423;
-  const int FileError = 424;
-  const int NoNickNameGiven = 431;
-  const int ErroneusNick = 432;
-  const int NicknameInUse = 433;
-  const int NickCollision = 436;
-  const int UnavailResource = 437;
-  const int UserNotInChannel = 441;
-  const int NotOnChannel = 442;
-  const int UserOnChannel = 443;
-  const int NoLogin = 444;
-  const int SummonDisabled = 445;
-  const int UsersDisabled = 446;
-  const int NotRegistered = 451;
-  const int NeedMoreParams = 461;
-  const int AlreadyRegistered = 462;
-  const int NoPermissionForHost = 463;
-  const int PasswordMismatch = 464;
-  const int YouAreBannedCreep = 465;
-  const int YouWillBeBanned = 466;
-  const int KeySet = 467;
-  const int ChannelIsFull = 471;
-  const int UnknownMode = 472;
-  const int InviteOnlyChannel = 473;
-  const int BannedFromChannel = 474;
-  const int BadChannelKey = 475;
-  const int BadChannelMask = 476;
-  const int NoChannelModes = 477;
-  const int BanListFull = 478;
-  const int NoPrivileges = 481;
-  const int ChannelOperatorPrivilegesNeeded = 482;
-  const int CannotKillServer = 483;
-  const int Restricted = 484;
-  const int UniqueOperatorPrivilegesNeeded = 485;
-  const int NoOperatorHost = 491;
-  const int YourModeListUnknownFlag = 501;
-  const int UsersDontMatch = 502;
-};
-
-/**
-  * \class IRCServerMessage
-  * The IRCServerMessage class is a wrapper for server messages.
-  * It parses the server message into its single bits and makes these
-  * available through Getter-methods.
-  */
-class IRCServerMessage
-{
-public:
-  IRCServerMessage (const QString& serverMessage);
-
-  bool isNumeric ()
-  { return m_isNumeric; }
-
-  QString nick ()
-  { return m_nick; }
-
-  QString command ()
-  { return m_command; }
-
-  int numericValue ();
-  QString parameter (int index);
-
-private:
-  int         m_codeNumber;
-  bool        m_isNumeric;
-  QString     m_nick;
-  QString     m_user;
-  QString     m_host;
-  QString     m_command;
-  QStringList m_parameters;
-};
-
-/**
-  * \class IRCChannelProxyImpl
-  * Implements a handle to an IRC channel. This is usually provided by the
-  * the IRC client class.
-  */
-class IRCChannelProxyImpl : public IRCChannelProxyInterface
-{
-  Q_OBJECT
-public:
-  IRCChannelProxyImpl (IRCClientInterface *clientInterface, const QString& channelName, QObject *parent = 0);
-  QTextDocument *conversationModel ();
-  QStringListModel *userListModel ();
-  QString channelName ();
-
-  void setNickList (const QStringList &nickList);
-  void sendMessage (const QString& message);
-  void sendJoinRequest ();
-  void leave (const QString &reason);
-public slots:
-  void handleNickChange (const QString& oldNick, const QString& newNick);
-  void handleJoin (const QString& nick);
-private:
-  QString             m_channelName;
-  QStringList         m_userList;
-  QStringListModel    m_userListModel;
-  QTextDocument       m_conversationModel;
-  IRCClientInterface *m_clientInterface;
-};
-
-/**
-  * \class IRCClientImpl
-  * Implements an IRC client. This class can maintain a connection to one server.
-  * In order to interface an IRC channel, use the ircChannelProxy-method to retrieve
-  * a handle.
-  */
-class IRCClientImpl : public IRCClientInterface
-{
-  Q_OBJECT
-public:
-  IRCClientImpl (QObject *parent = 0);
-  ~IRCClientImpl ();
-
-  const QString& nickname ();
-  bool isConnected ();
-  bool isLoggedIn ();
-  const QHostAddress& host();
-  int port();
-  IRCChannelProxyInterface *ircChannelProxy(const QString& channel);
-  void sendIRCCommand (const QString& command, const QStringList& arguments);
-
-public slots:
-  void connectToHost (const QHostAddress& host, int port, const QString& initialNick);
-  void disconnect ();
-  void reconnect ();
-
-  void sendNicknameChangeRequest (const QString &nickname);
-  void sendPrivateMessage (const QString &recipient, const QString &message);
-
-signals:
-  void debugMessage (const QString& message);
-
-private slots:
-  void handleConnected ();
-  void handleDisconnected ();
-  void handleReadyRead ();
-
-private:
-  void handleNicknameChanged (const QString& oldNick, const QString& newNick);
-  void handleUserJoined (const QString& nick, const QString& channel);
-  void handleUserQuit (const QString& nick, const QString& reason);
-  void handleIncomingLine (const QString& line);
-  void sendLine (const QString& line);
-
-  QHostAddress                              m_host;
-  int                                       m_port;
-  QString                                   m_nickname;
-  bool                                      m_connected;
-  bool                                      m_loggedIn;
-  QTcpSocket                                m_tcpSocket;
-  QMap<QString, IRCChannelProxyInterface*>  m_channels;
-};
-
-#endif // IRCCLIENTIMPL_H
--- a/gui/src/irc/IRCClientInterface.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef IRCCLIENTINTERFACE_H
-#define IRCCLIENTINTERFACE_H
-
-#include <QString>
-#include <QObject>
-#include <QHostAddress>
-#include <QTextDocument>
-#include <QStringListModel>
-
-class IRCClientInterface;
-/**
-  * \class IRCChannelProxyInterface
-  * Interface for a handle to an IRC channel.
-  */
-class IRCChannelProxyInterface : public QObject
-{
-  Q_OBJECT
-public:
-  IRCChannelProxyInterface (IRCClientInterface *, const QString&, QObject *parent = 0) : QObject (parent) { }
-  virtual ~IRCChannelProxyInterface () { }
-
-  /** Returns the conversation model part. */
-  virtual QTextDocument *conversationModel () = 0;
-
-  /** Returns a string list model for the user list. */
-  virtual QStringListModel *userListModel () = 0;
-
-  /** Returns the name of this channel. */
-  virtual QString channelName () = 0;
-
-  /**
-    * Overwrites the current nick list by settings a new nick list.
-    * \arg nickList The new nick list to set.
-    */
-  virtual void setNickList (const QStringList& nickList) = 0;
-
-  /**
-    * Sends a public message onto this channel.
-    * \arg message The message that should be sent.
-    */
-  virtual void sendMessage (const QString& message) = 0;
-
-  /** Requests to join this channel. */
-  virtual void sendJoinRequest () = 0;
-
-  /**
-    * Requests to leave this channel.
-    * \arg reason Reason for leaving the channel.
-    */
-  virtual void leave (const QString& reason) = 0;
-
-public slots:
-  virtual void handleNickChange (const QString& oldNick, const QString& newNick) = 0;
-  virtual void handleJoin (const QString& nick) = 0;
-};
-
-/**
-  * \class IRCClientInterface
-  * IRC Clients need to implement this interface.
-  */
-class IRCClientInterface : public QObject
-{
-  Q_OBJECT
-public:
-  IRCClientInterface (QObject *parent = 0) : QObject (parent) { }
-  virtual ~IRCClientInterface () { }
-
-  /** Returns the current nickname of this client. */
-  virtual const QString& nickname () = 0;
-
-  /** Returns true if connected to the server. */
-  virtual bool isConnected () = 0;
-
-  /**
-    * Returns true if logged in to the server.
-    * Note: There is a small difference between isConnected and isLoggedIn.
-    * isConnected returns true if there is a physical connection to the server.
-    * isLoggedIn only returns true if the server has already accepted you
-    * and you are ready to log into channels.
-    */
-  virtual bool isLoggedIn () = 0;
-
-  /** Returns the current host address. */
-  virtual const QHostAddress& host() = 0;
-
-  /** Returns the current port. */
-  virtual int port() = 0;
-
-  /**
-    * Returns a handle to an IRC channel.
-    * Note: Retrieving a handle does not mean you have joined this channel.
-    * \arg channel The channel to retrieve a handle for.
-    */
-  virtual IRCChannelProxyInterface *ircChannelProxy(const QString& channel) = 0;
-
-  /**
-    * Send an IRC command to the server.
-    * \arg command Command to send.
-    * \arg arguments Arguments to send.
-    */
-  virtual void sendIRCCommand (const QString& command, const QStringList& arguments) = 0;
-
-public slots:
-  /**
-    * Connects to a host.
-    * \arg host The host to connect tp.
-    * \arg port The port on which to connect to the host.
-    * \arg initialNick The initial nick to use when attempting to login.
-    */
-  virtual void connectToHost (const QHostAddress& host, int port, const QString& initialNick) = 0;
-
-  /** Disconnects from the host. */
-  virtual void disconnect () = 0;
-
-  /** Reconnects to the host. */
-  virtual void reconnect () = 0;
-
-  /**
-    * Sends a request to change the nickname.
-    * \arg nickname The new nickname to be requested.
-    */
-  virtual void sendNicknameChangeRequest (const QString& nickname) = 0;
-
-  /**
-    * Sends a private message.
-    * \arg recipient The nickname or channel that message should be sent to.
-    * \arg message The message that should be sent.
-    */
-  virtual void sendPrivateMessage (const QString& recipient, const QString& message) = 0;
-
-signals:
-  /**
-    * Sent upon the arrival of a new message.
-    * \arg channel The channel this message was sent from.
-    * \arg sender The nickname of the sender.
-    * \arg message The message that has been sent.
-    */
-  void newMessage (const QString& channel, const QString& sender, const QString& message);
-  void message (const QString& channel, const QString& sender, const QString& message);
-
-  /**
-    * Sent when the connection to a server has been established.
-    * \arg server The name of the server that the connection has been established to.
-    */
-  void connected (const QString& server);
-
-  /** Sent when the connection to the server has been interrupted. */
-  void disconnected ();
-
-  /**
-    * Sent when an error occurs.
-    * \arg message A descriptive message of the error that occured.
-    */
-  void error (const QString& message);
-
-  /**
-    * Sent when a notification arrives.
-    * \arg sender The source of the notification.
-    * \arg message The notification.
-    */
-  void notification (const QString& sender, const QString& message);
-
-  /**
-    * Sent when a nickname changed.
-    * \arg oldNick The previous nickname.
-    * \arg newNick The new nickname.
-    */
-  void nicknameChanged (const QString& oldNick, const QString& newNick);
-
-  /**
-    * Sent when the nickname of this client changed.
-    * \arg nick The new nickname of this client.
-    */
-  void userNicknameChanged (const QString& nick);
-
-  /**
-    * Sent when a user has joined a channel.
-    * \arg nick Nickname of the user that joined the channel.
-    * \arg channel Channel that this user joined.
-    */
-  void userJoined (const QString& nick, const QString& channel);
-
-  /**
-    * Sent when a user quits.
-    * \arg nick Nickname of the user that quit.
-    * \arg reason Reason of the user to quit.
-    */
-  void userQuit (const QString& nick, const QString& reason);
-
-  /**
-    * Sent when a user logged in.
-    * \arg nick The nickname of the user that logged in.
-    */
-  void loggedIn (const QString& nick);
-
-  /**
-    * Sent when the server provides a userlist for a channel.
-    * \arg channel The channel that userlist applies to.
-    * \arg list The actual userlist.
-    */
-  void userList (const QString& channel, const QStringList& list);
-};
-
-#endif // IRCCLIENTINTERFACE_H
--- a/gui/src/irc/IRCCodes.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid
- * jacob.dawid@googlemail.com
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef IRCCODES_H
-#define IRCCODES_H
-#include <QString>
-
-namespace IRCCommand
-{
-  const QString Password = "PASS";
-  const QString Nick = "NICK";
-  const QString User = "USER";
-  const QString Operation = "OPER";
-  const QString Service = "SERVICE";
-  const QString Quit = "QUIT";
-  const QString ServerQuit = "SQUIT";
-
-  const QString Join = "JOIN";
-  const QString Part = "PART";
-  const QString Mode = "MODE";
-  const QString Topic = "TOPIC";
-  const QString Names = "NAMES";
-  const QString List = "LIST";
-  const QString Invite = "INVITE";
-  const QString Kick = "KICK";
-
-  const QString PrivateMessage = "PRIVMSG";
-  const QString Notice = "NOTICE";
-
-  const QString MessageOfTheDay = "MOTD";
-  const QString ListUsers = "LUSERS";
-  const QString Version = "VERSION";
-  const QString Stats = "STATS";
-  const QString Links = "LINKS";
-  const QString Time = "TIME";
-  const QString Command = "CONNECT";
-  const QString Trace = "TRACE";
-  const QString Admin = "ADMIN";
-  const QString Info = "INFO";
-
-  const QString ServerList = "SERVLIST";
-  const QString ServerQuery = "SQUERY";
-
-  const QString Who = "WHO";
-  const QString WhoIs = "WHOIS";
-  const QString WhoWas = "WHOWAS";
-
-  const QString Kill = "KILL";
-  const QString Ping = "PING";
-  const QString Pong = "PONG";
-  const QString Error = "ERROR";
-
-  const QString Away = "AWAY";
-  const QString Rehash = "REHASH";
-  const QString Die = "DIE";
-  const QString Restart = "RESTART";
-  const QString Summon = "SUMMON";
-  const QString Users = "USERS";
-  const QString OperatorWall = "OPERWALL";
-  const QString UserHost = "USERHOST";
-  const QString IsOn = "ISON";
-};
-
-namespace IRCReply
-{
-  const int Welcome = 1;
-  const int YourHost = 2;
-  const int Created = 3;
-  const int MyInfo = 4;
-  const int ReplyBounce = 5;
-  const int UserHost = 302;
-  const int IsOn = 303;
-  const int Away = 301;
-  const int UnAway = 305;
-  const int NoAway = 306;
-  const int WhoIsUser = 311;
-  const int WhoIsServer = 312;
-  const int WhoIsOperator = 313;
-  const int WhoIsIdle = 317;
-  const int EndOfWhoIs = 318;
-  const int WhoIsChannels = 319;
-  const int WhoWasUser = 314;
-  const int EndOfWhoWas = 369;
-  const int ListStart = 321;
-  const int List = 322;
-  const int ListEnd = 323;
-  const int UniqueOpIs = 325;
-  const int ChannelModeIs = 324;
-  const int NoTopic = 331;
-  const int Topic = 332;
-  const int Inviting = 341;
-  const int Summoning = 342;
-  const int InviteList = 346;
-  const int EndOfInviteList = 347;
-  const int ExceptList = 348;
-  const int EndOfExceptList = 349;
-  const int Version = 351;
-  const int WhoReply = 352;
-  const int EndOfWho = 315;
-  const int NameReply = 353;
-  const int EndOfNames = 366;
-  const int Links = 364;
-  const int EndOfLinks = 367;
-  const int BanList = 368;
-  const int Info = 371;
-  const int EndOfInfo = 374;
-  const int MessageOfTheDayStart = 375;
-  const int MessageOfTheDay = 372;
-  const int MessageOfTheDayEnd = 376;
-  const int YouAreOperator = 381;
-  const int Rehashing = 382;
-  const int YouAreService = 383;
-  const int Time = 391;
-  const int UserStart = 392;
-  const int Users = 393;
-  const int EndOfUsers = 394;
-  const int NoUsers = 395;
-  const int TraceLink = 200;
-  const int TraceConnecting = 201;
-  const int TraceHandshake = 202;
-  const int TraceUnknown = 203;
-  const int TraceOperator = 204;
-  const int TraceUser = 205;
-  const int TraceServer = 206;
-  const int TraceService = 207;
-  const int TraceNewType = 208;
-  const int TraceClass = 209;
-  const int TraceConnect = 210;
-  const int TraceLog = 261;
-  const int TraceEnd = 262;
-  const int StatsLinkInfo = 211;
-  const int StatsCommands = 212;
-  const int EndOfStats = 219;
-  const int StatsUptime = 242;
-  const int StatsOnline = 243;
-  const int UModeIs = 221;
-  const int ServerList = 234;
-  const int ServerListEnd = 235;
-  const int ListUserClient = 251;
-  const int ListUserOperator = 252;
-  const int ListUserUnknown = 253;
-  const int ListUserChannels = 254;
-  const int ListUserMe = 255;
-  const int AdminMe = 256;
-  const int AdminLoc1 = 257;
-  const int AdminLoc2 = 258;
-  const int AdminEmail = 259;
-  const int TryAgain = 263;
-};
-
-namespace IRCError
-{
-  const int NoSuchNick = 401;
-  const int NoSuchServer = 402;
-  const int NoSuchChannel = 403;
-  const int CannotSendToChannel = 404;
-  const int TooManyChannels = 405;
-  const int WasNoSuchNick = 406;
-  const int TooManyTargets = 407;
-  const int NoSuchService = 408;
-  const int NoOrigin = 409;
-  const int NoRecipient = 411;
-  const int NoTextToSend = 412;
-  const int NoTopLevel = 413;
-  const int WildTopLevel = 414;
-  const int BasMask = 415;
-  const int UnknownCommand = 421;
-  const int NoMessageOfTheDay = 422;
-  const int NoAdminInfo = 423;
-  const int FileError = 424;
-  const int NoNickNameGiven = 431;
-  const int ErroneusNick = 432;
-  const int NicknameInUse = 433;
-  const int NickCollision = 436;
-  const int UnavailResource = 437;
-  const int UserNotInChannel = 441;
-  const int NotOnChannel = 442;
-  const int UserOnChannel = 443;
-  const int NoLogin = 444;
-  const int SummonDisabled = 445;
-  const int UsersDisabled = 446;
-  const int NotRegistered = 451;
-  const int NeedMoreParams = 461;
-  const int AlreadyRegistered = 462;
-  const int NoPermissionForHost = 463;
-  const int PasswordMismatch = 464;
-  const int YouAreBannedCreep = 465;
-  const int YouWillBeBanned = 466;
-  const int KeySet = 467;
-  const int ChannelIsFull = 471;
-  const int UnknownMode = 472;
-  const int InviteOnlyChannel = 473;
-  const int BannedFromChannel = 474;
-  const int BadChannelKey = 475;
-  const int BadChannelMask = 476;
-  const int NoChannelModes = 477;
-  const int BanListFull = 478;
-  const int NoPrivileges = 481;
-  const int ChannelOperatorPrivilegesNeeded = 482;
-  const int CannotKillServer = 483;
-  const int Restricted = 484;
-  const int UniqueOperatorPrivilegesNeeded = 485;
-  const int NoOperatorHost = 491;
-  const int YourModeListUnknownFlag = 501;
-  const int UsersDontMatch = 502;
-};
-
-#endif
--- a/gui/src/irc/IRCWidget.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,448 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ResourceManager.h"
-#include "IRCWidget.h"
-#include <QMessageBox>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QLabel>
-#include <QSettings>
-#include <QInputDialog>
-#include <QKeyEvent>
-#include <QScrollBar>
-#include <QApplication>
-#include "IRCClientImpl.h"
-
-ChatMessageTextEdit::ChatMessageTextEdit (QWidget *parent)
-  : QPlainTextEdit (parent), m_completer (0)
-{
-  setMaximumHeight (50);
-  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
-}
-
-ChatMessageTextEdit::~ChatMessageTextEdit ()
-{
-}
-
-void
-ChatMessageTextEdit::setCompleter (QCompleter *completer)
-{
-  if (m_completer)
-    QObject::disconnect (m_completer, 0, this, 0);
-
-  m_completer = completer;
-
-  if (!m_completer)
-    return;
-
-  m_completer->setWidget (this);
-  m_completer->setCompletionMode (QCompleter::PopupCompletion);
-  m_completer->setCaseSensitivity (Qt::CaseInsensitive);
-  QObject::connect (m_completer, SIGNAL (activated (QString)),
-                    this, SLOT (insertCompletion (QString)));
-}
-
-QCompleter *
-ChatMessageTextEdit::completer () const
-{
-  return m_completer;
-}
-
-void
-ChatMessageTextEdit::insertCompletion(const QString& completion)
-{
-
-  if (m_completer->widget() != this)
-    return;
-  QTextCursor tc = textCursor();
-  int extra = completion.length() - m_completer->completionPrefix().length();
-  tc.movePosition(QTextCursor::Left);
-  tc.movePosition(QTextCursor::EndOfWord);
-  tc.insertText(completion.right(extra));
-  setTextCursor(tc);
-}
-
-QString
-ChatMessageTextEdit::textUnderCursor () const
-{
-  QTextCursor tc = textCursor ();
-  tc.select (QTextCursor::WordUnderCursor);
-  return tc.selectedText ();
-}
-
-void
-ChatMessageTextEdit::focusInEvent (QFocusEvent *e)
-{
-  if (m_completer)
-    m_completer->setWidget (this);
-  QPlainTextEdit::focusInEvent (e);
-}
-
-void
-ChatMessageTextEdit::keyPressEvent (QKeyEvent *keyPressEvent)
-{
-  if (m_completer) {
-    switch (keyPressEvent->key ()) {
-    case Qt::Key_Enter:
-    case Qt::Key_Return:
-      if (! (keyPressEvent->modifiers () & Qt::ShiftModifier))
-        {
-          emit sendMessage (document ()->toPlainText ());
-          document ()->setPlainText ("");
-        }
-      else
-        {
-          QPlainTextEdit::keyPressEvent (keyPressEvent);
-        }
-      break;
-    case Qt::Key_Escape:
-    case Qt::Key_Tab:
-    case Qt::Key_Backtab:
-      keyPressEvent->ignore ();
-      return;
-    default:
-      QPlainTextEdit::keyPressEvent(keyPressEvent);
-      break;
-      }
-
-    QString completionPrefix = textUnderCursor ();
-    if (completionPrefix != m_completer->completionPrefix ())
-      {
-        m_completer->setCompletionPrefix(completionPrefix);
-      }
-
-    if (completionPrefix.length() > 2)
-      {
-        m_completer->popup ()->setCurrentIndex (m_completer->completionModel ()->index (0, 0));
-        m_completer->complete ();
-      }
-    else
-      {
-        m_completer->popup ()->hide ();
-      }
-  }
-}
-
-IRCWidget::IRCWidget (QWidget * parent):
-QWidget (parent)
-{
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  bool connectOnStartup = settings->value ("connectOnStartup").toBool ();
-  m_autoIdentification = settings->value ("autoIdentification").toBool ();
-  m_nickServPassword = settings->value ("nickServPassword").toString ();
-
-  m_initialNick = settings->value ("IRCNick").toString ();
-
-  if (m_initialNick.isEmpty ())
-    m_initialNick = "OctaveGUI-User";
-
-  QVBoxLayout *layout = new QVBoxLayout ();
-
-  m_chatWindow = new QTextEdit (this);
-  m_chatWindow->setReadOnly (true);
-  m_chatWindow->setEnabled (false);
-  QWidget *bottomWidget = new QWidget (this);
-
-  layout->addWidget (m_chatWindow);
-  layout->addWidget (bottomWidget);
-  layout->setMargin (0);
-  setLayout (layout);
-
-  QHBoxLayout *bottomLayout = new QHBoxLayout ();
-  m_nickButton = new QPushButton (bottomWidget);
-  m_nickButton->setStatusTip (tr ((char *) "Click here to change your nick."));
-  m_nickButton->setText (m_initialNick);
-  m_chatMessageTextEdit = new ChatMessageTextEdit (bottomWidget);
-  m_chatMessageTextEdit->setStatusTip (tr ((char *) "Enter your message here."));
-
-  bottomLayout->addWidget (m_nickButton);
-  bottomLayout->addWidget (new QLabel (":", this));
-  bottomLayout->addWidget (m_chatMessageTextEdit);
-  bottomLayout->setMargin (0);
-  bottomWidget->setLayout (bottomLayout);
-
-  m_nickButton->setEnabled (false);
-  m_chatMessageTextEdit->setEnabled (false);
-
-  //setFocusProxy (m_chatMessageTextEdit);
-  m_nickButton->setFocusProxy (m_chatMessageTextEdit);
-
-  QFont font;
-  font.setFamily ("Courier");
-  font.setPointSize (11);
-  m_chatWindow->setFont (font);
-  m_ircClientInterface = new IRCClientImpl (this);
-  m_octaveChannel = m_ircClientInterface->ircChannelProxy ("#octave");
-
-  connect (m_ircClientInterface, SIGNAL (connected (QString)),
-           this, SLOT (handleConnected (QString)));
-  connect (m_ircClientInterface, SIGNAL(loggedIn(QString)),
-           this, SLOT (joinOctaveChannel (QString)));
-  connect (m_ircClientInterface, SIGNAL (error (QString)),
-           this, SLOT (showErrorMessage (QString)));
-  connect (m_ircClientInterface, SIGNAL (debugMessage (QString)),
-           this, SLOT (showStatusMessage (QString)));
-  connect (m_ircClientInterface, SIGNAL (message (QString, QString, QString)),
-           this, SLOT (showMessage (QString, QString, QString )));
-  connect (m_ircClientInterface, SIGNAL (nicknameChanged (QString,QString)),
-           this, SLOT (handleNickChange (QString,QString)));
-  connect (m_ircClientInterface, SIGNAL (notification (QString,QString)),
-           this, SLOT (showNotification (QString,QString)));
-  connect (m_ircClientInterface, SIGNAL (loggedIn (QString)),
-           this, SLOT (handleLoggedIn(QString)));
-  connect (m_ircClientInterface, SIGNAL (userNicknameChanged (QString)),
-           this, SLOT (handleUserNicknameChanged (QString)));
-
-  connect (m_nickButton, SIGNAL (clicked ()), this, SLOT (showChangeUserNickPopup ()));
-  connect (m_chatMessageTextEdit, SIGNAL (sendMessage (QString)),
-           this, SLOT (sendMessage (QString)));
-
-  m_chatMessageTextEdit->setCompleter
-      (new QCompleter (m_ircClientInterface->ircChannelProxy ("#octave")->userListModel (), this));
-  m_chatWindow->setDocument (m_octaveChannel->conversationModel ());
-
-  if (connectOnStartup)
-    connectToServer ();
-}
-
-void
-IRCWidget::connectToServer ()
-{
-  showStatusMessage ("Looking up irc.freenode.net.");
-  QHostInfo hostInfo = QHostInfo::fromName ("irc.freenode.net");
-  QList<QHostAddress> hostAddresses = hostInfo.addresses();
-  if (hostAddresses.isEmpty ())
-    {
-      showStatusMessage ("Failed to lookup irc.freenode.net.");
-    }
-  else
-    {
-      showStatusMessage (QString ("Attempting to connect to %1.")
-                         .arg (hostAddresses.at (0).toString ()));
-      m_ircClientInterface->connectToHost(hostAddresses.at (0), 6667, m_initialNick);
-    }
-}
-
-void
-IRCWidget::showStatusMessage (const QString& message)
-{
-  m_chatWindow->append (QString ("<i>%1</i>").arg (message));
-}
-
-void
-IRCWidget::showErrorMessage (const QString& message)
-{
-  m_chatWindow->append (QString ("<i>Error: %1</i>").arg (message));
-}
-
-void
-IRCWidget::handleConnected (const QString &host)
-{
-  showStatusMessage (QString ("Connected to server %1.").arg (host));
-}
-
-void
-IRCWidget::joinOctaveChannel (const QString& nick)
-{
-  Q_UNUSED (nick);
-  showStatusMessage (QString ("Joining channel #octave."));
-  m_octaveChannel->sendJoinRequest ();
-}
-
-void
-IRCWidget::showMessage (const QString& channel, const QString& sender, const QString& message)
-{
-  Q_UNUSED (channel);
-
-  // TODO: This doesn't work properly!
-  // Every message makes it emit unreadMessage (true),
-  // though it should inly be emitted when this window
-  // does not have focus, ie. is not the active window.
-  if (!(hasFocus()
-      || m_chatMessageTextEdit->hasFocus ()
-      || m_nickButton->hasFocus ()
-      || m_chatWindow->hasFocus () ))
-    {
-      emit unreadMessages (true);
-    }
-
-  QString output;
-  QString htmlMessage = message;
-  htmlMessage.replace ("<", "&lt;");
-  htmlMessage.replace (">", "&gt;");
-  htmlMessage.replace ("\n", "<br>");
-  if (message.contains (m_ircClientInterface->nickname ()))
-    {
-      output =
-        QString ("<font color=\"#990000\"><b>%1:</b> %2</font>").arg (sender).
-        arg (htmlMessage);
-
-      QApplication::alert (this);
-    }
-  else
-    {
-      output =
-        QString ("<b>%1:</b> %2").arg (sender).
-        arg (htmlMessage);
-    }
-  m_chatWindow->append (output);
-  scrollToBottom ();
-}
-
-void
-IRCWidget::showNotification (const QString& sender, const QString& message)
-{
-  Q_UNUSED (sender);
-  m_chatWindow->append (QString ("<font color=\"#007700\">%1</font>").arg (message));
-  scrollToBottom ();
-}
-
-void
-IRCWidget::showChangeUserNickPopup ()
-{
-  bool ok;
-  QString newNick =
-    QInputDialog::getText (this, QString ("Nickname"),
-			   QString ("Type in your nickname:"),
-                           QLineEdit::Normal, m_ircClientInterface->nickname (), &ok);
-  if (ok)
-    {
-      m_ircClientInterface->sendNicknameChangeRequest (newNick);
-    }
-}
-
-void
-IRCWidget::sendMessage (QString message)
-{
-  // Do not send empty messages.
-  if (message.isEmpty ())
-    return;
-
-  // Remove trailing spaces.
-  while (message.at (0).isSpace ())
-    message.remove (0, 1);
-  if (message.startsWith ("/"))
-    {
-      QStringList line =
-	message.split (QRegExp ("\\s+"), QString::SkipEmptyParts);
-      if (line.at (0) == "/join")
-	{
-          IRCChannelProxyInterface *ircChannel = m_ircClientInterface->ircChannelProxy (line.at (1));
-          ircChannel->sendJoinRequest ();
-	}
-      else if (line.at (0) == "/nick")
-	{
-          m_ircClientInterface->sendNicknameChangeRequest (line.at (1));
-	}
-      else if (line.at (0) == "/msg")
-	{
-	  QString recipient = line.at (1);
-	  // Since we splitted the message before, we have to glue it together again.
-	  QString pmsg = "";
-	  for (int i = 2; i < line.length (); i++)
-	    {
-	      pmsg += line.at (i);
-	      pmsg += " ";
-	    }
-          m_ircClientInterface->sendPrivateMessage(recipient, pmsg);
-	}
-    }
-  else
-    {
-      m_octaveChannel->sendMessage (message);
-      message.replace ("<", "&lt;");
-      message.replace (">", "&gt;");
-      message.replace ("\n", "<br>");
-      m_chatWindow->append (QString ("<b>%1:</b> %2").
-                            arg (m_ircClientInterface->nickname ()).arg (message));
-    }
-
-  scrollToBottom ();
-}
-
-void
-IRCWidget::maybeIdentifyOnNickServ ()
-{
-  if (m_autoIdentification)
-    {
-      m_ircClientInterface->sendPrivateMessage("NickServ", QString ("identify %1").
-                                          arg (m_nickServPassword));
-    }
-}
-
-void
-IRCWidget::scrollToBottom ()
-{
-  if (m_chatWindow->verticalScrollBar ())
-    {
-      m_chatWindow->verticalScrollBar ()->setValue (m_chatWindow->verticalScrollBar ()->maximum ());
-    }
-}
-
-void
-IRCWidget::focusInEvent (QFocusEvent *focusEvent)
-{
-  Q_UNUSED (focusEvent);
-  emit unreadMessages (false);
-  QWidget::focusInEvent (focusEvent);
-
-  m_chatMessageTextEdit->setFocus ();
-}
-
-void
-IRCWidget::handleLoggedIn (const QString &nick)
-{
-  m_chatWindow->
-    append (QString
-            ("<i><font color=\"#00AA00\"><b>Successfully logged in as %1.</b></font></i>").
-            arg (nick));
-  m_nickButton->setEnabled (true);
-  m_chatMessageTextEdit->setEnabled (true);
-  m_chatWindow->setEnabled (true);
-  m_chatMessageTextEdit->setFocus ();
-}
-
-void
-IRCWidget::handleNickChange (const QString &oldNick, const QString &newNick)
-{
-  m_chatWindow->append (QString ("%1 is now known as %2.").arg (oldNick).arg (newNick));
-  scrollToBottom ();
-}
-
-void
-IRCWidget::handleUserJoined (const QString &nick, const QString &channel)
-{
-  m_chatWindow->append (QString ("<i>%1 has joined %2.</i>").arg (nick).arg (channel));
-  scrollToBottom ();
-}
-
-void
-IRCWidget::handleUserQuit (const QString &nick, const QString &reason)
-{
-  m_chatWindow->append (QString ("<i>%1 has quit.(%2).</i>").arg (nick).arg (reason));
-  scrollToBottom ();
-}
-
-void
-IRCWidget::handleUserNicknameChanged (const QString &nick)
-{
-  m_nickButton->setText (nick);
-  QSettings *settings = ResourceManager::instance ()->settings ();
-  settings->setValue ("IRCNick", nick);
-  maybeIdentifyOnNickServ ();
-}
--- a/gui/src/irc/IRCWidget.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef IRCWIDGET_H
-#define IRCWIDGET_H
-
-#include <QWidget>
-#include <QPlainTextEdit>
-#include <QPushButton>
-#include <QLineEdit>
-#include <QCompleter>
-#include "IRCClientInterface.h"
-
-class ChatMessageTextEdit : public QPlainTextEdit
-{
-  Q_OBJECT
-public:
-  explicit ChatMessageTextEdit(QWidget *parent = 0);
-  ~ChatMessageTextEdit();
-
-  void setCompleter(QCompleter *m_completer);
-  QCompleter *completer() const;
-
-signals:
-  void sendMessage (const QString& message);
-
-protected:
-  void keyPressEvent(QKeyEvent *e);
-  void focusInEvent(QFocusEvent *e);
-
-private slots:
-  void insertCompletion(const QString &completion);
-
-private:
-  QString textUnderCursor() const;
-
-private:
-  QCompleter *m_completer;
-};
-
-class IRCWidget : public QWidget
-{
-Q_OBJECT public:
-  explicit IRCWidget (QWidget * parent);
-  void connectToServer ();
-
-public slots:
-  void showStatusMessage (const QString&);
-  void showErrorMessage (const QString&);
-  void showMessage (const QString& channel, const QString& sender, const QString& message);
-  void showNotification (const QString& sender, const QString& message);
-
-  void handleConnected (const QString& host);
-  void joinOctaveChannel (const QString& nick);
-
-  void handleLoggedIn (const QString& nick);
-  void handleNickChange (const QString& oldNick, const QString& newNick);
-  void handleUserJoined (const QString& nick, const QString& channel);
-  void handleUserQuit (const QString& nick, const QString& reason);
-  void handleUserNicknameChanged (const QString& nick);
-
-  void showChangeUserNickPopup ();
-  void sendMessage (QString);
-
-  void maybeIdentifyOnNickServ ();
-  void scrollToBottom ();
-
-signals:
-  void unreadMessages (bool yes);
-
-protected:
-  void focusInEvent (QFocusEvent *focusEvent);
-
-private:
-  IRCClientInterface *m_ircClientInterface;
-  IRCChannelProxyInterface *m_octaveChannel;
-  QTextEdit *m_chatWindow;
-  QPushButton *m_nickButton;
-  ChatMessageTextEdit *m_chatMessageTextEdit;
-
-  QString m_initialNick;
-  bool m_autoIdentification;
-  QString m_nickServPassword;
-  QString m_settingsFile;
-};
-
-#endif // IRCWIDGET_H
--- a/gui/src/irc/Makefile.am	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-####### kdevelop will overwrite this part!!! (begin)##########
-bin_PROGRAMS = qirc
-  qirc_SOURCES =
-  programcommand.cpp newtab.cpp MainTab.cpp notifyshowcase.cpp channellist.
-  cpp dccget.cpp dccsend.cpp IServerSocket.cpp general.cpp listanicks.
-  cpp qirc.cpp ventanas.cpp inputBox.cpp cuadroListaNicks.
-  cpp cuadroConfiguracion.cpp cuadroConectarCon.cpp colamensajes.
-  cpp IRCClient.cpp IClientSocket.cpp Config.cpp ChatView.cpp main.
-  cpp qirc_LDADD = -lqt - lXext - lX11 $ (LIBSOCKET) SUBDIRS =
-  docs EXTRA_DIST =
-  main.cpp qirc.h ChatView.cpp ChatView.h Config.cpp Config.h IClientSocket.
-  cpp IClientSocket.h IRCClient.cpp IRCClient.h IRCCodes.h colamensajes.
-  cpp colamensajes.h cuadroConectarCon.cpp cuadroConectarCon.
-  h cuadroConfiguracion.cpp cuadroConfiguracion.h cuadroListaNicks.
-  cpp cuadroListaNicks.h inputBox.cpp inputBox.h ventanas.cpp ventanas.h qirc.
-  cpp resource.h qirc16x16.xpm qirc32x32.xpm qirc64x64.xpm listanicks.
-  cpp listanicks.h general.h general.cpp IServerSocket.cpp IServerSocket.
-  h dccsend.cpp dccsend.h dccget.cpp dccget.h connect.xpm dccsend.xpm help.
-  xpm connectto.xpm disconnect.xpm join.xpm part.xpm list.xpm channellist.
-  cpp channellist.h notifyshowcase.cpp notifyshowcase.h offline.xpm online.
-  xpm operator.xpm justconn.xpm MainTab.cpp MainTab.h newtab.cpp newtab.
-  h leftArrowDisabled.xpm leftArrowEnabled.xpm rightArrowDisabled.
-  xpm rightArrowEnabled.xpm tabLeft.xpm tabMiddle.xpm tabRight.xpm tabClose.
-  xpm programcommand.cpp programcommand.h
-####### kdevelop will overwrite this part!!! (end)############
-#set the include path for X, qt and KDE
-  INCLUDES = $ (all_includes)
-#claim, which subdirectories you want to install
-#you can add here more. This one gets installed
-  bin_PROGRAMS = qirc qirc_METASOURCES = USE_AUTOMOC
-#the library search path.
-  qirc_LDFLAGS = $ (all_libraries)
-#them while "make clean", use CLEANFILES
-  DISTCLEANFILES = $ (qirc_METASOURCES)
--- a/gui/src/lexer/lexeroctavegui.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "lexeroctavegui.h"
-#include <qcolor.h>
-#include <qfont.h>
-
-// -----------------------------------------------------
-// Some basic functions
-// -----------------------------------------------------
-LexerOctaveGui::LexerOctaveGui(QObject *parent)
-    : QsciLexer(parent)  // inherit from base lexer
-{
-}
-
-LexerOctaveGui::~LexerOctaveGui()
-{
-}
-
-const char *LexerOctaveGui::language() const
-{
-  return "Octave";  // return the name of the language
-}
-
-const char *LexerOctaveGui::lexer() const
-{
-  return "octave";  // return the name of the lexer
-}
-
-// -----------------------------------------------------
-// The colors for syntax highlighting
-// -----------------------------------------------------
-QColor LexerOctaveGui::defaultColor(int style) const
-{
-    switch (style)
-      {
-        case Default:  // black
-          return QColor(0x00,0x00,0x00);
-        case Operator: // red
-          return QColor(0xef,0x00,0x00);
-        case Comment:  // gray
-          return QColor(0x7f,0x7f,0x7f);
-        case Command:  // blue-green
-          return QColor(0x00,0x7f,0x7f);
-        case Number:   // orange
-          return QColor(0x7f,0x7f,0x00);
-        case Keyword:  // blue
-          return QColor(0x00,0x00,0xbf);
-        case SingleQuotedString: // green
-          return QColor(0x00,0x7f,0x00);
-        case DoubleQuotedString: // green-yellow
-          return QColor(0x4f,0x7f,0x00);
-      }
-    return QsciLexer::defaultColor(style);
-}
-
-
-// -----------------------------------------------------
-// The font decorations for highlighting
-// -----------------------------------------------------
-QFont LexerOctaveGui::defaultFont(int style) const
-{
-    QFont f;
-
-    switch (style)
-      {
-        case Comment: // default but italic
-          f = QsciLexer::defaultFont(style);
-          f.setItalic(true);
-          break;
-        case Keyword: // default
-          f = QsciLexer::defaultFont(style);
-          break;
-        case Operator:  // default
-          f = QsciLexer::defaultFont(style);
-          break;
-        default:        // default
-          f = QsciLexer::defaultFont(style);
-          break;
-      }
-    return f;   // return the selected font
-}
-
-
-// -----------------------------------------------------
-// Style names
-// -----------------------------------------------------
-QString LexerOctaveGui::description(int style) const
-{
-    switch (style)
-      {
-        case Default:
-          return tr("Default");
-        case Comment:
-          return tr("Comment");
-        case Command:
-          return tr("Command");
-        case Number:
-          return tr("Number");
-        case Keyword:
-          return tr("Keyword");
-        case SingleQuotedString:
-          return tr("Single-quoted string");
-        case Operator:
-          return tr("Operator");
-        case Identifier:
-          return tr("Identifier");
-        case DoubleQuotedString:
-          return tr("Double-quoted string");
-      }
-    return QString();
-}
-
-
-// -----------------------------------------------------
-// The set of keywords for highlighting
-// TODO: How to define a second set?
-// -----------------------------------------------------
-const char *LexerOctaveGui::keywords(int set) const
-{
-    if (set == 1)
-      {
-        return ResourceManager::instance ()->octaveKeywords ();
-      }
-    return 0;
-}
-
--- a/gui/src/lexer/lexeroctavegui.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef LEXEROCTAVE_H
-#define LEXEROCTAVE_H
-
-#include "ResourceManager.h"
-#include <QObject>
-
-#include <Qsci/qsciglobal.h>
-#include <Qsci/qscilexer.h>
-
-
-class LexerOctaveGui : public QsciLexer
-{
-    Q_OBJECT
-
-public:
-    // the used styles
-    enum
-      {
-        Default = 0,
-        Comment = 1,
-        Command = 2,
-        Number = 3,
-        Keyword = 4,
-        SingleQuotedString = 5,
-        Operator = 6,
-        Identifier = 7,
-        DoubleQuotedString = 8
-      };
-
-    LexerOctaveGui(QObject *parent = 0);
-    virtual ~LexerOctaveGui();
-    const char *language() const;
-    const char *lexer() const;
-    QColor defaultColor(int style) const;
-    QFont defaultFont(int style) const;
-    const char *keywords(int set) const;
-    QString description(int style) const;
-
-private:
-    LexerOctaveGui(const LexerOctaveGui &);
-    LexerOctaveGui &operator=(const LexerOctaveGui &);
-};
-
-#endif
--- a/gui/src/terminal/KPty.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,657 +0,0 @@
-/*
-
-   This file is part of the KDE libraries
-   Copyright (C) 2002 Waldo Bastian <bastian@kde.org>
-   Copyright (C) 2002-2003,2007-2008 Oswald Buddenhagen <ossi@kde.org>
-   Copyright (C) 2010 KDE e.V. <kde-ev-board@kde.org>
-     Author Adriaan de Groot <groot@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-   This library 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
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-
-
-#include "KPty.h"
-
-#include <QtCore/Q_PID>
-
-#define TTY_GROUP "tty"
-
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-
-///////////////////////
-// private functions //
-///////////////////////
-
-//////////////////
-// private data //
-//////////////////
-
-KPtyPrivate::KPtyPrivate (KPty * parent):
-masterFd (-1),
-slaveFd (-1),
-ownMaster (true),
-q_ptr (parent)
-{
-}
-
-KPtyPrivate::~KPtyPrivate ()
-{
-}
-
-#ifndef HAVE_OPENPTY
-bool
-KPtyPrivate::chownpty (bool grant)
-{
-  return !QProcess::execute (KStandardDirs::findExe ("kgrantpty"),
-                             QStringList () << (grant ? "--grant" :
-                                                "--revoke") << QString::
-                             number (masterFd));
-}
-#endif
-
-/////////////////////////////
-// public member functions //
-/////////////////////////////
-
-KPty::KPty ():
-d_ptr (new KPtyPrivate (this))
-{
-}
-
-KPty::KPty (KPtyPrivate * d):
-d_ptr (d)
-{
-  d_ptr->q_ptr = this;
-}
-
-KPty::~KPty ()
-{
-  close ();
-  delete d_ptr;
-}
-
-bool
-KPty::open ()
-{
-  Q_D (KPty);
-
-  if (d->masterFd >= 0)
-    return true;
-
-  d->ownMaster = true;
-
-  QByteArray ptyName;
-
-  // Find a master pty that we can open ////////////////////////////////
-
-  // Because not all the pty animals are created equal, they want to
-  // be opened by several different methods.
-
-  // We try, as we know them, one by one.
-
-#ifdef HAVE_OPENPTY
-
-  char ptsn[PATH_MAX];
-  if (::openpty (&d->masterFd, &d->slaveFd, ptsn, 0, 0))
-    {
-      d->masterFd = -1;
-      d->slaveFd = -1;
-      //kWarning(175) << "Can't open a pseudo teletype";
-      return false;
-    }
-  d->ttyName = ptsn;
-
-#else
-
-#ifdef HAVE__GETPTY		// irix
-
-  char *ptsn =
-    _getpty (&d->masterFd, O_RDWR | O_NOCTTY, S_IRUSR | S_IWUSR, 0);
-  if (ptsn)
-    {
-      d->ttyName = ptsn;
-      goto grantedpt;
-    }
-
-#elif defined(HAVE_PTSNAME) || defined(TIOCGPTN)
-
-#ifdef HAVE_POSIX_OPENPT
-  d->masterFd =::posix_openpt (O_RDWR | O_NOCTTY);
-#elif defined(HAVE_GETPT)
-  d->masterFd =::getpt ();
-#elif defined(PTM_DEVICE)
-  //d->masterFd = KDE_open(PTM_DEVICE, O_RDWR|O_NOCTTY);
-  d->masterFd =::open (PTM_DEVICE, O_RDWR | O_NOCTTY);
-#else
-#error No method to open a PTY master detected.
-#endif
-  if (d->masterFd >= 0)
-    {
-#ifdef HAVE_PTSNAME
-      char *ptsn = ptsname (d->masterFd);
-      if (ptsn)
-        {
-          d->ttyName = ptsn;
-#else
-      int ptyno;
-      if (!ioctl (d->masterFd, TIOCGPTN, &ptyno))
-        {
-          char buf[32];
-          sprintf (buf, "/dev/pts/%d", ptyno);
-          d->ttyName = buf;
-#endif
-#ifdef HAVE_GRANTPT
-          if (!grantpt (d->masterFd))
-            goto grantedpt;
-#else
-          goto gotpty;
-#endif
-        }
-      ::close (d->masterFd);
-      d->masterFd = -1;
-    }
-#endif // HAVE_PTSNAME || TIOCGPTN
-
-  // Linux device names, FIXME: Trouble on other systems?
-  for (const char *s3 = "pqrstuvwxyzabcde"; *s3; s3++)
-    {
-      for (const char *s4 = "0123456789abcdef"; *s4; s4++)
-        {
-          ptyName = QString ().sprintf ("/dev/pty%c%c", *s3, *s4).toAscii ();
-          d->ttyName =
-            QString ().sprintf ("/dev/tty%c%c", *s3, *s4).toAscii ();
-
-          d->masterFd =::open (ptyName.data (), O_RDWR);
-          if (d->masterFd >= 0)
-            {
-#ifdef Q_OS_SOLARIS
-              /* Need to check the process group of the pty.
-               * If it exists, then the slave pty is in use,
-               * and we need to get another one.
-               */
-              int pgrp_rtn;
-              if (ioctl (d->masterFd, TIOCGPGRP, &pgrp_rtn) == 0
-                  || errno != EIO)
-                {
-                  ::close (d->masterFd);
-                  d->masterFd = -1;
-                  continue;
-                }
-#endif /* Q_OS_SOLARIS */
-              if (!access (d->ttyName.data (), R_OK | W_OK))	// checks availability based on permission bits
-                {
-                  if (!geteuid ())
-                    {
-                      struct group *p = getgrnam (TTY_GROUP);
-                      if (!p)
-                        p = getgrnam ("wheel");
-                      gid_t gid = p ? p->gr_gid : getgid ();
-
-                      chown (d->ttyName.data (), getuid (), gid);
-                      chmod (d->ttyName.data (), S_IRUSR | S_IWUSR | S_IWGRP);
-                    }
-                  goto gotpty;
-                }
-              ::close (d->masterFd);
-              d->masterFd = -1;
-            }
-        }
-    }
-
-  //kWarning(175) << "Can't open a pseudo teletype";
-  return false;
-
-gotpty:
-  KDE_struct_stat st;
-  if (KDE_stat (d->ttyName.data (), &st))
-    return false;		// this just cannot happen ... *cough*  Yeah right, I just
-  // had it happen when pty #349 was allocated.  I guess
-  // there was some sort of leak?  I only had a few open.
-  if (((st.st_uid != getuid ()) ||
-       (st.st_mode & (S_IRGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH))) &&
-      !d->chownpty (true))
-    {
-
-      /*kWarning(175)
-         << "chownpty failed for device " << ptyName << "::" << d->ttyName
-         << "\nThis means the communication can be eavesdropped." << endl;
-       */
-    }
-
-grantedpt:
-
-#ifdef HAVE_REVOKE
-  revoke (d->ttyName.data ());
-#endif
-
-#ifdef HAVE_UNLOCKPT
-  unlockpt (d->masterFd);
-#elif defined(TIOCSPTLCK)
-  int flag = 0;
-  ioctl (d->masterFd, TIOCSPTLCK, &flag);
-#endif
-
-  d->slaveFd =::open (d->ttyName.data (), O_RDWR | O_NOCTTY);
-  if (d->slaveFd < 0)
-    {
-      //kWarning(175) << "Can't open slave pseudo teletype";
-      ::close (d->masterFd);
-      d->masterFd = -1;
-      return false;
-    }
-
-#if (defined(__svr4__) || defined(__sgi__) || defined(Q_OS_SOLARIS))
-  // Solaris uses STREAMS for terminal handling. It is possible
-  // for the pty handling modules to be left off the stream; in that
-  // case push them on. ioctl(fd, I_FIND, ...) is documented to return
-  // 1 if the module is on the stream already.
-  {
-    static const char *pt = "ptem";
-    static const char *ld = "ldterm";
-    if (ioctl (d->slaveFd, I_FIND, pt) == 0)
-      ioctl (d->slaveFd, I_PUSH, pt);
-    if (ioctl (d->slaveFd, I_FIND, ld) == 0)
-      ioctl (d->slaveFd, I_PUSH, ld);
-  }
-#endif
-
-#endif /* HAVE_OPENPTY */
-
-  fcntl (d->masterFd, F_SETFD, FD_CLOEXEC);
-  fcntl (d->slaveFd, F_SETFD, FD_CLOEXEC);
-
-  return true;
-}
-
-bool
-KPty::open (int fd)
-{
-#if !defined(HAVE_PTSNAME) && !defined(TIOCGPTN)
-  //kWarning(175) << "Unsupported attempt to open pty with fd" << fd;
-  return false;
-#else
-  Q_D (KPty);
-
-  if (d->masterFd >= 0)
-    {
-      //kWarning(175) << "Attempting to open an already open pty";
-      return false;
-    }
-
-  d->ownMaster = false;
-
-#ifdef HAVE_PTSNAME
-  char *ptsn = ptsname (fd);
-  if (ptsn)
-    {
-      d->ttyName = ptsn;
-#else
-  int ptyno;
-  if (!ioctl (fd, TIOCGPTN, &ptyno))
-    {
-      char buf[32];
-      sprintf (buf, "/dev/pts/%d", ptyno);
-      d->ttyName = buf;
-#endif
-    }
-  else
-    {
-      //kWarning(175) << "Failed to determine pty slave device for fd" << fd;
-      return false;
-    }
-
-  d->masterFd = fd;
-  if (!openSlave ())
-    {
-      d->masterFd = -1;
-      return false;
-    }
-
-  return true;
-#endif
-}
-
-void
-KPty::closeSlave ()
-{
-  Q_D (KPty);
-
-  if (d->slaveFd < 0)
-    return;
-  ::close (d->slaveFd);
-  d->slaveFd = -1;
-}
-
-bool
-KPty::openSlave ()
-{
-  Q_D (KPty);
-
-  if (d->slaveFd >= 0)
-    return true;
-  if (d->masterFd < 0)
-    {
-      //kWarning(175) << "Attempting to open pty slave while master is closed";
-      return false;
-    }
-  d->slaveFd =::open (d->ttyName.data (), O_RDWR | O_NOCTTY);
-  if (d->slaveFd < 0)
-    {
-      //kWarning(175) << "Can't open slave pseudo teletype";
-      return false;
-    }
-  fcntl (d->slaveFd, F_SETFD, FD_CLOEXEC);
-  return true;
-}
-
-void
-KPty::close ()
-{
-  Q_D (KPty);
-
-  if (d->masterFd < 0)
-    return;
-  closeSlave ();
-  if (d->ownMaster)
-    {
-#ifndef HAVE_OPENPTY
-      // don't bother resetting unix98 pty, it will go away after closing master anyway.
-      if (memcmp (d->ttyName.data (), "/dev/pts/", 9))
-        {
-          if (!geteuid ())
-            {
-              struct stat st;
-              if (!stat (d->ttyName.data (), &st))
-                {
-                  chown (d->ttyName.data (), 0,
-                         st.st_gid == getgid ()? 0 : -1);
-                  chmod (d->ttyName.data (),
-                         S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
-                         S_IWOTH);
-                }
-            }
-          else
-            {
-              fcntl (d->masterFd, F_SETFD, 0);
-              d->chownpty (false);
-            }
-        }
-#endif
-      ::close (d->masterFd);
-    }
-  d->masterFd = -1;
-}
-
-void
-KPty::setCTty ()
-{
-  Q_D (KPty);
-
-  // Setup job control //////////////////////////////////
-
-  // Become session leader, process group leader,
-  // and get rid of the old controlling terminal.
-  setsid ();
-
-  // make our slave pty the new controlling terminal.
-#ifdef TIOCSCTTY
-  ioctl (d->slaveFd, TIOCSCTTY, 0);
-#else
-  // __svr4__ hack: the first tty opened after setsid() becomes controlling tty
-  ::close (open (d->ttyName, O_WRONLY, 0));
-#endif
-
-  // make our new process group the foreground group on the pty
-  int pgrp = getpid ();
-#if defined(_POSIX_VERSION) || defined(__svr4__)
-  tcsetpgrp (d->slaveFd, pgrp);
-#elif defined(TIOCSPGRP)
-  ioctl (d->slaveFd, TIOCSPGRP, (char *) &pgrp);
-#endif
-}
-
-void
-KPty::login (const char *user, const char *remotehost)
-{
-#ifdef HAVE_UTEMPTER
-  Q_D (KPty);
-
-  addToUtmp (d->ttyName, remotehost, d->masterFd);
-  Q_UNUSED (user);
-#else
-#ifdef HAVE_UTMPX
-  struct utmpx l_struct;
-#else
-  struct utmp l_struct;
-#endif
-  memset (&l_struct, 0, sizeof (l_struct));
-  // note: strncpy without terminators _is_ correct here. man 4 utmp
-
-  if (user)
-    strncpy (l_struct.ut_name, user, sizeof (l_struct.ut_name));
-
-  if (remotehost)
-    {
-      strncpy (l_struct.ut_host, remotehost, sizeof (l_struct.ut_host));
-#ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
-      l_struct.ut_syslen =
-        qMin (strlen (remotehost), sizeof (l_struct.ut_host));
-#endif
-    }
-
-#ifndef __GLIBC__
-  Q_D (KPty);
-  const char *str_ptr = d->ttyName.data ();
-  if (!memcmp (str_ptr, "/dev/", 5))
-    str_ptr += 5;
-  strncpy (l_struct.ut_line, str_ptr, sizeof (l_struct.ut_line));
-#ifdef HAVE_STRUCT_UTMP_UT_ID
-  strncpy (l_struct.ut_id,
-           str_ptr + strlen (str_ptr) - sizeof (l_struct.ut_id),
-           sizeof (l_struct.ut_id));
-#endif
-#endif
-
-#ifdef HAVE_UTMPX
-  //gettimeofday(&l_struct.ut_tv, 0);
-  gettimeofday ((struct timeval *) &l_struct.ut_tv, 0);
-#else
-  l_struct.ut_time = time (0);
-#endif
-
-#ifdef HAVE_LOGIN
-#ifdef HAVE_LOGINX
-  ::loginx (&l_struct);
-#else
-  ::login (&l_struct);
-#endif
-#else
-#ifdef HAVE_STRUCT_UTMP_UT_TYPE
-  l_struct.ut_type = USER_PROCESS;
-#endif
-#ifdef HAVE_STRUCT_UTMP_UT_PID
-  l_struct.ut_pid = getpid ();
-#ifdef HAVE_STRUCT_UTMP_UT_SESSION
-  l_struct.ut_session = getsid (0);
-#endif
-#endif
-#ifdef HAVE_UTMPX
-  utmpxname (_PATH_UTMPX);
-  setutxent ();
-  pututxline (&l_struct);
-  endutxent ();
-  //updwtmpx(_PATH_WTMPX, &l_struct);
-#else
-  utmpname (_PATH_UTMP);
-  setutent ();
-  pututline (&l_struct);
-  endutent ();
-  updwtmp (_PATH_WTMP, &l_struct);
-#endif
-#endif
-#endif
-}
-
-void
-KPty::logout ()
-{
-#ifdef HAVE_UTEMPTER
-  Q_D (KPty);
-
-  removeLineFromUtmp (d->ttyName, d->masterFd);
-#else
-  Q_D (KPty);
-
-  const char *str_ptr = d->ttyName.data ();
-  if (!memcmp (str_ptr, "/dev/", 5))
-    str_ptr += 5;
-#ifdef __GLIBC__
-  else
-    {
-      const char *sl_ptr = strrchr (str_ptr, '/');
-      if (sl_ptr)
-        str_ptr = sl_ptr + 1;
-    }
-#endif
-#ifdef HAVE_LOGIN
-#ifdef HAVE_LOGINX
-  ::logoutx (str_ptr, 0, DEAD_PROCESS);
-#else
-  ::logout (str_ptr);
-#endif
-#else
-#ifdef HAVE_UTMPX
-  struct utmpx l_struct, *ut;
-#else
-  struct utmp l_struct, *ut;
-#endif
-  memset (&l_struct, 0, sizeof (l_struct));
-
-  strncpy (l_struct.ut_line, str_ptr, sizeof (l_struct.ut_line));
-
-#ifdef HAVE_UTMPX
-  utmpxname (_PATH_UTMPX);
-  setutxent ();
-  if ((ut = getutxline (&l_struct)))
-    {
-#else
-  utmpname (_PATH_UTMP);
-  setutent ();
-  if ((ut = getutline (&l_struct)))
-    {
-#endif
-      memset (ut->ut_name, 0, sizeof (*ut->ut_name));
-      memset (ut->ut_host, 0, sizeof (*ut->ut_host));
-#ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
-      ut->ut_syslen = 0;
-#endif
-#ifdef HAVE_STRUCT_UTMP_UT_TYPE
-      ut->ut_type = DEAD_PROCESS;
-#endif
-#ifdef HAVE_UTMPX
-      //gettimeofday(&(ut->ut_tv), 0);
-      gettimeofday ((struct timeval *) &(ut->ut_tv), 0);
-      pututxline (ut);
-    }
-  endutxent ();
-#else
-      ut->ut_time = time (0);
-      pututline (ut);
-    }
-  endutent ();
-#endif
-#endif
-#endif
-}
-
-bool
-KPty::tcGetAttr (struct::termios * ttmode) const
-{
-  Q_D (const KPty);
-
-#ifdef Q_OS_SOLARIS
-  if (_tcgetattr (d->slaveFd, ttmode) == 0)
-    return true;
-#endif
-  return _tcgetattr (d->masterFd, ttmode) == 0;
-}
-
-bool
-KPty::tcSetAttr (struct::termios * ttmode)
-{
-  Q_D (KPty);
-
-#ifdef Q_OS_SOLARIS
-  if (_tcsetattr (d->slaveFd, ttmode) == 0)
-    return true;
-#endif
-  return _tcsetattr (d->masterFd, ttmode) == 0;
-}
-
-bool
-KPty::setWinSize (int lines, int columns)
-{
-  Q_D (KPty);
-
-  struct winsize winSize;
-  memset (&winSize, 0, sizeof (winSize));
-  winSize.ws_row = (unsigned short) lines;
-  winSize.ws_col = (unsigned short) columns;
-  return ioctl (d->masterFd, TIOCSWINSZ, (char *) &winSize) == 0;
-}
-
-bool
-KPty::setEcho (bool echo)
-{
-  struct::termios ttmode;
-  if (!tcGetAttr (&ttmode))
-    return false;
-  if (!echo)
-    ttmode.c_lflag &= ~ECHO;
-  else
-    ttmode.c_lflag |= ECHO;
-  return tcSetAttr (&ttmode);
-}
-
-const char *
-KPty::ttyName () const
-{
-  Q_D (const KPty);
-
-  return d->ttyName.data ();
-}
-
-int
-KPty::masterFd () const
-{
-  Q_D (const KPty);
-
-  return d->masterFd;
-}
-
-int
-KPty::slaveFd () const
-{
-  Q_D (const KPty);
-
-  return d->slaveFd;
-}
--- a/gui/src/terminal/KPty.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-/* This file is part of the KDE libraries
-
-    Copyright (C) 2003,2007 Oswald Buddenhagen <ossi@kde.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library 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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef kpty_h
-#define kpty_h
-
-#ifdef __APPLE__
-#ifndef Q_OS_MAC
-#define Q_OS_MAC
-#endif
-#endif
-
-#if defined(Q_OS_MAC)
-#define HAVE_UTIL_H
-#define HAVE_UTMPX
-#define _UTMPX_COMPAT
-#define HAVE_PTSNAME
-#define HAVE_SYS_TIME_H
-#else
-#define HAVE_PTY_H
-#endif
-
-#define HAVE_OPENPTY
-
-#include <QtCore/QByteArray>
-
-#ifdef __sgi
-#define __svr4__
-#endif
-
-#ifdef __osf__
-#define _OSF_SOURCE
-#include <float.h>
-#endif
-
-#ifdef _AIX
-#define _ALL_SOURCE
-#endif
-
-// __USE_XOPEN isn't defined by default in ICC
-// (needed for ptsname(), grantpt() and unlockpt())
-#ifdef __INTEL_COMPILER
-#ifndef __USE_XOPEN
-#define __USE_XOPEN
-#endif
-#endif
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <time.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <grp.h>
-
-#if defined(HAVE_PTY_H)
-#include <pty.h>
-#endif
-
-#ifdef HAVE_LIBUTIL_H
-#include <libutil.h>
-#elif defined(HAVE_UTIL_H)
-#include <util.h>
-#endif
-
-#define HAVE_UTMPX
-#define _UTMPX_COMPAT
-
-#ifdef HAVE_UTEMPTER
-extern "C"
-{
-#include <utempter.h>
-}
-#else
-#include <utmp.h>
-#ifdef HAVE_UTMPX
-#include <utmpx.h>
-#endif
-#if !defined(_PATH_UTMPX) && defined(_UTMPX_FILE)
-#define _PATH_UTMPX _UTMPX_FILE
-#endif
-#if !defined(_PATH_WTMPX) && defined(_WTMPX_FILE)
-#define _PATH_WTMPX _WTMPX_FILE
-#endif
-#endif
-
-/* for HP-UX (some versions) the extern C is needed, and for other
-   platforms it doesn't hurt */
-extern "C"
-{
-#include <termios.h>
-#if defined(HAVE_TERMIO_H)
-#include <termio.h>		// struct winsize on some systems
-#endif
-}
-
-#if defined (_HPUX_SOURCE)
-#define _TERMIOS_INCLUDED
-#include <bsdtty.h>
-#endif
-
-#ifdef HAVE_SYS_STROPTS_H
-#include <sys/stropts.h>	// Defines I_PUSH
-#define _NEW_TTY_CTRL
-#endif
-
-#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
-#define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode)
-#else
-#if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) || defined(__sun)
-#define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode)
-#else
-#define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode)
-#endif
-#endif
-
-#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
-#define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode)
-#else
-#if defined(_HPUX_SOURCE) || defined(__CYGWIN__) || defined(__sun)
-#define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode)
-#else
-#define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode)
-#endif
-#endif
-
-#include <QtCore/qglobal.h>
-#include <QByteArray>
-
-class KPty;
-struct KPtyPrivate
-{
-  Q_DECLARE_PUBLIC (KPty) KPtyPrivate (KPty * parent);
-  virtual ~ KPtyPrivate ();
-  bool chownpty (bool grant);
-
-  int masterFd;
-  int slaveFd;
-  bool ownMaster:1;
-
-  QByteArray ttyName;
-
-  KPty *q_ptr;
-};
-
-struct termios;
-
-/**
- * Provides primitives for opening & closing a pseudo TTY pair, assigning the
- * controlling TTY, utmp registration and setting various terminal attributes.
- */
-class KPty
-{
-Q_DECLARE_PRIVATE (KPty) public:
-
-  /**
-   * Constructor
-   */
-  KPty ();
-
-  /**
-   * Destructor:
-   *
-   *  If the pty is still open, it will be closed. Note, however, that
-   *  an utmp registration is @em not undone.
-  */
-  ~KPty ();
-
-  /**
-   * Create a pty master/slave pair.
-   *
-   * @return true if a pty pair was successfully opened
-   */
-  bool open ();
-
-  /**
-   * Open using an existing pty master.
-   *
-   * @param fd an open pty master file descriptor.
-   *   The ownership of the fd remains with the caller;
-   *   it will not be automatically closed at any point.
-   * @return true if a pty pair was successfully opened
-   */
-  bool open (int fd);
-
-  /**
-   * Close the pty master/slave pair.
-   */
-  void close ();
-
-  /**
-   * Close the pty slave descriptor.
-   *
-   * When creating the pty, KPty also opens the slave and keeps it open.
-   * Consequently the master will never receive an EOF notification.
-   * Usually this is the desired behavior, as a closed pty slave can be
-   * reopened any time - unlike a pipe or socket. However, in some cases
-   * pipe-alike behavior might be desired.
-   *
-   * After this function was called, slaveFd() and setCTty() cannot be
-   * used.
-   */
-  void closeSlave ();
-
-  /**
-   * Open the pty slave descriptor.
-   *
-   * This undoes the effect of closeSlave().
-   *
-   * @return true if the pty slave was successfully opened
-   */
-  bool openSlave ();
-
-  /**
-   * Creates a new session and process group and makes this pty the
-   * controlling tty.
-   */
-  void setCTty ();
-
-  /**
-   * Creates an utmp entry for the tty.
-   * This function must be called after calling setCTty and
-   * making this pty the stdin.
-   * @param user the user to be logged on
-   * @param remotehost the host from which the login is coming. This is
-   *  @em not the local host. For remote logins it should be the hostname
-   *  of the client. For local logins from inside an X session it should
-   *  be the name of the X display. Otherwise it should be empty.
-   */
-  void login (const char *user = 0, const char *remotehost = 0);
-
-  /**
-   * Removes the utmp entry for this tty.
-   */
-  void logout ();
-
-  /**
-   * Wrapper around tcgetattr(3).
-   *
-   * This function can be used only while the PTY is open.
-   * You will need an #include &lt;termios.h&gt; to do anything useful
-   * with it.
-   *
-   * @param ttmode a pointer to a termios structure.
-   *  Note: when declaring ttmode, @c struct @c ::termios must be used -
-   *  without the '::' some version of HP-UX thinks, this declares
-   *  the struct in your class, in your method.
-   * @return @c true on success, false otherwise
-   */
-  bool tcGetAttr (struct::termios * ttmode) const;
-
-  /**
-   * Wrapper around tcsetattr(3) with mode TCSANOW.
-   *
-   * This function can be used only while the PTY is open.
-   *
-   * @param ttmode a pointer to a termios structure.
-   * @return @c true on success, false otherwise. Note that success means
-   *  that @em at @em least @em one attribute could be set.
-   */
-  bool tcSetAttr (struct::termios * ttmode);
-
-  /**
-   * Change the logical (screen) size of the pty.
-   * The default is 24 lines by 80 columns.
-   *
-   * This function can be used only while the PTY is open.
-   *
-   * @param lines the number of rows
-   * @param columns the number of columns
-   * @return @c true on success, false otherwise
-   */
-  bool setWinSize (int lines, int columns);
-
-  /**
-   * Set whether the pty should echo input.
-   *
-   * Echo is on by default.
-   * If the output of automatically fed (non-interactive) PTY clients
-   * needs to be parsed, disabling echo often makes it much simpler.
-   *
-   * This function can be used only while the PTY is open.
-   *
-   * @param echo true if input should be echoed.
-   * @return @c true on success, false otherwise
-   */
-  bool setEcho (bool echo);
-
-  /**
-   * @return the name of the slave pty device.
-   *
-   * This function should be called only while the pty is open.
-   */
-  const char *ttyName () const;
-
-  /**
-   * @return the file descriptor of the master pty
-   *
-   * This function should be called only while the pty is open.
-   */
-  int masterFd () const;
-
-  /**
-   * @return the file descriptor of the slave pty
-   *
-   * This function should be called only while the pty slave is open.
-   */
-  int slaveFd () const;
-
-protected:
-  /**
-   * @internal
-   */
-    KPty (KPtyPrivate * d);
-
-  /**
-   * @internal
-   */
-  KPtyPrivate *const d_ptr;
-};
-
-#endif
--- a/gui/src/terminal/KPtyDevice.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,456 +0,0 @@
-/*
-
-   This file is part of the KDE libraries
-   Copyright (C) 2007 Oswald Buddenhagen <ossi@kde.org>
-   Copyright (C) 2010 KDE e.V. <kde-ev-board@kde.org>
-     Author Adriaan de Groot <groot@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-   This library 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
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-
-
-#include "KPtyDevice.h"
-#define i18n
-
-#include <QtCore/QSocketNotifier>
-
-#include <unistd.h>
-#include <errno.h>
-#include <signal.h>
-#include <termios.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#if defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
-  // "the other end's output queue size" - kinda braindead, huh?
-#define PTY_BYTES_AVAILABLE TIOCOUTQ
-#elif defined(TIOCINQ)
-  // "our end's input queue size"
-#define PTY_BYTES_AVAILABLE TIOCINQ
-#else
-  // likewise. more generic ioctl (theoretically)
-#define PTY_BYTES_AVAILABLE FIONREAD
-#endif
-
-//////////////////
-// private data //
-//////////////////
-
-// Lifted from Qt. I don't think they would mind. ;)
-// Re-lift again from Qt whenever a proper replacement for pthread_once appears
-static void
-qt_ignore_sigpipe ()
-{
-  static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER (0);
-  if (atom.testAndSetRelaxed (0, 1))
-    {
-      struct sigaction noaction;
-      memset (&noaction, 0, sizeof (noaction));
-      noaction.sa_handler = SIG_IGN;
-      sigaction (SIGPIPE, &noaction, 0);
-    }
-}
-
-#define NO_INTR(ret,func) do { ret = func; } while (ret < 0 && errno == EINTR)
-
-bool
-KPtyDevicePrivate::_k_canRead ()
-{
-  Q_Q (KPtyDevice);
-  qint64 readBytes = 0;
-
-#ifdef Q_OS_IRIX		// this should use a config define, but how to check it?
-  size_t available;
-#else
-  int available;
-#endif
-  if (!::ioctl (q->masterFd (), PTY_BYTES_AVAILABLE, (char *) &available))
-    {
-#ifdef Q_OS_SOLARIS
-      // A Pty is a STREAMS module, and those can be activated
-      // with 0 bytes available. This happens either when ^C is
-      // pressed, or when an application does an explicit write(a,b,0)
-      // which happens in experiments fairly often. When 0 bytes are
-      // available, you must read those 0 bytes to clear the STREAMS
-      // module, but we don't want to hit the !readBytes case further down.
-      if (!available)
-        {
-          char c;
-          // Read the 0-byte STREAMS message
-          NO_INTR (readBytes, read (q->masterFd (), &c, 0));
-          // Should return 0 bytes read; -1 is error
-          if (readBytes < 0)
-            {
-              readNotifier->setEnabled (false);
-              emit q->readEof ();
-              return false;
-            }
-          return true;
-        }
-#endif
-
-      char *ptr = readBuffer.reserve (available);
-#ifdef Q_OS_SOLARIS
-      // Even if available > 0, it is possible for read()
-      // to return 0 on Solaris, due to 0-byte writes in the stream.
-      // Ignore them and keep reading until we hit *some* data.
-      // In Solaris it is possible to have 15 bytes available
-      // and to (say) get 0, 0, 6, 0 and 9 bytes in subsequent reads.
-      // Because the stream is set to O_NONBLOCK in finishOpen(),
-      // an EOF read will return -1.
-      readBytes = 0;
-      while (!readBytes)
-#endif
-        // Useless block braces except in Solaris
-        {
-          NO_INTR (readBytes, read (q->masterFd (), ptr, available));
-        }
-      if (readBytes < 0)
-        {
-          readBuffer.unreserve (available);
-          q->setErrorString (i18n ("Error reading from PTY"));
-          return false;
-        }
-      readBuffer.unreserve (available - readBytes);	// *should* be a no-op
-    }
-
-  if (!readBytes)
-    {
-      readNotifier->setEnabled (false);
-      emit q->readEof ();
-      return false;
-    }
-  else
-    {
-      if (!emittedReadyRead)
-        {
-          emittedReadyRead = true;
-          emit q->readyRead ();
-          emittedReadyRead = false;
-        }
-      return true;
-    }
-}
-
-bool
-KPtyDevicePrivate::_k_canWrite ()
-{
-  Q_Q (KPtyDevice);
-
-  writeNotifier->setEnabled (false);
-  if (writeBuffer.isEmpty ())
-    return false;
-
-  qt_ignore_sigpipe ();
-  int wroteBytes;
-  NO_INTR (wroteBytes,
-           write (q->masterFd (),
-                  writeBuffer.readPointer (), writeBuffer.readSize ()));
-  if (wroteBytes < 0)
-    {
-      q->setErrorString (i18n ("Error writing to PTY"));
-      return false;
-    }
-  writeBuffer.free (wroteBytes);
-
-  if (!emittedBytesWritten)
-    {
-      emittedBytesWritten = true;
-      emit q->bytesWritten (wroteBytes);
-      emittedBytesWritten = false;
-    }
-
-  if (!writeBuffer.isEmpty ())
-    writeNotifier->setEnabled (true);
-  return true;
-}
-
-#ifndef timeradd
-// Lifted from GLIBC
-#define timeradd(a, b, result) \
-    do { \
-        (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
-        (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
-        if ((result)->tv_usec >= 1000000) { \
-            ++(result)->tv_sec; \
-            (result)->tv_usec -= 1000000; \
-        } \
-    } while (0)
-#define timersub(a, b, result) \
-    do { \
-        (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
-        (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
-        if ((result)->tv_usec < 0) { \
-            --(result)->tv_sec; \
-            (result)->tv_usec += 1000000; \
-        } \
-    } while (0)
-#endif
-
-bool
-KPtyDevicePrivate::doWait (int msecs, bool reading)
-{
-  Q_Q (KPtyDevice);
-#ifndef __linux__
-  struct timeval etv;
-#endif
-  struct timeval tv, *tvp;
-
-  if (msecs < 0)
-    tvp = 0;
-  else
-    {
-      tv.tv_sec = msecs / 1000;
-      tv.tv_usec = (msecs % 1000) * 1000;
-#ifndef __linux__
-      gettimeofday (&etv, 0);
-      timeradd (&tv, &etv, &etv);
-#endif
-      tvp = &tv;
-    }
-
-  while (reading ? readNotifier->isEnabled () : !writeBuffer.isEmpty ())
-    {
-      fd_set rfds;
-      fd_set wfds;
-
-      FD_ZERO (&rfds);
-      FD_ZERO (&wfds);
-
-      if (readNotifier->isEnabled ())
-        FD_SET (q->masterFd (), &rfds);
-      if (!writeBuffer.isEmpty ())
-        FD_SET (q->masterFd (), &wfds);
-
-#ifndef __linux__
-      if (tvp)
-        {
-          gettimeofday (&tv, 0);
-          timersub (&etv, &tv, &tv);
-          if (tv.tv_sec < 0)
-            tv.tv_sec = tv.tv_usec = 0;
-        }
-#endif
-
-      switch (select (q->masterFd () + 1, &rfds, &wfds, 0, tvp))
-        {
-        case -1:
-          if (errno == EINTR)
-            break;
-          return false;
-        case 0:
-          q->setErrorString (i18n ("PTY operation timed out"));
-          return false;
-        default:
-          if (FD_ISSET (q->masterFd (), &rfds))
-            {
-              bool canRead = _k_canRead ();
-              if (reading && canRead)
-                return true;
-            }
-          if (FD_ISSET (q->masterFd (), &wfds))
-            {
-              bool canWrite = _k_canWrite ();
-              if (!reading)
-                return canWrite;
-            }
-          break;
-        }
-    }
-  return false;
-}
-
-void
-KPtyDevicePrivate::finishOpen (QIODevice::OpenMode mode)
-{
-  Q_Q (KPtyDevice);
-
-  q->QIODevice::open (mode);
-  fcntl (q->masterFd (), F_SETFL, O_NONBLOCK);
-  readBuffer.clear ();
-  readNotifier =
-    new QSocketNotifier (q->masterFd (), QSocketNotifier::Read, q);
-  writeNotifier =
-    new QSocketNotifier (q->masterFd (), QSocketNotifier::Write, q);
-  QObject::connect (readNotifier, SIGNAL (activated (int)), q,
-                    SLOT (_k_canRead ()));
-  QObject::connect (writeNotifier, SIGNAL (activated (int)), q,
-                    SLOT (_k_canWrite ()));
-  readNotifier->setEnabled (true);
-}
-
-/////////////////////////////
-// public member functions //
-/////////////////////////////
-
-KPtyDevice::KPtyDevice (QObject * parent):
-QIODevice (parent), KPty (new KPtyDevicePrivate (this))
-{
-}
-
-KPtyDevice::~KPtyDevice ()
-{
-  close ();
-}
-
-bool
-KPtyDevice::open (OpenMode mode)
-{
-  Q_D (KPtyDevice);
-
-  if (masterFd () >= 0)
-    return true;
-
-  if (!KPty::open ())
-    {
-      setErrorString (i18n ("Error opening PTY"));
-      return false;
-    }
-
-  d->finishOpen (mode);
-
-  return true;
-}
-
-bool
-KPtyDevice::open (int fd, OpenMode mode)
-{
-  Q_D (KPtyDevice);
-
-  if (!KPty::open (fd))
-    {
-      setErrorString (i18n ("Error opening PTY"));
-      return false;
-    }
-
-  d->finishOpen (mode);
-
-  return true;
-}
-
-void
-KPtyDevice::close ()
-{
-  Q_D (KPtyDevice);
-
-  if (masterFd () < 0)
-    return;
-
-  delete d->readNotifier;
-  delete d->writeNotifier;
-
-  QIODevice::close ();
-
-  KPty::close ();
-}
-
-bool
-KPtyDevice::isSequential () const
-{
-  return true;
-}
-
-bool
-KPtyDevice::canReadLine () const
-{
-  Q_D (const KPtyDevice);
-  return QIODevice::canReadLine () || d->readBuffer.canReadLine ();
-}
-
-bool
-KPtyDevice::atEnd () const
-{
-  Q_D (const KPtyDevice);
-  return QIODevice::atEnd () && d->readBuffer.isEmpty ();
-}
-
-qint64
-KPtyDevice::bytesAvailable () const
-{
-  Q_D (const KPtyDevice);
-  return QIODevice::bytesAvailable () + d->readBuffer.size ();
-}
-
-qint64
-KPtyDevice::bytesToWrite () const
-{
-  Q_D (const KPtyDevice);
-  return d->writeBuffer.size ();
-}
-
-bool
-KPtyDevice::waitForReadyRead (int msecs)
-{
-  Q_D (KPtyDevice);
-  return d->doWait (msecs, true);
-}
-
-bool
-KPtyDevice::waitForBytesWritten (int msecs)
-{
-  Q_D (KPtyDevice);
-  return d->doWait (msecs, false);
-}
-
-void
-KPtyDevice::setSuspended (bool suspended)
-{
-  Q_D (KPtyDevice);
-  d->readNotifier->setEnabled (!suspended);
-}
-
-bool
-KPtyDevice::isSuspended () const
-{
-  Q_D (const KPtyDevice);
-  return !d->readNotifier->isEnabled ();
-}
-
-// protected
-qint64
-KPtyDevice::readData (char *data, qint64 maxlen)
-{
-  Q_D (KPtyDevice);
-  return d->readBuffer.read (data, (int) qMin < qint64 > (maxlen, KMAXINT));
-}
-
-// protected
-qint64
-KPtyDevice::readLineData (char *data, qint64 maxlen)
-{
-  Q_D (KPtyDevice);
-  return d->readBuffer.readLine (data,
-                                 (int) qMin < qint64 > (maxlen, KMAXINT));
-}
-
-// protected
-qint64
-KPtyDevice::writeData (const char *data, qint64 len)
-{
-  Q_D (KPtyDevice);
-  Q_ASSERT (len <= KMAXINT);
-
-  d->writeBuffer.write (data, len);
-  d->writeNotifier->setEnabled (true);
-  return len;
-}
-
--- a/gui/src/terminal/KPtyDevice.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-/* This file is part of the KDE libraries
-
-    Copyright (C) 2007 Oswald Buddenhagen <ossi@kde.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library 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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef kptydev_h
-#define kptydev_h
-
-struct KPtyPrivate;
-struct KPtyDevicePrivate;
-
-#include "KPty.h"
-#include <QtCore/QIODevice>
-#include <QSocketNotifier>
-
-#define Q_DECLARE_PRIVATE_MI(Class, SuperClass) \
-    inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(SuperClass::d_ptr); } \
-    inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(SuperClass::d_ptr); } \
-    friend class Class##Private;
-
-/**
- * Encapsulates KPty into a QIODevice, so it can be used with Q*Stream, etc.
- */
-class KPtyDevice:public QIODevice, public KPty
-{				//krazy:exclude=dpointer (via macro)
-Q_OBJECT Q_DECLARE_PRIVATE_MI (KPtyDevice, KPty) public:
-
-    /**
-     * Constructor
-     */
-  KPtyDevice (QObject * parent = 0);
-
-    /**
-     * Destructor:
-     *
-     *  If the pty is still open, it will be closed. Note, however, that
-     *  an utmp registration is @em not undone.
-     */
-  virtual ~ KPtyDevice ();
-
-    /**
-     * Create a pty master/slave pair.
-     *
-     * @return true if a pty pair was successfully opened
-     */
-  virtual bool open (OpenMode mode = ReadWrite | Unbuffered);
-
-    /**
-     * Open using an existing pty master. The ownership of the fd
-     * remains with the caller, i.e., close() will not close the fd.
-     *
-     * This is useful if you wish to attach a secondary "controller" to an
-     * existing pty device such as a terminal widget.
-     * Note that you will need to use setSuspended() on both devices to
-     * control which one gets the incoming data from the pty.
-     *
-     * @param fd an open pty master file descriptor.
-     * @param mode the device mode to open the pty with.
-     * @return true if a pty pair was successfully opened
-     */
-  bool open (int fd, OpenMode mode = ReadWrite | Unbuffered);
-
-    /**
-     * Close the pty master/slave pair.
-     */
-  virtual void close ();
-
-    /**
-     * Sets whether the KPtyDevice monitors the pty for incoming data.
-     *
-     * When the KPtyDevice is suspended, it will no longer attempt to buffer
-     * data that becomes available from the pty and it will not emit any
-     * signals.
-     *
-     * Do not use on closed ptys.
-     * After a call to open(), the pty is not suspended. If you need to
-     * ensure that no data is read, call this function before the main loop
-     * is entered again (i.e., immediately after opening the pty).
-     */
-  void setSuspended (bool suspended);
-
-    /**
-     * Returns true if the KPtyDevice is not monitoring the pty for incoming
-     * data.
-     *
-     * Do not use on closed ptys.
-     *
-     * See setSuspended()
-     */
-  bool isSuspended () const;
-
-    /**
-     * @return always true
-     */
-  virtual bool isSequential () const;
-
-    /**
-     * @reimp
-     */
-  bool canReadLine () const;
-
-    /**
-     * @reimp
-     */
-  bool atEnd () const;
-
-    /**
-     * @reimp
-     */
-  qint64 bytesAvailable () const;
-
-    /**
-     * @reimp
-     */
-  qint64 bytesToWrite () const;
-
-  bool waitForBytesWritten (int msecs = -1);
-  bool waitForReadyRead (int msecs = -1);
-
-
-    Q_SIGNALS:
-    /**
-     * Emitted when EOF is read from the PTY.
-     *
-     * Data may still remain in the buffers.
-     */
-  void readEof ();
-
-protected:
-    virtual qint64 readData (char *data, qint64 maxSize);
-  virtual qint64 readLineData (char *data, qint64 maxSize);
-  virtual qint64 writeData (const char *data, qint64 maxSize);
-
-private:
-  Q_PRIVATE_SLOT (d_func (), bool _k_canRead ())
-    Q_PRIVATE_SLOT (d_func (), bool _k_canWrite ())};
-
-#define KMAXINT ((int)(~0U >> 1))
-
-/////////////////////////////////////////////////////
-// Helper. Remove when QRingBuffer becomes public. //
-/////////////////////////////////////////////////////
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qlinkedlist.h>
-
-#define CHUNKSIZE 4096
-
-class KRingBuffer
-{
-public:
-  KRingBuffer ()
-  {
-    clear ();
-  }
-
-  void clear ()
-  {
-    buffers.clear ();
-    QByteArray tmp;
-    tmp.resize (CHUNKSIZE);
-    buffers << tmp;
-    head = tail = 0;
-    totalSize = 0;
-  }
-
-  inline bool isEmpty () const
-  {
-    return buffers.count () == 1 && !tail;
-  }
-
-  inline int size () const
-  {
-    return totalSize;
-  }
-
-  inline int readSize () const
-  {
-    return (buffers.count () == 1 ? tail : buffers.first ().size ()) - head;
-  }
-
-  inline const char *readPointer () const
-  {
-    Q_ASSERT (totalSize > 0);
-    return buffers.first ().constData () + head;
-  }
-
-  void free (int bytes)
-  {
-    totalSize -= bytes;
-    Q_ASSERT (totalSize >= 0);
-
-    forever
-    {
-      int nbs = readSize ();
-
-      if (bytes < nbs)
-        {
-          head += bytes;
-          if (head == tail && buffers.count () == 1)
-            {
-              buffers.first ().resize (CHUNKSIZE);
-              head = tail = 0;
-            }
-          break;
-        }
-
-      bytes -= nbs;
-      if (buffers.count () == 1)
-        {
-          buffers.first ().resize (CHUNKSIZE);
-          head = tail = 0;
-          break;
-        }
-
-      buffers.removeFirst ();
-      head = 0;
-    }
-  }
-
-  char *reserve (int bytes)
-  {
-    totalSize += bytes;
-
-    char *ptr;
-    if (tail + bytes <= buffers.last ().size ())
-      {
-        ptr = buffers.last ().data () + tail;
-        tail += bytes;
-      }
-    else
-      {
-        buffers.last ().resize (tail);
-        QByteArray tmp;
-        tmp.resize (qMax (CHUNKSIZE, bytes));
-        ptr = tmp.data ();
-        buffers << tmp;
-        tail = bytes;
-      }
-    return ptr;
-  }
-
-  // release a trailing part of the last reservation
-  inline void unreserve (int bytes)
-  {
-    totalSize -= bytes;
-    tail -= bytes;
-  }
-
-  inline void write (const char *data, int len)
-  {
-    memcpy (reserve (len), data, len);
-  }
-
-  // Find the first occurrence of c and return the index after it.
-  // If c is not found until maxLength, maxLength is returned, provided
-  // it is smaller than the buffer size. Otherwise -1 is returned.
-  int indexAfter (char c, int maxLength = KMAXINT) const
-  {
-    int index = 0;
-    int start = head;
-      QLinkedList < QByteArray >::ConstIterator it = buffers.begin ();
-      forever
-    {
-      if (!maxLength)
-        return index;
-      if (index == size ())
-        return -1;
-      const QByteArray & buf = *it;
-      ++it;
-      int len = qMin ((it == buffers.end ()? tail : buf.size ()) - start,
-                      maxLength);
-      const char *ptr = buf.data () + start;
-      if (const char *rptr = (const char *)memchr (ptr, c, len))
-        return index + (rptr - ptr) + 1;
-        index += len;
-        maxLength -= len;
-        start = 0;
-    }
-  }
-
-  inline int lineSize (int maxLength = KMAXINT) const
-  {
-    return indexAfter ('\n', maxLength);
-  }
-
-  inline bool canReadLine () const
-  {
-    return lineSize () != -1;
-  }
-
-  int read (char *data, int maxLength)
-  {
-    int bytesToRead = qMin (size (), maxLength);
-    int readSoFar = 0;
-    while (readSoFar < bytesToRead)
-      {
-        const char *ptr = readPointer ();
-        int bs = qMin (bytesToRead - readSoFar, readSize ());
-        memcpy (data + readSoFar, ptr, bs);
-        readSoFar += bs;
-        free (bs);
-      }
-    return readSoFar;
-  }
-
-  int readLine (char *data, int maxLength)
-  {
-    return read (data, lineSize (qMin (maxLength, size ())));
-  }
-
-private:
-  QLinkedList < QByteArray > buffers;
-  int head, tail;
-  int totalSize;
-};
-
-struct KPtyDevicePrivate:public KPtyPrivate
-{
-  Q_DECLARE_PUBLIC (KPtyDevice)
-    KPtyDevicePrivate (KPty * parent):KPtyPrivate (parent),
-    emittedReadyRead (false), emittedBytesWritten (false),
-    readNotifier (0), writeNotifier (0)
-  {
-  }
-
-  bool _k_canRead ();
-  bool _k_canWrite ();
-
-  bool doWait (int msecs, bool reading);
-  void finishOpen (QIODevice::OpenMode mode);
-
-  bool emittedReadyRead;
-  bool emittedBytesWritten;
-  QSocketNotifier *readNotifier;
-  QSocketNotifier *writeNotifier;
-  KRingBuffer readBuffer;
-  KRingBuffer writeBuffer;
-};
-
-#endif
--- a/gui/src/terminal/LinuxTerminalEmulation.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,253 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "LinuxTerminalEmulation.h"
-
-LinuxTerminalEmulation::LinuxTerminalEmulation ()
-  : TerminalEmulation ()
-{
-  int fdm, fds;
-  openpty (&fdm, &fds, 0, 0, 0);
-
-  dup2 (fds, STDIN_FILENO);
-  dup2 (fds, STDOUT_FILENO);
-  dup2 (fds, STDERR_FILENO);
-
-  m_pty = new KPtyDevice ();
-  m_pty->open (fdm);
-  connect (m_pty, SIGNAL(readyRead ()),
-           this, SLOT (handleReadyRead ()));
-}
-
-LinuxTerminalEmulation::~LinuxTerminalEmulation ()
-{
-  m_pty->close ();
-}
-
-void LinuxTerminalEmulation::processKeyEvent (QKeyEvent *keyEvent)
-{
-  switch (keyEvent->key ())
-    {
-      case Qt::Key_PageUp:
-      //if (verticalScrollBar ())
-      //  verticalScrollBar ()->setValue (verticalScrollBar ()->value () - 10);
-      return;
-      case Qt::Key_PageDown:
-      //if (verticalScrollBar ())
-      //  verticalScrollBar ()->setValue (verticalScrollBar ()->value () + 10);
-      return;
-
-      case Qt::Key_Up:
-      m_pty->write ("\033OA");
-      break;
-
-      case Qt::Key_Down:
-      m_pty->write ("\033OB");
-      break;
-
-      case Qt::Key_Right:
-      m_pty->write ("\033OC");
-      break;
-
-      case Qt::Key_Left:
-      m_pty->write ("\033OF");
-      break;
-
-      case Qt::Key_C:
-      if (keyEvent->modifiers() & Qt::ControlModifier)
-        {
-          // TODO: Lookup and implement Control + C.
-        }
-      else
-        {
-          m_pty->write (keyEvent->text ().toAscii ());
-        }
-      break;
-
-      case Qt::Key_V:
-      if (keyEvent->modifiers() & Qt::ControlModifier)
-        {
-          // TODO: Lookup and implement Control + V.
-        }
-      else
-        {
-          m_pty->write (keyEvent->text ().toAscii ());
-        }
-      break;
-
-      case Qt::Key_D:
-      if (keyEvent->modifiers() & Qt::ControlModifier)
-        {
-          // Do not send EOT, because this will crash
-          // the program.
-        }
-      else
-        {
-          m_pty->write (keyEvent->text ().toAscii ());
-        }
-      break;
-
-      default:
-      m_pty->write (keyEvent->text ().toAscii ());
-      break;
-    }
-  keyEvent->accept ();
-}
-
-void
-LinuxTerminalEmulation::transmitText (const QString &text)
-{
-  m_pty->write (text.toLocal8Bit ());
-}
-
-void
-LinuxTerminalEmulation::handleReadyRead ()
-{
-  QByteArray data = m_pty->readAll ();
-
-  data.replace("\033[K", "");
-  data.replace("\033[9", "");
-  data.replace("\033[A", "");
-  data.replace("\033[B", "");
-  data.replace("\033[C", "");
-  data.replace("\033[D", "");
-  data.replace("\033[1", "");
-  data.replace("\033[H", "");
-  data.replace("\033[2J", "");
-  int position;
-  QTextCursor tc = m_terminal->textCursor ();
-  tc.beginEditBlock ();
-
-  // Decode data into cursor actions.
-  foreach(QChar character, data)
-    {
-      unsigned short unicode = character.unicode ();
-      switch (unicode)
-        {
-        case 0: // Null (NUL)
-          qDebug ("NUL");
-          break;
-        case 1: // Start Of Heading (SOH)
-          qDebug ("SOH");
-          break;
-        case 2: // Start Of Text (STX)
-          qDebug ("STX");
-          break;
-        case 3: // End Of Text (ETX)
-          qDebug ("ETX");
-          break;
-        case 4: // End Of Transmission (EOT)
-          qDebug ("EOT");
-          break;
-        case 5: // Enquiry (ENQ)
-          qDebug ("ENQ");
-          break;
-        case 6: // Acknowledgement (ACK)
-          qDebug ("ACK");
-          break;
-        case 7: // Bell (BEL)
-          m_terminal->bell ();
-          break;
-        case 8: // Backspace (BS)
-          tc.deletePreviousChar ();
-          break;
-        case 9: // Horizontal Tab (HT)
-          qDebug ("HT");
-          break;
-        case 10: // Line Feed (LF)
-          position = tc.position ();
-          tc.movePosition (QTextCursor::EndOfLine);
-          tc.insertText ("\n");
-          tc.setPosition (position);
-          tc.movePosition (QTextCursor::Down);
-          break;
-        case 11: // Vertical Tab (VT)
-          qDebug ("VT");
-          break;
-        case 12: // Form Feed (FF)
-          qDebug ("FF");
-          break;
-        case 13: // Carriage Return (CR)
-          tc.movePosition (QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
-          break;
-        case 14: // Shift Out (SO)
-          qDebug ("SO");
-          break;
-        case 15: // Shift In (SI)
-          qDebug ("SI");
-          break;
-        case 16: // Data Link Escape (DLE)
-          qDebug ("DLE");
-          break;
-        case 17: // Device Control 1 (DC1, XON)
-          qDebug ("DC1");
-          break;
-        case 18: // Device Control 2 (DC2)
-          qDebug ("DC2");
-          break;
-        case 19: // Device Control 3 (DC3, XOFF)
-          qDebug ("DC3");
-          break;
-        case 20: // Device Control 4 (DC4)
-          qDebug ("DC4");
-          break;
-        case 21: // Negative Acknowledgement (NAK)
-          qDebug ("NAK");
-          break;
-        case 22: // Synchronous Idle (SYN)
-          qDebug ("SYN");
-          break;
-        case 23: // End Of Transmission Block (ETB)
-          qDebug ("ETB");
-          break;
-        case 24: // Cancel (CAN)
-          qDebug ("CAN");
-          break;
-        case 25: // End of Medium (EM)
-          qDebug ("EM");
-          break;
-        case 26: // Substitute (SUB)
-          qDebug ("SUB");
-          break;
-        case 27: // Escape (ESC)
-          qDebug ("ESC");
-          break;
-        case 28: // File Separator (FS)
-          qDebug ("FS");
-          break;
-        case 29: // Group Separator (GS)
-          qDebug ("GS");
-          break;
-        case 30: // Record Separator (RS)
-          qDebug ("RS");
-          break;
-        case 31: // Unit Separator (US)
-          qDebug ("US");
-          break;
-        case 127: // Delete (DEL)
-          qDebug ("DEL");
-          break;
-        default:
-          tc.insertText (character);
-          break;
-        }
-    }
-
-  tc.endEditBlock ();
-  m_terminal->setTextCursor (tc);
-}
--- a/gui/src/terminal/LinuxTerminalEmulation.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef LINUXTERMINALEMULATION_H
-#define LINUXTERMINALEMULATION_H
-
-#include "TerminalEmulation.h"
-#include "KPtyDevice.h"
-
-/**
-  * @class LinuxTerminalEmulation
-  * Implements the terminal emulation on Linux and Unix as well as Unix-like
-  * systems, like MacOSX.
-  */
-class LinuxTerminalEmulation : public TerminalEmulation
-{
-  Q_OBJECT
-public:
-  LinuxTerminalEmulation ();
-  ~LinuxTerminalEmulation ();
-
-  /** @reimp */
-  void processKeyEvent (QKeyEvent *keyEvent);
-
-  /** @reimp */
-  void transmitText (const QString &text);
-
-private slots:
-  void handleReadyRead ();
-
-private:
-  /** KPtyDevice from the Konsole sources. */
-  KPtyDevice *m_pty;
-};
-
-#endif // LINUXTERMINALEMULATION_H
--- a/gui/src/terminal/TerminalEmulation.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "TerminalEmulation.h"
-
-#ifdef Q_OS_UNIX
-  #include "LinuxTerminalEmulation.h"
-#endif
-
-TerminalEmulation *TerminalEmulation::newTerminalEmulation (Terminal *terminal)
-{
-#ifdef Q_OS_UNIX
-  TerminalEmulation *terminalEmulation = new LinuxTerminalEmulation ();
-  terminalEmulation->m_terminal = terminal;
-  return terminalEmulation;
-#endif
-#ifdef Q_OS_WIN
-  // TODO: Implement on Windows.
-  return 0;
-#endif
-}
-
-TerminalEmulation::TerminalEmulation ()
-  : QObject ()
-{
-}
--- a/gui/src/terminal/TerminalEmulation.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TERMINALEMULATION_H
-#define TERMINALEMULATION_H
-
-#include <QObject>
-#include <QKeyEvent>
-#include <QMouseEvent>
-#include <QTextCursor>
-
-/**
-  * @class Terminal
-  * Interface for a terminal. This is the counterpart for the terminal
-  * emulation and must be implemented by the view part. It defines a basic set
-  * of actions that must be supported by the view part.
-  */
-class Terminal
-{
-  public:
-    /** Queries the current text cursor.
-      * @return The current text cursor. */
-    virtual QTextCursor textCursor () = 0;
-
-    /** Sets the given text cursor.
-      * @param cursor New text cursor to set. */
-    virtual void setTextCursor (const QTextCursor& cursor) = 0;
-
-    /** Called whenever the bell has been activated. */
-    virtual void bell () = 0;
-};
-
-/**
-  * @class TerminalEmulation
-  * Interface for any terminal emulation. It's the counterpart to the Terminal.
-  */
-class TerminalEmulation : public QObject
-{
-  Q_OBJECT
-public:
-  /** Produces a new terminal emulation for a specific terminal.
-    * @param terminal The terminal associated with the emulation
-    * @return Terminal emulation. */
-  static TerminalEmulation *newTerminalEmulation (Terminal *terminal);
-
-  TerminalEmulation ();
-  virtual ~TerminalEmulation () {}
-
-  /** Processes an incoming key event.
-    * @param keyEvent Key event to process. */
-  virtual void processKeyEvent (QKeyEvent *keyEvent) = 0;
-
-  /** Transmit a block of text straight to the terminal emulation.
-    * @param text Text to be transmitted. */
-  virtual void transmitText (const QString& text) = 0;
-protected:
-  /** The terminal this terminal emulation is connected to. */
-  Terminal *m_terminal;
-};
-
-#endif // TERMINALEMULATION_H
--- a/gui/src/terminal/win32/QConsole	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-#include "QConsole.h"
--- a/gui/src/terminal/win32/QConsole.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,873 +0,0 @@
-/*
-
-Copyright (C) 2011 Michael Goffioul.
-
-This file is part of QConsole.
-
-Foobar 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 3 of the License, or
-(at your option) any later version.
-
-QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include <QApplication>
-#include <QColor>
-#include <QFont>
-#include <QHBoxLayout>
-#include <QPaintEvent>
-#include <QPainter>
-#include <QResizeEvent>
-#include <QScrollBar>
-#include <QtDebug>
-#include <QThread>
-#include <QTimer>
-
-#include <fcntl.h>
-#include <io.h>
-#include <stdio.h>
-#include <stdarg.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <cstring>
-
-#include "QConsole.h"
-#include "QConsoleColors.h"
-
-// Uncomment to log activity to LOGFILENAME
-// #define DEBUG_QCONSOLE
-#define LOGFILENAME "QConsole.log"
-// Uncomment to create hidden console window
-#define HIDDEN_CONSOLE
-
-//////////////////////////////////////////////////////////////////////////////
-
-class QConsoleView : public QWidget
-{
-public:
-  QConsoleView (QConsole* parent = 0) : QWidget (parent), q (parent) { }
-  ~QConsoleView (void) { }
-
-protected:
-  void paintEvent (QPaintEvent* event) { q->viewPaintEvent (this, event); }
-  void resizeEvent (QResizeEvent* event) { q->viewResizeEvent (this, event); }
-
-private:
-  QConsole* q;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-class QConsoleThread : public QThread
-{
-public:
-  QConsoleThread (QConsole* console) : QThread (console), q (console) { }
-
-protected:
-  void run (void)
-    { q->start (); }
-
-private:
-  QConsole* q;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-class QConsolePrivate
-{
-  friend class QConsole;
-
-public:
-  QConsolePrivate (QConsole* parent, const QString& cmd = QString ());
-  ~QConsolePrivate (void);
-
-  void updateConsoleSize (bool sync = false);
-  void syncConsoleParameters (void);
-  void grabConsoleBuffer (CHAR_INFO* buf = 0);
-  void updateScrollBar (void);
-  void setScrollValue (int value);
-  void updateConsoleView (bool grab = true);
-  void monitorConsole (void);
-  void startCommand (void);
-  void sendConsoleText (const QString& s);
-
-  void log (const char* fmt, ...);
-
-  void closeStandardIO (int fd, DWORD stdHandleId, const char* name);
-  void setupStandardIO (DWORD stdHandleId, int fd, const char* name,
-                        const char* devName);
-
-private:
-  QConsole* q;
-
-private:
-  QFont m_font;
-  QColor m_backgroundColor;
-  QString m_command;
-  QConsoleColors m_colors;
-  bool m_inWheelEvent;
-  QString m_title;
-
-  QSize m_charSize;
-  QSize m_bufferSize;
-  QRect m_consoleRect;
-  QPoint m_cursorPos;
-
-  HANDLE m_stdOut;
-  HWND m_consoleWindow;
-  CHAR_INFO* m_buffer;
-  CHAR_INFO* m_tmpBuffer;
-  HANDLE m_process;
-
-  QConsoleView* m_consoleView;
-  QScrollBar* m_scrollBar;
-  QTimer* m_consoleWatcher;
-  QConsoleThread *m_consoleThread;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-QConsolePrivate::QConsolePrivate (QConsole* parent, const QString& cmd)
-    : q (parent), m_command (cmd), m_process (NULL), m_inWheelEvent (false)
-{
-  log (NULL);
-
-  // Possibly detach from any existing console
-  log ("Detaching from existing console (if any)...\n");
-  FreeConsole ();
-  log ("Closing standard IO...\n");
-  closeStandardIO (0, STD_INPUT_HANDLE, "STDIN");
-  closeStandardIO (1, STD_OUTPUT_HANDLE, "STDOUT");
-  closeStandardIO (2, STD_ERROR_HANDLE, "STDERR");
-
-#ifdef HIDDEN_CONSOLE
-  HWINSTA hOrigSta, hNewSta;
-
-  // Create new (hidden) console
-  hOrigSta = GetProcessWindowStation ();
-  hNewSta = CreateWindowStation (NULL, 0, GENERIC_ALL, NULL);
-  log ("Current Windows station: %p.\nNew Windows station: %p.\n", hOrigSta,
-       hNewSta);
-  if (! SetProcessWindowStation (hNewSta))
-    log ("Failed to switch to new Windows station.\n");
-#endif
-  if (! AllocConsole ())
-    log ("Failed to create new console.\n");
-#ifdef HIDDEN_CONSOLE
-  if (! SetProcessWindowStation (hOrigSta))
-    log ("Failed to restore original Windows station.\n");
-  if (! CloseWindowStation (hNewSta))
-    log ("Failed to close new Windows station.\n");
-#endif
-
-  log ("New (hidden) console created.\n");
-
-  setupStandardIO (STD_INPUT_HANDLE,  0, "STDIN",  "CONIN$");
-  setupStandardIO (STD_OUTPUT_HANDLE, 1, "STDOUT", "CONOUT$");
-  setupStandardIO (STD_ERROR_HANDLE,  2, "STDERR", "CONOUT$");
-
-  log ("Standard input/output/error set up.\n");
-
-  *stdin = *(fdopen (0, "rb"));
-  *stdout = *(fdopen (1, "wb"));
-  *stderr = *(fdopen (2, "wb"));
-
-  log ("POSIX standard streams created.\n");
-
-  setvbuf (stdin, NULL, _IONBF, 0);
-  setvbuf (stdout, NULL, _IONBF, 0);
-  setvbuf (stderr, NULL, _IONBF, 0);
-
-  log ("POSIX standard stream buffers adjusted.\n");
-
-  HANDLE hStdOut = GetStdHandle (STD_OUTPUT_HANDLE);
-
-  log ("Console allocated: hStdOut: %p\n", hStdOut);
-
-  m_stdOut = hStdOut;
-  m_consoleWindow = GetConsoleWindow ();
-
-  // In case the console window hasn't been created hidden...
-  ShowWindow (m_consoleWindow, SW_HIDE);
-
-  CONSOLE_SCREEN_BUFFER_INFO sbi;
-
-  GetConsoleScreenBufferInfo (hStdOut, &sbi);
-  m_bufferSize = QSize (sbi.dwSize.X, qMax (sbi.dwSize.Y, (SHORT)500));
-  m_consoleRect = QRect (sbi.srWindow.Left, sbi.srWindow.Top,
-                         sbi.srWindow.Right - sbi.srWindow.Left + 1,
-                         sbi.srWindow.Bottom - sbi.srWindow.Top + 1);
-  m_cursorPos = QPoint (sbi.dwCursorPosition.X, sbi.dwCursorPosition.Y);
-
-  log ("Initial console parameters:\n");
-  log ("  buffer size: %d x %d\n", m_bufferSize.width (),
-       m_bufferSize.height ());
-  log ("  window: (%d, %d) -> (%d, %d) [%d x %d]\n",
-       m_consoleRect.left (), m_consoleRect.top (),
-       m_consoleRect.right (), m_consoleRect.bottom (),
-       m_consoleRect.width (), m_consoleRect.height ());
-
-  wchar_t titleBuf[260];
-  GetConsoleTitleW (titleBuf, sizeof (titleBuf));
-  q->setWindowTitle (QString::fromWCharArray (titleBuf));
-
-  m_font.setFamily ("Lucida Console");
-  m_font.setPointSize (9);
-  m_font.setStyleHint (QFont::TypeWriter);
-  m_backgroundColor = Qt::black;
-
-  m_buffer = m_tmpBuffer = 0;
-
-  m_consoleView = new QConsoleView (parent);
-  m_scrollBar = new QScrollBar (Qt::Vertical, parent);
-
-  QHBoxLayout* l = new QHBoxLayout (parent);
-  l->setContentsMargins (0, 0, 0, 0);
-  l->setSpacing (0);
-  l->addWidget (m_consoleView, 1);
-  l->addWidget (m_scrollBar, 0);
-
-  m_consoleView->setPalette (QPalette (m_backgroundColor));
-  m_consoleView->setAutoFillBackground (true);
-  m_consoleView->setFont (m_font);
-  parent->setFocusPolicy (Qt::StrongFocus);
-  parent->winId ();
-
-  updateScrollBar ();
-
-  m_consoleWatcher = new QTimer (parent);
-  m_consoleWatcher->setInterval (10);
-  m_consoleWatcher->setSingleShot (false);
-  
-  QObject::connect (m_scrollBar, SIGNAL (valueChanged (int)),
-                    q, SLOT (scrollValueChanged (int)));
-  QObject::connect (m_consoleWatcher, SIGNAL (timeout (void)),
-                    q, SLOT (monitorConsole (void)));
-
-  m_consoleWatcher->start ();
-
-  if (m_command.isEmpty ())
-    m_consoleThread = 0;
-  else
-    {
-      m_consoleThread = new QConsoleThread (q);
-      QObject::connect (m_consoleThread, SIGNAL (finished (void)),
-                        q, SIGNAL (terminated (void)));
-      m_consoleThread->start ();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-QConsolePrivate::~QConsolePrivate (void)
-{
-  if (m_consoleThread && m_consoleThread->isRunning () && m_process)
-    {
-      TerminateProcess (m_process, (UINT)-1);
-      m_consoleThread->wait ();
-    }
-  if (m_buffer)
-    delete [] m_buffer;
-  if (m_tmpBuffer)
-    delete [] m_tmpBuffer;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::setupStandardIO (DWORD stdHandleId, int targetFd,
-                                       const char* name, const char* devName)
-{
-  log ("Opening %s...\n", devName);
-
-  int fd = open (devName, _O_RDWR | _O_BINARY);
-
-  if (fd != -1)
-    {
-      if (fd != targetFd)
-        {
-          log ("Opened %s is not at target file descriptor %d, "
-               "duplicating...\n", name, targetFd);
-          if (dup2 (fd, targetFd) == -1)
-            log ("Failed to duplicate file descriptor: errno=%d.\n", errno);
-          if (close (fd) == -1)
-            log ("Failed to close original file descriptor: errno=%d.\n",
-                 errno);
-        }
-      else
-        log ("%s opened and assigned to file descriptor %d.\n", devName, fd);
-      if (! SetStdHandle (stdHandleId, (HANDLE) _get_osfhandle (targetFd)))
-        log ("Failed to re-assign %s: error=%08x.\n", name, GetLastError ());
-    }
-  else
-    log ("Failed to open %s: errno=%d.\n", devName, errno);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::closeStandardIO (int fd, DWORD stdHandleId,
-                                       const char* name)
-{
-  if (close (fd) == -1)
-    log ("Failed to close file descriptor %d: errno=%d.\n", fd, errno);
-  if (! CloseHandle (GetStdHandle (stdHandleId)))
-    log ("Failed to close Win32 %s: error=%08x.\n", name, GetLastError ());
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::log (const char* fmt, ...)
-{
-#ifdef DEBUG_QCONSOLE
-  if (fmt)
-    {
-      va_list l;
-      FILE* flog = fopen (LOGFILENAME, "ab");
-
-      va_start (l, fmt);
-      vfprintf (flog, fmt, l);
-      va_end (l);
-      fclose (flog);
-    }
-  else
-    {
-      // Special case to re-initialize the log file
-      FILE* flog = fopen (LOGFILENAME, "w");
-      fclose (flog);
-    }
-#endif
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::updateConsoleSize (bool sync)
-{
-  QFontMetrics fm (m_font);
-  QSize winSize = m_consoleView->size ();
-
-  m_charSize.rwidth () = fm.maxWidth ();
-  m_charSize.rheight () = fm.lineSpacing ();
-
-  m_consoleRect.setWidth (winSize.width () / fm.maxWidth ());
-  m_consoleRect.setHeight (winSize.height () / fm.lineSpacing ());
-
-  m_bufferSize.rwidth () = m_consoleRect.width ();
-  m_bufferSize.rheight () = qMax (m_bufferSize.height (),
-                                  m_consoleRect.height ());
-
-  m_consoleRect.moveLeft (0);
-  if (m_consoleRect.bottom () >= m_bufferSize.height ())
-    m_consoleRect.moveTop (m_bufferSize.height () - m_consoleRect.height ());
-
-  log ("Console resized:\n");
-  log ("  widget size: %d x %d\n", winSize.width (), winSize.height ());
-  log ("  buffer size: %d x %d\n", m_bufferSize.width (),
-       m_bufferSize.height ());
-  log ("  window: (%d, %d) -> (%d, %d) [%d x %d]\n",
-       m_consoleRect.left (), m_consoleRect.top (),
-       m_consoleRect.right (), m_consoleRect.bottom (),
-       m_consoleRect.width (), m_consoleRect.height ());
-
-  if (sync)
-    syncConsoleParameters ();
-
-  updateScrollBar ();
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::syncConsoleParameters (void)
-{
-  CONSOLE_SCREEN_BUFFER_INFO sbi;
-  HANDLE hStdOut = m_stdOut;
-
-  GetConsoleScreenBufferInfo (hStdOut, &sbi);
-
-  COORD bs;
-  SMALL_RECT sr;
-
-  bs.X = sbi.dwSize.X;
-  bs.Y = m_bufferSize.height ();
-  sr.Left   = sbi.srWindow.Left;
-  sr.Right  = sbi.srWindow.Right;
-  sr.Top    = m_consoleRect.top ();
-  sr.Bottom = m_consoleRect.bottom ();
-
-  if (bs.Y > sbi.dwSize.Y)
-    {
-      SetConsoleScreenBufferSize (hStdOut, bs);
-      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
-    }
-  else
-    {
-      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
-      SetConsoleScreenBufferSize (hStdOut, bs);
-    }
-
-  bs.X = m_bufferSize.width ();
-  sr.Left  = m_consoleRect.left ();
-  sr.Right = m_consoleRect.right ();
-
-  if (bs.X > sbi.dwSize.X)
-    {
-      SetConsoleScreenBufferSize (hStdOut, bs);
-      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
-    }
-  else
-    {
-      SetConsoleWindowInfo (hStdOut, TRUE, &sr);
-      SetConsoleScreenBufferSize (hStdOut, bs);
-    }
-
-  log ("Sync'ing console parameters:\n");
-  log ("  buffer size: %d x %d\n", bs.X, bs.Y);
-  log ("  window: (%d, %d) -> (%d, %d)\n",
-       sr.Left, sr.Top, sr.Right, sr.Bottom);
-
-  if (m_buffer)
-    delete [] m_buffer;
-  if (m_tmpBuffer)
-    delete [] m_tmpBuffer;
-
-  int bufSize = m_consoleRect.width () * m_consoleRect.height ();
-
-  m_buffer = new CHAR_INFO[bufSize];
-  m_tmpBuffer = new CHAR_INFO[bufSize];
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::grabConsoleBuffer (CHAR_INFO* buf)
-{
-  COORD bs, bc;
-  SMALL_RECT r;
-
-  bs.X = m_consoleRect.width ();
-  bs.Y = m_consoleRect.height ();
-  bc.X = 0;
-  bc.Y = 0;
-
-  r.Left   = m_consoleRect.left ();
-  r.Top    = m_consoleRect.top ();
-  r.Right  = m_consoleRect.right ();
-  r.Bottom = m_consoleRect.bottom ();
-
-  if (! ReadConsoleOutput (m_stdOut, (buf ? buf : m_buffer), bs, bc, &r))
-    qCritical ("cannot read console output");
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::updateScrollBar (void)
-{
-  m_scrollBar->setMinimum (0);
-  if (m_bufferSize.height () > m_consoleRect.height ())
-    m_scrollBar->setMaximum (m_bufferSize.height () - m_consoleRect.height ());
-  else
-    m_scrollBar->setMaximum (0);
-  m_scrollBar->setSingleStep (1);
-  m_scrollBar->setPageStep (m_consoleRect.height ());
-  m_scrollBar->setValue (m_consoleRect.top ());
-
-  log ("Scrollbar parameters updated: %d/%d/%d/%d\n",
-       m_scrollBar->minimum (), m_scrollBar->maximum (),
-       m_scrollBar->singleStep (), m_scrollBar->pageStep ());
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::setScrollValue (int value)
-{
-  if (value == m_consoleRect.top ())
-    return;
-
-  SMALL_RECT r;
-  HANDLE hStdOut = m_stdOut;
-
-  if (value + m_consoleRect.height () > m_bufferSize.height ())
-    value = m_bufferSize.height () - m_consoleRect.height ();
-
-  r.Left = m_consoleRect.left ();
-  r.Top = value;
-  r.Right = m_consoleRect.right ();
-  r.Bottom = value + m_consoleRect.height () - 1;
-
-  log ("Scrolling window: (%d, %d) -> (%d, %d) [%d x %d]\n",
-       r.Left, r.Top, r.Right, r.Bottom, 
-       r.Right - r.Left + 1, r.Bottom - r.Top + 1);
-
-  if (SetConsoleWindowInfo (hStdOut, TRUE, &r))
-    {
-      m_consoleRect.moveTop (value);
-      updateConsoleView ();
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::updateConsoleView (bool grab)
-{
-  if (grab)
-    grabConsoleBuffer ();
-  m_consoleView->update ();
-  m_consoleWatcher->start ();
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::monitorConsole (void)
-{
-  CONSOLE_SCREEN_BUFFER_INFO sbi;
-  HANDLE hStdOut = GetStdHandle (STD_OUTPUT_HANDLE);
-
-  static wchar_t titleBuf[260];
-
-  GetConsoleTitleW (titleBuf, sizeof (titleBuf));
-  QString title = QString::fromWCharArray (titleBuf);
-
-  if (title != m_title)
-    {
-      q->setWindowTitle (title);
-      emit q->titleChanged (title);
-    }
-
-  if (GetConsoleScreenBufferInfo (hStdOut, &sbi))
-    {
-      if (m_bufferSize.width () != sbi.dwSize.X
-          || m_bufferSize.height () != sbi.dwSize.Y)
-        {
-          // Buffer size changed
-          m_bufferSize.rwidth () = sbi.dwSize.X;
-          m_bufferSize.rheight () = sbi.dwSize.Y;
-          updateScrollBar ();
-        }
-
-      if (m_cursorPos.x () != sbi.dwCursorPosition.X
-          || m_cursorPos.y () != sbi.dwCursorPosition.Y)
-        {
-          // Cursor position changed
-          m_consoleView->update
-            ((m_cursorPos.x () - sbi.srWindow.Left) * m_charSize.width (),
-             (m_cursorPos.y () - sbi.srWindow.Top) * m_charSize.height (),
-             m_charSize.width (), m_charSize.height ());
-          m_cursorPos.rx () = sbi.dwCursorPosition.X;
-          m_cursorPos.ry () = sbi.dwCursorPosition.Y;
-          m_consoleView->update
-            ((m_cursorPos.x () - sbi.srWindow.Left) * m_charSize.width (),
-             (m_cursorPos.y () - sbi.srWindow.Top) * m_charSize.height (),
-             m_charSize.width (), m_charSize.height ());
-        }
-
-      if (m_consoleRect.left () != sbi.srWindow.Left
-          || m_consoleRect.right () != sbi.srWindow.Right
-          || m_consoleRect.top () != sbi.srWindow.Top
-          || m_consoleRect.bottom () != sbi.srWindow.Bottom)
-        {
-          // Console window changed
-          m_consoleRect = QRect (sbi.srWindow.Left, sbi.srWindow.Top,
-                                 sbi.srWindow.Right - sbi.srWindow.Left + 1,
-                                 sbi.srWindow.Bottom - sbi.srWindow.Top + 1);
-          updateScrollBar ();
-          updateConsoleView ();
-          return;
-        }
-
-      if (m_tmpBuffer && m_buffer)
-        {
-          grabConsoleBuffer (m_tmpBuffer);
-          if (memcmp (m_tmpBuffer, m_buffer,
-                      sizeof (CHAR_INFO) * m_consoleRect.width () *
-                      m_consoleRect.height ()))
-            {
-              // FIXME: compute the area to update based on the
-              // difference between the 2 buffers.
-              qSwap (m_buffer, m_tmpBuffer);
-              updateConsoleView (false);
-            }
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::startCommand (void)
-{
-  if (! m_command.isEmpty ())
-    {
-      STARTUPINFO si;
-      PROCESS_INFORMATION pi;
-
-      ZeroMemory (&si, sizeof (si));
-      si.cb = sizeof (si);
-      ZeroMemory (&pi, sizeof (pi));
-
-      if (CreateProcessW (NULL,
-                          (LPWSTR)m_command.unicode (),
-                          NULL,
-                          NULL,
-                          TRUE,
-                          0,
-                          NULL,
-                          NULL,
-                          &si,
-                          &pi))
-        {
-          CloseHandle (pi.hThread);
-          m_process = pi.hProcess;
-          WaitForSingleObject (m_process, INFINITE);
-          CloseHandle (m_process);
-          m_process = NULL;
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsolePrivate::sendConsoleText (const QString& s)
-{
-  // Send the string in chunks of 512 characters. Each character is
-  // translated into an equivalent keypress event.
-
-#define TEXT_CHUNK_SIZE 512
-
-  int len = s.length ();
-  INPUT_RECORD events[TEXT_CHUNK_SIZE];
-  DWORD nEvents = 0, written;
-  HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE);
-
-  ZeroMemory (events, sizeof (events));
-
-  for (int i = 0; i < len; i++)
-    {
-      QChar c = s.at (i);
-
-      if (c == L'\r' || c == L'\n')
-        {
-          if (c == L'\r' && i < (len - 1) && s.at (i+1) == L'\n')
-            i++;
-          if (nEvents)
-            {
-              WriteConsoleInput (hStdIn, events, nEvents, &written);
-              nEvents = 0;
-              ZeroMemory (events, sizeof (events));
-            }
-          PostMessage (m_consoleWindow, WM_KEYDOWN, VK_RETURN, 0x001C0001);
-          PostMessage (m_consoleWindow, WM_KEYDOWN, VK_RETURN, 0xC01C0001);
-        }
-      else
-        {
-          events[nEvents].EventType                        = KEY_EVENT;
-          events[nEvents].Event.KeyEvent.bKeyDown          = TRUE;
-          events[nEvents].Event.KeyEvent.wRepeatCount      = 1;
-          events[nEvents].Event.KeyEvent.wVirtualKeyCode   =
-            LOBYTE (VkKeyScan (c.unicode ()));
-          events[nEvents].Event.KeyEvent.wVirtualScanCode  = 0;
-          events[nEvents].Event.KeyEvent.uChar.UnicodeChar = c.unicode ();
-          events[nEvents].Event.KeyEvent.dwControlKeyState = 0;
-          nEvents++;
-        }
-
-      if (nEvents == TEXT_CHUNK_SIZE
-          || (nEvents > 0 && i == (len - 1)))
-        {
-          WriteConsoleInput (hStdIn, events, nEvents, &written);
-          nEvents = 0;
-          ZeroMemory (events, sizeof (events));
-        }
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-QConsole::QConsole (QWidget* parent)
-    : d (new QConsolePrivate (this))
-{
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-QConsole::QConsole (const QString& cmd, QWidget* parent)
-    : d (new QConsolePrivate (this, cmd))
-{
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-QConsole::~QConsole (void)
-{
-  delete d;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::viewResizeEvent (QConsoleView*, QResizeEvent*)
-{
-  d->updateConsoleSize (true);
-  d->grabConsoleBuffer ();
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::viewPaintEvent (QConsoleView* w, QPaintEvent* event)
-{
-  QPainter p (w);
-  int cw = d->m_charSize.width (), ch = d->m_charSize.height ();
-  int ascent, stride, cx1, cy1, cx2, cy2, x, y;
-  WORD attr = 0;
-  QString s;
-  bool hasChar = false;
-
-  QRect updateRect = event->rect ();
-
-  cx1 = updateRect.left () / cw;
-  cy1 = updateRect.top () / ch;
-  cx2 = qMin (d->m_consoleRect.width () - 1, updateRect.right () / cw);
-  cy2 = qMin (d->m_consoleRect.height () - 1, updateRect.bottom () / ch);
-
-  if (cx1 > d->m_consoleRect.width () - 1
-      || cy1 > d->m_consoleRect.height () - 1)
-    return;
-
-  p.setFont (d->m_font);
-  p.setPen (Qt::black);
-
-  ascent = p.fontMetrics ().ascent ();
-  stride = d->m_consoleRect.width ();
-
-  s.reserve (cx2 - cx1 + 1);
-  y = ascent + cy1 * ch;;
-
-  for (int j = cy1; j <= cy2; j++, y += ch)
-    {
-      // Reset string buffer and starting X coordinate
-      s.clear ();
-      hasChar = false;
-      x = cx1 * cw;
-
-      for (int i = cx1; i <= cx2; i++)
-        {
-          CHAR_INFO* ci = &(d->m_buffer[stride*j+i]);
-
-          if ((ci->Attributes & 0x00ff) != attr)
-            {
-              // Character attributes changed
-              if (! s.isEmpty ())
-                {
-                  // String buffer not empty -> draw it
-                  if (hasChar || (attr & 0x00f0))
-                    {
-                      if (attr & 0x00f0)
-                        p.fillRect (x, y-ascent, s.length () * cw, ch,
-                                    p.brush ());
-                      p.drawText (x, y, s);
-                    }
-                  x += (s.length () * cw);
-                  s.clear ();
-                  hasChar = false;
-                }
-              // Update current pen and store current attributes
-              // FIXME: what about background?
-              attr = (ci->Attributes & 0x00ff);
-              p.setPen (d->m_colors[attr & 0x000f]);
-              p.setBrush (d->m_colors[(attr >> 4) & 0x000f]);
-            }
-
-          // Append current character to the string buffer
-          s.append (ci->Char.UnicodeChar);
-          if (ci->Char.UnicodeChar != L' ')
-            hasChar = true;
-        }
-
-      if (! s.isEmpty () && (hasChar || (attr & 0x00f0)))
-        {
-          // Line end reached, but string buffer not empty -> draw it
-          // No need to update s or x, they will be reset on the next
-          // for-loop iteration
-          if (attr & 0x00f0)
-            p.fillRect (x, y-ascent, s.length () * cw, ch, p.brush ());
-          p.drawText (x, y, s);
-        }
-    }
-
-  // Draw cursor
-  p.setCompositionMode (QPainter::RasterOp_SourceXorDestination);
-  p.fillRect ((d->m_cursorPos.x () - d->m_consoleRect.x ()) * cw,
-              (d->m_cursorPos.y () - d->m_consoleRect.y ()) * ch,
-              cw, ch, d->m_colors[7]);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::wheelEvent (QWheelEvent* event)
-{
-  if (! d->m_inWheelEvent)
-    {
-      // Forward to the scrollbar (avoid recursion)
-      d->m_inWheelEvent = true;
-      QApplication::sendEvent (d->m_scrollBar, event);
-      d->m_inWheelEvent = false;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-bool QConsole::winEvent (MSG* msg, long* result)
-{
-  switch (msg->message)
-    {
-    case WM_KEYDOWN:
-    case WM_KEYUP:
-    //case WM_CHAR:
-      // Forward Win32 message to the console window
-      PostMessage (d->m_consoleWindow,
-                   msg->message,
-                   msg->wParam,
-                   msg->lParam);
-      result = 0;
-      return true;
-    default:
-      return false;
-    }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::scrollValueChanged (int value)
-{
-  d->setScrollValue (value);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::monitorConsole (void)
-{
-  d->monitorConsole ();
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::focusInEvent (QFocusEvent* event)
-{
-  QWidget::focusInEvent (event);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::start (void)
-{
-  d->startCommand ();
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void QConsole::sendText (const QString& s)
-{
-  d->sendConsoleText (s);
-}
--- a/gui/src/terminal/win32/QConsole.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-
-Copyright (C) 2011 Michael Goffioul.
-
-This file is part of QConsole.
-
-Foobar 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 3 of the License, or
-(at your option) any later version.
-
-QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef __QConsole_h__
-#define __QConsole_h__ 1
-
-#include <QWidget>
-
-class QFocusEvent;
-class QKeyEvent;
-class QPaintEvent;
-class QResizeEvent;
-class QWheelEvent;
-
-class QConsolePrivate;
-class QConsoleThread;
-class QConsoleView;
-
-//////////////////////////////////////////////////////////////////////////////
-
-class QConsole : public QWidget
-{
-  Q_OBJECT
-  friend class QConsolePrivate;
-  friend class QConsoleThread;
-  friend class QConsoleView;
-
-public:
-  QConsole (QWidget* parent = 0);
-  QConsole (const QString& cmd, QWidget* parent = 0);
-  ~QConsole (void);
-
-  void sendText (const QString& s);
-
-signals:
-  void terminated (void);
-  void titleChanged (const QString&);
-
-protected:
-  void viewPaintEvent (QConsoleView*, QPaintEvent*);
-  void viewResizeEvent (QConsoleView*, QResizeEvent*);
-  void wheelEvent (QWheelEvent*);
-  void focusInEvent (QFocusEvent*);
-  bool winEvent (MSG*, long*);
-  virtual void start (void);
-
-private slots:
-  void scrollValueChanged (int value);
-  void monitorConsole (void);
-
-private:
-  QConsolePrivate* d;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-#endif // __QConsole_h__
--- a/gui/src/terminal/win32/QConsoleColors.cpp	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-
-Copyright (C) 2011 Michael Goffioul.
-
-This file is part of QConsole.
-
-Foobar 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 3 of the License, or
-(at your option) any later version.
-
-QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include "QConsoleColors.h"
-
-//////////////////////////////////////////////////////////////////////////////
-
-QConsoleColors::QConsoleColors (void)
-    : QMap<int, QColor> ()
-{
-  (*this)[0]  = Qt::black;
-  (*this)[1]  = Qt::darkBlue;
-  (*this)[2]  = Qt::darkGreen;
-  (*this)[3]  = Qt::darkCyan;
-  (*this)[4]  = Qt::darkRed;
-  (*this)[5]  = Qt::darkMagenta;
-  (*this)[6]  = Qt::darkYellow;
-  (*this)[7]  = Qt::lightGray;
-  (*this)[8]  = Qt::darkGray;
-  (*this)[9]  = Qt::blue;
-  (*this)[10] = Qt::green;
-  (*this)[11] = Qt::cyan;
-  (*this)[12] = Qt::red;
-  (*this)[13] = Qt::magenta;
-  (*this)[14] = Qt::yellow;
-  (*this)[15] = Qt::white;
-}
--- a/gui/src/terminal/win32/QConsoleColors.h	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-
-Copyright (C) 2011 Michael Goffioul.
-
-This file is part of QConsole.
-
-Foobar 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 3 of the License, or
-(at your option) any later version.
-
-QConsole 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef __QConsoleColors_h__
-#define __QConsoleColors_h__ 1
-
-#include <QColor>
-#include <QMap>
-
-//////////////////////////////////////////////////////////////////////////////
-
-class QConsoleColors : public QMap<int, QColor>
-{
-public:
-  QConsoleColors (void);
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-#endif // __QConsoleColors_h__
--- a/gui/start.sh	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-# Quint - A graphical user interface for Octave
-# Copyright (C) 2011 Jacob Dawid
-# jacob.dawid@googlemail.com
-#
-# 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 3 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, see <http://www.gnu.org/licenses/>.
-
-LANG=en_US.UTF-8
-cd bin
-./octave-gui
--- a/gui/translators	Sat Jan 21 10:40:19 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# Below Octave GUI translators are listed with their e-mails
-# to be able inform them about generic translation file changes
-en-en Jacob Dawid <jacob.dawid@googlemail.com>
-es-es Valentin Ortega-Clavero <arcanos3030@gmail.com>
-de-de Jacob Dawid <jacob.dawid@googlemail.com>
-pt-br JĂșlio Hoffimann Mendes <julio.hoffimann@gmail.com>
-ru-ru Andriy Shinkarchuck <adriano32.gnu@gmail.com>
-uk-ua Andriy Shinkarchuck <adriano32.gnu@gmail.com>