<para>This section is a developer's guide explaining the peculiarities of dialog creation in &kappname;. A basic understanding of TQt GUI programming is assumed, as is a knowledge of &kappname; coding standards as laid out in the Project Handbook.</para>
<para>The default language of &kappname; is American English, but don't let that put you off! All contributions will be welcome, and as long as you have a basic knowledge of the language, the members of the &kappname; developers list will be happy to help you polish it up.</para>
<para/>
</sect1>
<sect1 id="dialogs-naming">
<title>Naming the dialog</title>
<para/>
<para>First step is to choose a meaningful name for your dialog (and preferably one that's not already in use! - see the kmymoney2/dialogs source directory). In accordance with &kappname; coding conventions, the name should consist of 2 or 3 (or more) 'words', strung together without spaces. To keep names to a manageable length, these 'words' may be abbreviated, e.g. 'sched' for 'schedule'. Each 'word' should be spelt with an initial upper-case letter. Also, the names of dialogs are always preceded by a letter 'K', thus e.g. KEditSchedTrans. This name will be indicated in the rest of this chapter by <KN>. There are nevertheless occasions where all lower case letters are appropriate, specifically source file names; this will be indicated as <kn>.</para>
<para>The dialog screen should be built using TQt Designer. This section assumes that you are using version 3.x of TQt. Version 4 is, at present, an unknown quantity.</para>
<para>Open Designer without specifying a project, and select Dialog from the New File/Project tab. Start by changing the form name; this should be set to '<KN>DlgDecl'.</para>
<para/>
<para>Now add your widgets to the form, not forgetting to include a Help button. Remember that users will have many different hardware and screen combinations, and will need to be able to resize windows, so make full use of the various layout and spacer options of Designer. A lot of tutorials can be found on the web to help guide you on this; try your favourite search engine.</para>
<para/>
<sect2 id="dialogs-naming-widgets">
<title>Naming widgets</title>
<para/>
<para>Fixed widgets, e.g. text labels, can often use the default names assigned by Designer. Other widgets on your form should be given names which are meaningful in an application context. This is particularly important for those widgets which are to be referenced in code. As per the application programming standards, these names should be prefixed with 'm_' to indicate them as member variables of the dialog.</para>
<para/>
</sect2>
<sect2 id="dialogs-i18n-considerations">
<title>i18n considerations</title>
<para/>
<para>Designer contains an option to generate shortcut (accelerator) keys for various widgets (buttons, menu items) by including an ampersand ('&') before the shortcut letter. This should be used for the more common items, since many users prefer to use keyboard input rather than using the mouse. However, this does have the unfortunate side effect of automatically generating an 'accel' property for the widget, referencing a letter which may not be appropriate when the caption is translated to another language. Use the properties menu, therefore, to remove this value, or see below.</para>
<para>Fixed text fields and labels in the form do not require any special consideration. TQt Designer and the project's build environment will take care of wrapping the strings into an i18n construct for presentation to translators.</para>
<para>When complete, save the form using the Designer default name (<kn>dlgdecl.ui) in the dialogs source code folder (kmymoney2/dialogs).</para>
<para/>
</sect2>
</sect1>
<sect1 id="dialogs-writing-code">
<title>Writing code</title>
<para/>
<para>Your code to process form actions should be included in source files named <kn>dlg.h/.cpp, in the same folder as the .ui file. You can view these for many examples of how to code. Some requirements are:</para>
<para/>
<sect2 id="dialogs-header-file">
<title>Header (.h) file</title>
<para/>
<para>This should start with definitions similar to the following</para>
<para>The include file will have been generated by the TQt UIC (User Interface Compiler) from the .ui file for the dialog, under control of the make process.</para>
<para>The TQ_OBJECT macro (written without any punctuation) will cause the TQt MOC (Meta Object Compiler) to generate additional object code and files which are necessary to support the signal/slot functionality (among other things).</para>
<para>sections if you plan to use the signal/slot mechanism. See the TQt documentation about signals and slots. An example would be slotHelp() which will be connected to the clicked() signal of the help button of your dialog in the constructor of your dialog.</para>
<para>This is one of the files generated by the TQt MOC (Meta Object Compiler) during the make process; if you finish up with 'vtable' errors, it's probably because you forgot to include this.</para>
<para>You will need to edit file Makefile.am in the dialogs source folder before building &kappname;. Note that due to the abstruse rules of make, the lists of files should consist of a single logical line, so be careful regarding any editor options which may cause automatic insertion of line breaks. You can however use a continuation character of backslash to spread the list over multiple physical lines. There must be no character following the continuation character, not even a blank.</para>
<para/>
<para>- Add <kn>dlgdecl.ui and <kn>dlg.cpp to the libdialogs_a_SOURCES line</para>
<para>- Add <kn>dlgdecl.ui to EXTRA_DIST</para>
<para>- Add <kn>dlgdecl.cpp and <kn>dlgdecl.h to DISTCLEANFILES</para>
<para>- Add <kn>dlg.h to NOINST_HEADERS</para>
<para/>
<para>Save the file, and you are ready to build &kappname;. For the first build after updating Makefile.am you should re-run 'make -f Makefile.dist', reconfigure and make. Otherwise, some make rules might not be present and compiling fails.</para>