<!--
  <!DOCTYPE chapter PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" >

 -->

<chapter id="basics">
  <title>
    &kexi; Basics
  </title>

  <sect1 id="doc-vs-project">
    <title>
      &kexi; Databases
    </title>
    <para>
      Many applications such as OpenOffice.org or Microsoft Excel create
      files which are called <firstterm>documents</firstterm>. &kexi;
      creates files too, but we refer to them as <firstterm>&kexi;
      database files</firstterm>, or simple <firstterm>database
      files</firstterm> here.  &kexi; database files usually have the
      extension <filename>.kexi</filename>.
    </para>
  
<!-- TODO: Picture of Kexi database icon? -->

    <para>
      In addition to storing your databases in database files, &kexi;
      can also use databases on <firstterm>database
      servers</firstterm>, which is why we refer to them as
      <emphasis>database files</emphasis>, and not simply as
      <emphasis>databases</emphasis>.
    </para>

    <para>
      The term <firstterm>&kexi; project</firstterm>, or simply
      <firstterm>project</firstterm> is also used to refer to a &kexi;
      database, regardless of whether it is stored in a file or on a
      database server.
    </para>
  </sect1>

  <sect1 id="new-database">
    <title>
      Creating a New Database File
    </title>

    <procedure>
      <step>
	<para>
	  Run &kexi;, or if it is already running, use
	  <menuchoice>
	    <shortcut>
	      <keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo>
	    </shortcut>
	    <guimenu>File</guimenu><guimenuitem>New...</guimenuitem>
	  </menuchoice>.
	</para>
      </step>
      <step>
	<para>
	  Choose <guilabel>Blank Database</guilabel> and click the <guibutton>OK</guibutton> to confirm the
	  creation of the project.
	</para>
      </step>
      <step>
	<para>
	  Select <guilabel>New Project Stored in File</guilabel> and proceed with <guibutton>Next</guibutton>.
	</para>
      </step>
      <step>
	<para>
	  Enter a name for your project, and click <guibutton>Next</guibutton>.
	</para>
      </step>
      <step>
	  <para>
	    Use the file browser to choose a folder where you would
	    like to save your database file.  You may change the file
	    name in the <guilabel>Location:</guilabel> box if you dislike
	    the one that is suggested.
	  </para>
      </step>
      <step>
	<para>
	  Click <guibutton>Create</guibutton>.
	</para>
      </step>
    </procedure>
  </sect1>

  <sect1 id="main-window">
    <title>
      The &kexi; Main Window
    </title>
    <para>
      The <guilabel>Project Navigator</guilabel> and
      <guilabel>Properties Editor</guilabel> are shown in panes on
      each side of the child window.  These can be resized or hidden
      as required.  A pane can be hidden by clicking the small cross
      at the top of the pane (just below the toolbar).
    </para>
    <para>
      Database objects (tables, queries, etc.) listed in the <guilabel>Project
      Navigator</guilabel> can opened by clicking (or
      double-clicking, depending upon your global &kde; settings) on their names.
    </para>

<sect2 id="main-application-elements">
<title>
Main application elements
</title>
<!--
<br><img src="img/04_06_00_main_window.png">
<br>Kexi's main window<br><br>
-->
<itemizedlist>
<title>
Main elements of &kexi; application's window are:
</title>
<listitem>
<para><emphasis>Menubar</emphasis></para>
<para>
contains available commands for the application.
You will find detailed description of any of the commands in the appendix.
<!-- @todo: point to the appendix (link) -->
</para>
</listitem>
<listitem>
<para><emphasis>Toolbar</emphasis></para>
<para>
contains most frequently used commands.
</para>
</listitem>

<listitem>
<!-- @todo: link to the various chapters from the listitems -->
<para><emphasis><guilabel>Project Navigator</guilabel>'s pane</emphasis></para>
<para>
contains a list of any object (tables, queries, forms, ...) created
within the currently opened database project. The navigator also contains
small toolbar with most usable commands related to the database objects.
</para>
</listitem>

<listitem>
<para><emphasis><guilabel>Opened database objects</guilabel> area</emphasis></para>
<para>
a central area of the application taking most of the screen space.
For IDEAl user interface mode it contains switchable tabs with
windows that are always maximized. For Childframe user interface
mode it contains floating windows.
</para>
</listitem>

<listitem>
<para><emphasis><guilabel>Properties</guilabel> pane</emphasis></para>
<para>
contains a list of properties of currently activated database object.
For certain objects (&eg; form's widgets) it can have several tabs.
</para>
</listitem>

<listitem>
<para><emphasis>Taskbar</emphasis></para>
<para>
contains a list of currently opened windows with database objects.
For IDEAl user interface mode, it is available as a number of tabs.
For Childframe user interface mode, it is available as a number of
buttons, behaving just like your operating system's taskbar.
</para>
</listitem>

</itemizedlist>

<sect3 id="project-navigator-pane">
<title><guilabel>Project Navigator</guilabel> pane</title>
<para>
The <guilabel>Project Navigator</guilabel> pane is one of the most frequently used elements
of the &kexi; main window. The pane contains a list of all objects
created within the currently opened &kexi; database project. The objects
are split into groups: tables, queries, forms.
</para>
<para id="project-navigator-pane-toolbar">
The <guilabel>Project Navigator</guilabel> pane also contains a <emphasis>small toolbar for most
frequently used commands</emphasis> (from left to right): <guilabel>Open
selected object</guilabel>, <guilabel>Design selected object</guilabel>,
<guilabel>Create a new object</guilabel>, and <guilabel>Delete selected
object</guilabel>.
<!--
<img src="img/04_06_01_nav_mini_toolbar.png">
<br>A toolbar in the Project Navigator pane<br><br>
-->
</para>
<para>
For each object on the list a context menu is available using the &RMB;.
For example, this is context menu for the <emphasis>persons</emphasis> table.
<!--
 <br><img src="img/04_06_01_context_menu.png">
 <br>Project Navigator pane's context menu<br><br>
-->

<!-- TODO Commands of this menu is documented in <appendix> 

See also a list of available shortcuts in <a href=
"ab_00_00_shortcuts.html#nav_panel">Appendix B.2. Project Navigator
pane <! - - TODO (js) APPENDIX number - - ></a> .

-->
</para>

<para>
Double clicking with the &LMB; on the object's name on the list allows to
open the object in Data View. If the object's window was alread opened,
the action just activates the window without switching it's view mode.
</para>
<para>
Note that your operating system or window manager can be set up to handle
single clicks instead of double clicks. In this case it is enough to single
click on the object name to open its window.
<!-- TODO (js) but then how to select an object without opening it? -->
</para>

</sect3>

<sect3 id="database-object-windows">
<title>Database object windows</title>

<orderedlist>
<title>Opening an object's window</title>
<listitem>
<para>
Select the object in the <link linkend="project-navigator-pane">Project Navigator
pane</link>.
</para>
</listitem>
<listitem>
<para>
<!-- <img src="icons/edit.png" class="icon"> -->
Click the <guibutton>Open</guibutton> button on the <link
linkend="project-navigator-pane-toolbar">Project Navigator pane's toolbar</link>.
</para>
</listitem>
</orderedlist>

<itemizedlist>
<title>Commands related to object windows</title>
<listitem><para><emphasis>Closing an object window</emphasis></para>
<para>
When the IDEAl user interface mode (the default) is used, each window has
its own tab. Place the mouse pointer on the icon on the tab. A
<!-- <img src="fileclose.png" class="icon"> --> <guibutton>Close</guibutton> button will become
visible. Click it to close the tab.
</para>
<para>
In the Childframe on the right hand of each opened window there are
buttons you can use to control the window. Click the first one on the
right hand to close the window.
</para>
<para>
Alternatively, regardless of the user interface mode you are using,
you can select <menuchoice><guimenu>Window</guimenu>
<guimenuitem>Close</guimenuitem></menuchoice> from the Menubar.
</para>
</listitem>
<listitem><para><emphasis>Window buttons for Childframe user interface
mode</emphasis></para>
<!--
<para>
<br><img src="img/04_06_02_window_buttons.png">
<br>Window's buttons<br><br>
</para>
-->
<para>
The other buttons (from right to left) can be used to: maximize, minimize
and undock the window.
</para>
<para>
There's a small icon on the left side of the title bar which can be clicked
to show a context menu with commands related to the window.
</para>
<!--
<para>See also Docking and undocking of the windows.</para>
-->
</listitem>
</itemizedlist>

</sect3>

<sect3 id="property-editor-pane">
<title><guilabel>Property Editor</guilabel> pane</title>
<para>
In the <guilabel>Property Editor</guilabel> pane you can change properties of the object
displayed in the active window. Depending on the context, the pane is
consisted of one or more tabs. The first, always visible tab, Properties,
contains the list of available properties.
</para>
<!--
<para>
<img src="img/04_06_03_prop_panel.png">
<br>Property Editor<br><br>
</para>
-->
<itemizedlist>
<title>Rules for using the Property Editor:</title>
<listitem>
<para>Each row contains a single property.</para>
</listitem>
<listitem>
<para>You can use the mouse or the keyboard to change values of particular
properties.</para>
</listitem>
<listitem>
<itemizedlist>
<title>Most frequently used types of property values are:</title>
<listitem>
<para><emphasis>a number;</emphasis> you can enter the value directly
or increase or decrease its value by clicking with the &LMB; on the arrows.
<!-- <img src="img/04_06_03_prop_arrows.png" class="icon"> -->
</para>
</listitem>
<listitem><para>text</para></listitem>
<listitem><para>drop down list of values</para></listitem>
<listitem><para><emphasis>Yes/No;</emphasis>
you can toggle the value by clicking on the button;
<guibutton>Yes</guibutton> (<emphasis>true</emphasis>) means that the button is
toggled on, <guibutton>>No</guibutton> (<emphasis>false</emphasis>) means that
the button is toggled off.
<!-- see the above figure -->
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem><para>
There is no need to confirm a changed value: changes are visible immediately
after moving to a different row of the Property Editor's list or by pressing
the <keycombo><keycap>Enter</keycap></keycombo> key.
</para></listitem>
<listitem>
<para>
Names of the recently changed properties that not yet were stored in the
database are marked with bold text.
</para>
</listitem>
<listitem>
<para>
After changing the value of a property, a special <guibutton>Undo changes</guibutton>
button appears on the right side of the Property Editor's list.
<!-- <img src="img/04_06_03_prop_undo.png" class="icon"> -->
By clicking it you can revert the value of the property to the original value
that was loaded from the database upon opening the database object. The button
is only visible when the property is actually highlighted.
</para>
</listitem>
</itemizedlist>

<itemizedlist>
<title>The Property Editor pane is empty if:</title>
<listitem><para>no single database object's window is opened, or</para>
</listitem>
<listitem><para>
the active database object's window does not offer properties; it is usually
the case when it is opened in Data View instead of Design View
</para>
</listitem>
</itemizedlist>

<!--
<para>
See also the list of keyboard shortcuts available for the Property Editor
pane in appendix Property Editor pane.
</para>
-->

</sect3>

</sect2>

  </sect1>

  <sect1 id="project-opening">
    <title>
      Opening an existing &kexi; database file
    </title>
    <itemizedlist>
      <title>
        To open an existing &kexi; database file:
      </title>
      <listitem><para>
        select it in the <guilabel>Open Existing Project</guilabel>
		dialog; or
      </para></listitem>
      <listitem><para>
        open it by clicking on the .kexi file icon.
      </para></listitem>
    </itemizedlist>

    <sect2 id="window-open-existing">
      <title>
        Opening a database file in the <guilabel>Open Existing
		Project</guilabel> dialog
      </title>
      <itemizedlist>
        <listitem><para>
            Run &kexi;. <!--(see <a href="04_02_00_running_kexi.html">Running Kexi</a>).-->
            You should see the <guilabel>Choose Project</guilabel> startup dialog.
            Choose <guilabel>Open Existing Project</guilabel> tab.
            You will see the following dialog:
          <!-- image: <img src="img/04_04_01_startup_open_existing.png"> -->
        </para></listitem>
        <listitem><para>
          From <guilabel>Current location</guilabel> drop down box, pick a folder
          containing a file you are looking for.
        </para></listitem>
        <listitem><para>
          You can either pick a file or enter its name in the
          <guilabel>Location:</guilabel> box.
        </para></listitem>
        <listitem><para>
          Click <guibutton>OK</guibutton>.
        </para></listitem>
      </itemizedlist>

      <sect3 id="open-existing-notes">
        <title>
          Notes
        </title>
        <itemizedlist>
          <listitem><para>
            By default the <guilabel>Filter:</guilabel> drop down list has
            <guilabel>Kexi Database File-Based Project</guilabel> selected.
            In case the file you are looking for has an other extension,
            you can change the selection of the <guilabel>Filter:</guilabel>
            drop down list to <guilabel>All Files</guilabel> to display
            all available files (regardless of an extension).
          </para></listitem>
          <listitem><para>
            If you have selected a file of an external type, like a MS Access .mdb
            file, &kexi; will provide you with the option to import the file.
<!-- todo an advice to read "importing" chapter will be placed here -->
          </para></listitem>
          <listitem><para>
            If you have selected a <emphasis>connection data</emphasis> file
            (with .kexic extension) or a <emphasis>shortcut to a project on
            database server</emphasis> file (with .kexis extension), &kexi;
            will display appropriate dialogs.
          </para></listitem>
        </itemizedlist>
      </sect3>
    </sect2>

    <sect2 id="open-icon">
      <title>
        Opening an existing &kexi; database file by clicking on .kexi file's icon
      </title>
      <para>
        Click file's icon using your file manager or desktop.
        &kexi; will open this database project automatically.
      </para>
<!-- <img src="icons/mime-kexiproject_sqlite.png" class="icon"/> -->
      <sect3 id="open-icon-notes">
        <title>
          Notes
        </title>
        <para>
          <emphasis>Note about database files accessed remotely.</emphasis>
          You may want to open a database file that is located on a remote
          source (&eg; a web or FTP server or a MS Windows network share).
          K Desktop Environment allows you to open files from remote sources
          directly in applications and to save changes back to the source, but
          this is not the case with database files. By clicking on a database
          file located on a remote source, a copy of the file will be
		  downloaded to a temporary directory on your computer and all your
          changes will be made to this local file. The remote original of
          the file will remain unchanged, so it's recommended to copy
		  (download) the file to your computer first, then open the file and
		  copy it back to the remote source if you want to make it up to date.
        </para>
      </sect3>
    </sect2>
  </sect1>

  <sect1 id="using-help">
    <title>
      Using built-in help
    </title>
    <itemizedlist>
      <title>
        The following ways to get built-in help in &kexi; are available:
      </title>
      <listitem>
        <para><emphasis>The Handbook in form of electronic document.</emphasis></para>
        <para>
          The Handbook is available by pressing <keycombo><keycap>F1</keycap></keycombo>
          key or selecting <menuchoice><guimenu>Help</guimenu><guimenuitem>&kexi;
          Handbook</guimenuitem></menuchoice> from the menubar.
        </para>
      </listitem>
      <listitem>
        <para><emphasis>What's This? hints.</emphasis></para>
        <para>
          Select <menuchoice><guimenu>Help</guimenu><guimenuitem>What's
          This?</guimenuitem></menuchoice>from the menu bar and click on
          an area of the application to get hints about it.
        </para>
      </listitem>
    </itemizedlist>
  </sect1>

</chapter>
