[hamradio-commits] [pyqso] 01/01: Imported Upstream version 0.1

Iain Learmonth irl-guest at moszumanska.debian.org
Sat Feb 7 23:06:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

irl-guest pushed a commit to annotated tag upstream/0.1
in repository pyqso.

commit 9487a22e1fdbb647c26b60577238e2248cb50b01
Author: Iain R. Learmonth <irl at fsfe.org>
Date:   Sat Dec 13 15:58:14 2014 +0000

    Imported Upstream version 0.1
---
 COPYING                           | 674 +++++++++++++++++++++++++++
 Makefile                          |  42 ++
 README.md                         |  68 +++
 bin/pyqso                         | 166 +++++++
 doc/images/awards.png             | Bin 0 -> 11921 bytes
 doc/images/dx_cluster.png         | Bin 0 -> 49197 bytes
 doc/images/edit_record.png        | Bin 0 -> 42003 bytes
 doc/images/grey_line.png          | Bin 0 -> 65869 bytes
 doc/images/log_with_awards.png    | Bin 0 -> 59371 bytes
 doc/manual.tex                    | 258 +++++++++++
 icons/log_1024x1024.xcf           | Bin 0 -> 2183875 bytes
 icons/log_14x14.png               | Bin 0 -> 667 bytes
 icons/log_192x192.png             | Bin 0 -> 48571 bytes
 icons/log_64x64.png               | Bin 0 -> 6920 bytes
 pyqso/__init__.py                 |   0
 pyqso/adif.py                     | 490 ++++++++++++++++++++
 pyqso/auxiliary_dialogs.py        |  49 ++
 pyqso/awards.py                   | 105 +++++
 pyqso/callsign_lookup.py          | 128 ++++++
 pyqso/dx_cluster.py               | 180 ++++++++
 pyqso/grey_line.py                |  83 ++++
 pyqso/log.py                      | 377 +++++++++++++++
 pyqso/log_name_dialog.py          |  56 +++
 pyqso/logbook.py                  | 947 ++++++++++++++++++++++++++++++++++++++
 pyqso/menu.py                     | 259 +++++++++++
 pyqso/preferences_dialog.py       | 283 ++++++++++++
 pyqso/record_dialog.py            | 482 +++++++++++++++++++
 pyqso/telnet_connection_dialog.py |  84 ++++
 pyqso/toolbar.py                  | 119 +++++
 pyqso/toolbox.py                  |  64 +++
 pyqso/unittest_resources/test.db  | Bin 0 -> 3072 bytes
 setup.py                          |  33 ++
 32 files changed, 4947 insertions(+)

diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 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 General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is 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.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  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
+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.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  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.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  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 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. Use with the GNU Affero General Public License.
+
+  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 Affero 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 special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU 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 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 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 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
+
+            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
+state 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 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/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program 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, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU 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 Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..369177e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# File: Makefile
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+input: 	clean install documentation
+
+install:
+	@echo **********Installing PyQSO
+	python setup.py install
+
+manual:
+	@echo **********Compiling the user manual
+	cd doc; pdflatex manual.tex; cd ..
+
+unittest:
+	@echo **********Running the unit tests
+	cd pyqso; for file in *.py; do (python $$file); done; cd ..
+
+clean:
+	@echo **********Cleaning build directory
+	rm -rf build
+	@echo **********Cleaning pyqso directory
+	cd pyqso; rm -rf *.pyc ADIF.test_read.adi ADIF.test_write*.adi; cd ..
+	@echo **********Cleaning doc directory
+	cd doc; rm -rf *.log *.aux *.dvi *.pdf *.ps *.toc *.out; cd ..
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..fa45723
--- /dev/null
+++ b/README.md
@@ -0,0 +1,68 @@
+    File: README.md
+    Copyright (C) 2013 Christian Jacobs.
+
+    This file is part of PyQSO.
+
+    PyQSO 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.
+
+    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+PyQSO
+=====
+
+PyQSO is a contact logging tool for amateur radio operators.
+
+Installation and running
+------------------------
+
+Assuming that the current working directory is PyQSO's base directory (the directory that the Makefile is in), PyQSO can be installed via the terminal with the following command:
+
+   `make install`
+
+Note: 'sudo' may be needed for this. Once installed, the following command will run PyQSO:
+   
+   `pyqso`
+
+Alternatively, PyQSO can be run (without installing) with:
+
+   `python bin/pyqso`
+
+from PyQSO's base directory.
+
+Documentation
+-------------
+
+The PyQSO user manual is stored as a LaTeX source file in the doc/ directory. It can be compiled with the following command:
+
+   `make manual`
+
+which will produce the manual.pdf file.
+
+Dependencies
+------------
+
+PyQSO depends on the following Debian packages:
+
+* gir1.2-gtk-3.0
+* python2.7
+* python-gi-cairo (for log printing purposes)
+
+The following extra packages are necessary to enable the grey line tool:
+
+* python-mpltoolkits.basemap
+* python-numpy
+* python-matplotlib (version 1.3.0 or later)
+
+The following extra package is necessary to enable Hamlib support:
+
+* python-libhamlib2
+
diff --git a/bin/pyqso b/bin/pyqso
new file mode 100755
index 0000000..599a02e
--- /dev/null
+++ b/bin/pyqso
@@ -0,0 +1,166 @@
+#!/usr/bin/env python
+# File: pyqso.py
+
+#    Copyright (C) 2012 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject, Gdk, GdkPixbuf
+import logging
+import optparse
+import ConfigParser
+import os
+import os.path
+import sys
+import signal
+
+# This will help Python find the PyQSO modules
+# that need to be imported below.
+pyqso_path = os.path.join(os.path.realpath(os.path.dirname(__file__)), os.pardir)
+sys.path.insert(0, pyqso_path)
+
+# PyQSO modules
+from pyqso.adif import *
+from pyqso.logbook import *
+from pyqso.menu import *
+from pyqso.toolbar import *
+from pyqso.toolbox import *
+from pyqso.preferences_dialog import *
+   
+class PyQSO(Gtk.Window):
+   """ The PyQSO application class. """
+   
+   def __init__(self, logbook_path):
+      """ Set up the main (root) window, start the event loop, and open a logbook (if the logbook's path is specified by the user in the command line). """
+         
+      # Call the constructor of the super class (Gtk.Window)
+      Gtk.Window.__init__(self, title="PyQSO 0.1")
+
+      # Get any application-specific preferences from the configuration file      
+      config = ConfigParser.ConfigParser()
+      # Check that the configuration file actually exists (and is readable)
+      # otherwise, we will resort to the defaults.
+      have_config = (config.read(os.path.expanduser("~/.pyqso.ini")) != [])
+
+      self.set_size_request(800, 600) # Default to an 800 x 600 resolution.
+      self.set_position(Gtk.WindowPosition.CENTER)
+      possible_icon_paths = [os.path.join(pyqso_path, "icons", "log_64x64.png")]
+      for icon_path in possible_icon_paths:
+         try:
+            self.set_icon_from_file(icon_path)
+         except Exception, error:
+            print error.message
+
+      # Kills the application if the close button is clicked on the main window itself. 
+      self.connect("delete-event", Gtk.main_quit)
+      
+      vbox_outer = Gtk.VBox()
+      self.add(vbox_outer)
+
+      self.statusbar = Gtk.Statusbar()
+      context_id = self.statusbar.get_context_id("Status")
+      self.statusbar.push(context_id, "No logbook is currently open.")
+      
+      # Create a Logbook so we can add/remove/edit logs and records,
+      # once connected to the SQLite database.
+      self.logbook = Logbook(self)
+      self.logbook.set_scrollable(True)
+
+      self.toolbox = Toolbox(self)
+
+      # Set up menu and tool bars
+      # These classes depend on the Logbook and Toolbox class,
+      # so pack the logbook and toolbox after the menu and toolbar.
+      self.menu = Menu(self)
+      self.toolbar = Toolbar(self)
+
+      vbox_outer.pack_start(self.menu, False, False, 0)
+      vbox_outer.pack_start(self.toolbar, False, False, 0)
+      vbox_outer.pack_start(self.logbook, True, True, 0)
+      vbox_outer.pack_start(self.toolbox, True, True, 0)
+      vbox_outer.pack_start(self.statusbar, False, False, 0)
+
+      self.show_all()
+
+      if(have_config):
+         if(config.get("general", "show_toolbox") == "False"):
+            self.toolbox.toggle_visible_callback()
+      else:            
+         # Hide the Toolbox by default
+         self.toolbox.toggle_visible_callback()
+
+      if(logbook_path is not None):
+         self.logbook.open(widget=None, path=logbook_path)
+
+      return
+
+   def show_about(self, widget):
+      """ Show the About dialog, which includes license information. This method returns None after the user destroys the dialog. """
+      about = Gtk.AboutDialog()
+      about.set_modal(True)
+      about.set_transient_for(parent=self)
+      about.set_program_name("PyQSO")
+      about.set_version("0.1")
+      about.set_authors(["Christian Jacobs"])
+      about.set_license("""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/>.""")
+      about.set_comments("PyQSO: A contact logging tool for amateur radio operators.")
+      possible_icon_paths = [os.path.join(pyqso_path, "icons", "log_64x64.png")]
+      for icon_path in possible_icon_paths:
+         try:
+            about.set_logo(GdkPixbuf.Pixbuf.new_from_file_at_scale(icon_path, 64, 64, False))
+         except Exception, error:
+            print error.message
+      about.run()
+      about.destroy()
+      return      
+
+   def show_preferences(self, widget):
+      """ Show the Preferences dialog. Any changes made by the user after clicking the 'Ok' button are saved in the .cfg file. This method returns None after the user destroys the dialog. """
+      preferences = PreferencesDialog(self)
+      response = preferences.run()
+      if(response == Gtk.ResponseType.OK):
+         preferences.commit()
+      preferences.destroy()
+      return
+
+if(__name__ == "__main__"):
+   # Get any command line arguments
+   parser = optparse.OptionParser()
+   parser.add_option("-d", "--debug", action="store_true", default=False, help="Enable debugging. All debugging messages will be written to pyqso.debug.")
+   parser.add_option("-l", "--logbook", action="store", type="string", dest="logbook", default=None, help="Path to the Logbook file.")
+   (options, args) = parser.parse_args()
+
+   # Set up debugging output
+   if(options.debug):
+      logging.basicConfig(level=logging.DEBUG, filename="pyqso.debug", 
+                        format="%(asctime)s %(levelname)s: %(message)s", 
+                        datefmt="%Y-%m-%d %H:%M:%S")
+
+   signal.signal(signal.SIGINT, signal.SIG_DFL) # Exit PyQSO if a SIGINT signal is captured.
+   application = PyQSO(options.logbook) # Populate the main window and show it
+   Gtk.main() # Start up the event loop!
+
diff --git a/doc/images/awards.png b/doc/images/awards.png
new file mode 100644
index 0000000..44b2723
Binary files /dev/null and b/doc/images/awards.png differ
diff --git a/doc/images/dx_cluster.png b/doc/images/dx_cluster.png
new file mode 100644
index 0000000..fc250a4
Binary files /dev/null and b/doc/images/dx_cluster.png differ
diff --git a/doc/images/edit_record.png b/doc/images/edit_record.png
new file mode 100644
index 0000000..4e43456
Binary files /dev/null and b/doc/images/edit_record.png differ
diff --git a/doc/images/grey_line.png b/doc/images/grey_line.png
new file mode 100644
index 0000000..36b7e28
Binary files /dev/null and b/doc/images/grey_line.png differ
diff --git a/doc/images/log_with_awards.png b/doc/images/log_with_awards.png
new file mode 100644
index 0000000..4e7e070
Binary files /dev/null and b/doc/images/log_with_awards.png differ
diff --git a/doc/manual.tex b/doc/manual.tex
new file mode 100644
index 0000000..e7fca5e
--- /dev/null
+++ b/doc/manual.tex
@@ -0,0 +1,258 @@
+% PyQSO User Manual
+
+%    Copyright (C) 2013 Christian Jacobs.
+
+%    This file is part of PyQSO.
+
+%    PyQSO 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.
+%
+%    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+\documentclass[11pt, a4paper]{report}
+\usepackage[margin=1.2in]{geometry}
+\usepackage{graphicx}
+\usepackage{hyperref}
+\hypersetup{
+  colorlinks=false,
+  pdfborder={0 0 0},
+  }
+
+\setlength{\parskip}{0.25cm}
+
+\begin{document}
+
+\begin{titlepage}
+\begin{center}
+\vspace*{5cm}
+\huge{PyQSO User Manual}\\\vspace*{5cm}
+\LARGE{Version 0.1}
+\end{center}
+\end{titlepage}
+
+\tableofcontents
+
+\chapter{Introduction}\label{chap:introduction}
+\section{Overview}
+PyQSO is a logging tool for amateur radio operators. It provides a simple graphical interface through which users can manage information about the contacts/QSOs they make with other operators on the air. All information is stored in a light-weight SQL database. Other key features include:
+\begin{itemize}
+  \item Customisable interface (e.g. only show callsign and frequency information).
+  \item Import and export logs in ADIF format.
+  \item Perform callsign lookups and auto-fill data fields using the qrz.com database.
+  \item Sort the logs by individual fields.
+  \item Print a hard-copy of logs, or print to PDF.
+  \item Connect to Telnet-based DX clusters.
+  \item Progress tracker for the DXCC award.
+  \item Grey line plotter.
+  \item Filter out QSOs based on the callsign field (e.g. only display contacts with callsigns beginning with ``M6'').
+  \item Remove duplicate QSOs.
+  \item Basic support for the Hamlib library.
+\end{itemize}
+The source code for PyQSO is available for download at:
+
+\texttt{https://github.com/ctjacobs/pyqso}
+
+\section{Data storage model}
+Many amateur radio operators choose to store all the contacts they ever make in a single \textit{logbook}, whereas others keep a separate logbook for each year, for example. Each logbook may be divided up to form multiple distinct \textit{logs}, perhaps one for casual repeater contacts and another for DX'ing. Finally, each log can contain multiple \textit{records}. PyQSO is based around this three-tier model for data storage, going from logbooks at the top to individual records at the bottom. 
+
+Rather than storing each log in a separate file, a single database can hold several logs together; in PyQSO, a database is therefore analogous to a logbook. Within a database the user can create multiple tables which are analogous to the logs. Within each table the user can create/modify/delete records which are analogous to the records in each log.
+
+\section{Licensing}
+PyQSO is free software, released under the GNU General Public License. Please see the file called COPYING for more information.
+
+\section{Structure of this manual}
+The structure of this manual is as follows. Chapter \ref{chap:getting_started} is all about getting started with PyQSO -- from the installation process through to creating a new logbook (or opening an existing one). Chapter \ref{chap:log_management} explains how to create a log in the logbook, as well as the basic operations that users can perform with existing logs, such as printing, importing from/exporting to ADIF format, and sorting. Chapter \ref{chap:record_management} deals with th [...]
+
+\chapter{Getting started}\label{chap:getting_started}
+
+\section{System requirements}
+It is recommended that users run PyQSO on the Linux operating system, since all development and testing of PyQSO takes place there.
+
+As the name suggests, PyQSO is written primarily in the Python programming language. The graphical user interface has been built using the GTK+ library through the PyGObject bindings. PyQSO also uses an SQLite embedded database to manage all the contacts an amateur radio operator makes. Users must therefore make sure that the Python interpreter and any additional software dependencies are satisfied before PyQSO can be run successfully. The list of software packages that PyQSO depends on  [...]
+
+\section{Installation and running}
+Assuming that the current working directory is PyQSO's base directory (the directory that the Makefile is in), PyQSO can be installed via the terminal with the following command:
+
+  \texttt{make install}
+
+\noindent Note: `sudo' may be needed for this. Once installed, the following command will run PyQSO:
+
+  \texttt{pyqso}
+
+\noindent Alternatively, PyQSO can be run (without installing) with:
+
+  \texttt{python bin/pyqso}
+
+\noindent from PyQSO's base directory.
+
+\subsection{Command-line options}
+There are several options available when executing PyQSO from the command-line.
+
+\subsubsection{Open a specified logbook file}
+In addition to being able to open a new or existing logbook through the graphical interface, users can also specify a logbook file to open at the command line with the \texttt{-l} or \texttt{--logbook} option. For example, to open a logbook file called \texttt{mylogbook.db}, use the following command:
+
+  \texttt{pyqso --logbook /path/to/mylogbook.db}
+
+\noindent If the file does not already exist, PyQSO will create it.
+
+\subsubsection{Debugging mode}
+Running PyQSO with the \texttt{-d} or \texttt{--debug} flag enables the debugging mode:
+
+  \texttt{pyqso --debug}
+
+\noindent All debugging-related messages are written to a file called pyqso.debug, located in the current working directory.
+
+\section{Opening a new or existing logbook}
+Logbooks are SQL databases, and as such they are accessed with a database connection. To create a connection and open the logbook, click \texttt{Open a New or Existing Logbook...} in the \texttt{Logbook} menu, and either:
+\begin{itemize}
+  \item Find and select an existing logbook database file (which usually has a \texttt{.db} file extension), and click \texttt{Open} to create the database connection; or
+  \item Create a new database by entering a (non-existing) file name and clicking \texttt{Open}. The logbook database file (and a connection to it) will then be created automatically.
+\end{itemize}
+Once the database connection has been established, the database file name will appear in the status bar. All logs in the logbook will be opened automatically, and the interface will look something like the one shown in Figure \ref{fig:log_view_with_awards}.
+
+\begin{figure}
+  \centering
+  \includegraphics[width=1\columnwidth]{images/log_with_awards.png}
+  \caption{The PyQSO main window, showing the records in a log called \texttt{repeater\_contacts}, and the awards tool in the toolbox below it.}
+  \label{fig:log_view_with_awards}
+\end{figure}
+
+\section{Closing a logbook}
+A logbook can be closed (along with its corresponding database connection) by clicking the \texttt{Close Logbook} button in the toolbar, or by clicking \texttt{Close Logbook} in the \texttt{Logbook} menu.
+
+\chapter{Log management}\label{chap:log_management}
+\noindent\textbf{Note 1:} All the operations described below assume that a logbook is already open.
+
+\noindent\textbf{Note 2:} Any modifications made to the logs are permanent. Users should make sure they keep up-to-date backups.
+
+\section{Creating a new log}
+To create a new log, click \texttt{New Log} in the \texttt{Logbook} menu and enter the desired name of the log (e.g. repeater\_contacts, dx, mobile\_log). Alternatively, use the shortcut key combination \texttt{Ctrl + N}. 
+
+The log name must be unique (i.e. it cannot already exist in the logbook). Furthermore, it can only be composed of alphanumeric characters and the underscore character, and the first character in the name must not be a number. 
+
+Note: When logs are stored in the database file, field/column names from the ADIF standard are used. However, please note that only the following subset of all the ADIF fields is considered: CALL, QSO\_DATE, TIME\_ON, FREQ, BAND, MODE, TX\_PWR, RST\_SENT, RST\_RCVD, QSL\_SENT, QSL\_RCVD, NOTES, NAME, ADDRESS, STATE, COUNTRY, DXCC, CQZ, ITUZ, IOTA. Visit http://adif.org/ for more information about these fields.
+
+\section{Renaming a log}
+To rename the currently selected log, click \texttt{Rename Selected Log} in the \texttt{Logbook} menu. Remember that the log's new name cannot be the same as another log in the logbook.
+
+\section{Deleting a log}
+To delete the currently selected log, click \texttt{Delete Selected Log} in the \texttt{Logbook} menu. As with all database operations in PyQSO, this is permanent and cannot be undone.
+
+\section{Importing and exporting a log}
+While PyQSO stores logbooks in SQL format, it is possible to export individual logs in the well-known ADIF format. Select the log to export, and click \texttt{Export Log} in the \texttt{Logbook} menu.
+
+Similarly, records can be imported from an ADIF file. Upon importing, users can choose to store the records in a new log, or append them to an existing log in the logbook. To import, click \texttt{Import Log} in the \texttt{Logbook} menu.
+
+Note that all data must conform to the ADIF standard, otherwise it will be ignored.
+
+\section{Printing a log}
+Due to restrictions on the page width, only a selection of field names will be printed: callsign, date, time, frequency, and mode.
+
+\section{Filtering by callsign}
+Entering an expression such as \texttt{xyz} into the \texttt{Filter by callsign} box will instantly filter out all records whose callsign field does not contain \texttt{xyz}.
+
+\section{Sorting by field}
+To sort a log by a particular field name, left-click the column header that contains that field name. By default, it is the \texttt{Index} field that is sorted in ascending order.
+
+\chapter{Record management}\label{chap:record_management}
+
+\noindent\textbf{Note:} Any modifications made to the records are permanent. Users should make sure they keep up-to-date backups.
+
+\section{Creating a new record (QSO)}
+A new QSO can be added by either:
+\begin{itemize}
+  \item Clicking the \texttt{Add Record} button in the toolbar.
+  \item Pressing \texttt{Ctrl + R}.
+  \item Clicking \texttt{Add Record...} in the \texttt{Records} menu.
+\end{itemize}
+A dialog window will appear where details of the QSO can be entered (see Figure \ref{fig:edit_record}). Note that the current date and time are filled in automatically. When ready, click \texttt{OK} to save the changes.
+
+\begin{figure}
+  \centering
+  \includegraphics[width=1\columnwidth]{images/edit_record.png}
+  \caption{Record dialog used to add new records and edit existing ones.}
+  \label{fig:edit_record}
+\end{figure}
+
+\subsection{Callsign lookup}
+PyQSO can also resolve station-related information (e.g. the operator's name, address, and ITU Zone) by clicking the \texttt{Lookup on qrz.com} button adjacent to the Callsign data entry box. Note that the user must first supply their qrz.com account information in the preferences dialog window.
+
+\section{Editing a record}
+An existing record can be edited by:
+\begin{itemize}
+  \item Double-clicking on it.
+  \item Selecting it and clicking the \texttt{Edit Record} button in the toolbar.
+  \item Selecting it and clicking \texttt{Edit Selected Record...} in the \texttt{Records} menu.
+\end{itemize}
+This will bring up the same dialog window as before.
+
+\section{Deleting a record}
+An existing record can be deleted by:
+\begin{itemize}
+  \item Selecting it and clicking the \texttt{Delete Record} button in the toolbar.
+  \item Selecting it and pressing the \texttt{Delete} key.
+  \item Selecting it and clicking \texttt{Delete Selected Record...} in the \texttt{Records} menu.
+\end{itemize}
+
+\section{Removing duplicate records}
+PyQSO can find and delete duplicate records in a log. A record is a duplicate of another if its data in the Callsign, Date, Time, Frequency, and Mode fields are the same. Click \texttt{Remove Duplicate Records} in the \texttt{Records} menu.
+
+\chapter{Toolbox}\label{chap:toolbox}
+The toolbox is hidden by default. To show it, click \texttt{Toolbox} in the \texttt{View} menu.
+
+\section{DX cluster}
+A DX cluster is essentially a server through which amateur radio operators can report and receive updates about QSOs that are in progress across the bands. PyQSO is able to connect to a DX cluster that operates using the Telnet protocol to provide a text-based alert service. As a result of the many different Telnet-based software products that DX clusters run, PyQSO currently outputs the raw data received from the DX cluster rather than trying to parse it in some way.
+
+Click on the \texttt{Connect to Telnet Server} button and enter the DX server details in the dialog that appears. If no port is specified, PyQSO will use the default value of 23. A username and password may also need to be supplied. Once connected, the server output will appear in the DX cluster frame (see Figure \ref{fig:dx_cluster}). A command can also be sent to the server by typing it into the entry box and clicking the adjacent \texttt{Send Command} button.
+
+\begin{figure}
+  \centering
+  \includegraphics[width=1\columnwidth]{images/dx_cluster.png}
+  \caption{The DX cluster frame.}
+  \label{fig:dx_cluster}
+\end{figure}
+
+\section{Grey line}
+The grey line tool (see Figure \ref{fig:grey_line}) can be used to check which parts of the world are in darkness. The position of the grey line is automatically updated every 30 minutes.
+
+\begin{figure}
+  \centering
+  \includegraphics[width=1\columnwidth]{images/grey_line.png}
+  \caption{The grey line tool.}
+  \label{fig:grey_line}
+\end{figure}
+
+\section{Awards}
+The awards progress tracker (see Figure \ref{fig:awards}) updates its data each time a record is added, deleted, or modified. Currently only the DXCC award is supported (visit http://www.arrl.org/dxcc for more information).
+
+\begin{figure}
+  \centering
+  \includegraphics[width=1\columnwidth]{images/awards.png}
+  \caption{The award progress tracker.}
+  \label{fig:awards}
+\end{figure}
+
+\chapter{Preferences}\label{chap:preferences}
+PyQSO user preferences are stored in a configuration file located at \texttt{\textasciitilde/.pyqso.ini}, where \texttt{\textasciitilde} denotes the user's home directory.
+
+\section{General}
+Under the \texttt{General} tab, the user can choose to show the toolbox (see Chapter \ref{chap:toolbox}) when PyQSO is started.
+
+The user can also enter their login details to access the qrz.com database. Note that these details are currently stored in plain text (unencrypted) format.
+
+\section{View}
+Not all the available fields have to be displayed in the logbook. The user can choose to hide a subset of them by unchecking them in the \texttt{View} tab. PyQSO must be restarted in order for any changes to take effect.
+
+\section{Hamlib support}\label{sect:hamlib}
+PyQSO features rudimentary support for the Hamlib library. The name and path of the radio device connected to the user's computer can be specified in the \texttt{Hamlib} tab of the preferences dialog. Upon adding a new record to the log, PyQSO will use Hamlib to retrieve the current frequency that the radio device is set to and automatically fill in the Frequency field.
+
+\bibliographystyle{plainnat}
+\end{document}
diff --git a/icons/log_1024x1024.xcf b/icons/log_1024x1024.xcf
new file mode 100644
index 0000000..e017235
Binary files /dev/null and b/icons/log_1024x1024.xcf differ
diff --git a/icons/log_14x14.png b/icons/log_14x14.png
new file mode 100644
index 0000000..e72301d
Binary files /dev/null and b/icons/log_14x14.png differ
diff --git a/icons/log_192x192.png b/icons/log_192x192.png
new file mode 100644
index 0000000..168e41e
Binary files /dev/null and b/icons/log_192x192.png differ
diff --git a/icons/log_64x64.png b/icons/log_64x64.png
new file mode 100644
index 0000000..cef17f5
Binary files /dev/null and b/icons/log_64x64.png differ
diff --git a/pyqso/__init__.py b/pyqso/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pyqso/adif.py b/pyqso/adif.py
new file mode 100644
index 0000000..b200338
--- /dev/null
+++ b/pyqso/adif.py
@@ -0,0 +1,490 @@
+#!/usr/bin/env python 
+# File: adif.py
+
+#    Copyright (C) 2012 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+import re
+import logging
+import unittest
+from datetime import datetime
+import calendar
+
+# ADIF field names and their associated data types available in PyQSO.
+AVAILABLE_FIELD_NAMES_TYPES = {"CALL": "S", 
+                              "QSO_DATE": "D",
+                              "TIME_ON": "T",
+                              "FREQ": "N",
+                              "BAND": "E",
+                              "MODE": "E",
+                              "TX_PWR": "N",
+                              "RST_SENT": "S",
+                              "RST_RCVD": "S",
+                              "QSL_SENT": "S",
+                              "QSL_RCVD": "S",
+                              "NOTES": "M",
+                              "NAME": "S",
+                              "ADDRESS": "S",
+                              "STATE": "S",
+                              "COUNTRY": "S",
+                              "DXCC": "N",
+                              "CQZ": "N",
+                              "ITUZ": "N",
+                              "IOTA": "C"}
+# Note: The logbook uses the ADIF field names for the database column names.
+# This list is used to display the columns in a logical order.
+AVAILABLE_FIELD_NAMES_ORDERED = ["CALL", "QSO_DATE", "TIME_ON", "FREQ", "BAND", "MODE", "TX_PWR", 
+                                 "RST_SENT", "RST_RCVD", "QSL_SENT", "QSL_RCVD", "NOTES", "NAME",
+                                 "ADDRESS", "STATE", "COUNTRY", "DXCC", "CQZ", "ITUZ", "IOTA"]
+# Define the more user-friendly versions of the field names.
+AVAILABLE_FIELD_NAMES_FRIENDLY = {"CALL":"Callsign",
+                                  "QSO_DATE":"Date",
+                                  "TIME_ON":"Time",
+                                  "FREQ":"Frequency (MHz)",
+                                  "BAND":"Band",
+                                  "MODE":"Mode",
+                                  "TX_PWR":"TX Power (W)",
+                                  "RST_SENT":"TX RST",
+                                  "RST_RCVD":"RX RST",
+                                  "QSL_SENT":"QSL Sent",
+                                  "QSL_RCVD":"QSL Received",
+                                  "NOTES":"Notes",
+                                  "NAME":"Name",
+                                  "ADDRESS":"Address",
+                                  "STATE":"State",
+                                  "COUNTRY":"Country",
+                                  "DXCC":"DXCC",
+                                  "CQZ":"CQ Zone",
+                                  "ITUZ":"ITU Zone",
+                                  "IOTA":"IOTA Designator"}
+
+# A: AwardList
+# B: Boolean
+# N: Number
+# S: String
+# I: International string
+# D: Date
+# T: Time
+# M: Multi-line string
+# G: Multi-line international string
+# L: Location
+DATA_TYPES = ["A", "B", "N", "S", "I", "D", "T", "M", "G", "L", "E"]
+
+ADIF_VERSION = "1.0"
+
+class ADIF:
+   """ The ADIF class supplies methods for reading, parsing, and writing log files in the Amateur Data Interchange Format (ADIF). For more information, visit http://adif.org/ """
+   
+   def __init__(self):
+      # Class for I/O of files using the Amateur Data Interchange Format (ADIF).
+      logging.debug("New ADIF instance created!")
+      
+   def read(self, path):
+      """ Read an ADIF file with a specified path (given in the 'path' argument), and then parse it.
+      The output is a list of dictionaries (one dictionary per QSO), with each dictionary containing field-value pairs,
+      e.g. {FREQ:145.500, BAND:2M, MODE:FM}. """
+      logging.debug("Reading in ADIF file with path: %s..." % path)
+
+      text = ""      
+      try:
+         f = open(path, 'r')
+         text = f.read()
+         f.close() # Close the file, otherwise "bad things" might happen!
+      except IOError as e:
+         logging.error("I/O error %d: %s" % (e.errno, e.strerror))
+      except:
+         logging.error("Unknown error occurred when reading the ADIF file.")
+
+      records = self._parse_adi(text)
+         
+      if(records == []):
+         logging.warning("No records found in the file. Empty file or wrong file type?")
+         
+      return records
+      
+   def _parse_adi(self, text):
+      """ Parse some raw text (defined in the 'text' argument) for ADIF field data.
+      Outputs a list of dictionaries (one dictionary per QSO). Each dictionary contains the field-value pairs,
+      e.g. {FREQ:145.500, BAND:2M, MODE:FM}. """
+
+      logging.debug("Parsing text from the ADIF file...")
+
+      records = []
+
+      # Separate the text at the <eor> or <eoh> markers.
+      tokens = re.split('(<eor>|<eoh>)', text, flags=re.IGNORECASE)
+      tokens.pop() # Anything after the final <eor> marker should be ignored.
+      
+      # The header might tell us the number of records, but let's not assume
+      # this and simply ignore it instead (if it exists).
+      if(re.search('<eoh>', text, flags=re.IGNORECASE) is not None):
+         # There is a header present, so let's ignore everything
+         # up to and including the <eoh> marker. Note that
+         # re.search has been used here to handle any case sensitivity.
+         # Previously we were checking for <eoh>. <EOH> is also valid
+         # but wasn't been detected before.
+         while len(tokens) > 0:
+            t = tokens.pop(0)
+            if(re.match('<eoh>', t, flags=re.IGNORECASE) is not None):
+               break
+            
+      n_eor = 0 
+      n_record = 0
+      records = []
+      for t in tokens:
+         if(re.match('<eor>', t, flags=re.IGNORECASE) is not None):
+            n_eor = n_eor + 1
+            continue
+         else:
+            n_record = n_record + 1
+            # Each record will have field names and corresponding
+            # data entries. Store this in a dictionary.
+            # Note: This is based on the code written by OK4BX.
+            # (http://web.bxhome.org/blog/ok4bx/2012/05/adif-parser-python)
+            fields_and_data_dictionary = {}
+            fields_and_data = re.findall('<(.*?):(\d*).*?>([^<\t\n\r\f\v\Z]+)', t)  
+            for fd in fields_and_data:
+               # Let's force all field names to be in upper case.
+               # This will help us later when comparing the field names
+               # against the available field names in the ADIF specification.
+               field_name = fd[0].upper()
+               field_data = fd[2][:int(fd[1])]
+
+               # Combo boxes are used later on and these are case sensitive,
+               # so adjust the field data accordingly.
+               if(field_name == "BAND"):
+                  field_data = field_data.lower()
+               elif(field_name == "MODE"):
+                  field_data = field_data.upper()
+
+               if(field_name in AVAILABLE_FIELD_NAMES_ORDERED):
+                  field_data_type = AVAILABLE_FIELD_NAMES_TYPES[field_name]
+                  if(self.is_valid(field_name, field_data, field_data_type)):
+                     # Only add the field if it is a standard ADIF field and it holds valid data.
+                     fields_and_data_dictionary[field_name] = field_data
+
+            records.append(fields_and_data_dictionary)
+      
+      assert n_eor == n_record
+
+      logging.debug("Finished parsing text.")
+      
+      return records
+
+      
+   def write(self, records, path):
+      """ Write an ADIF file containing all the QSOs in the 'records' list. The desired path is specified in the 'path' argument. 
+      This method returns None. """
+   
+      logging.debug("Writing records to an ADIF file...")
+      try:
+         f = open(path, 'w') # Open file for writing
+         
+         # First write a header containing program version, number of records, etc.
+         dt = datetime.now()
+         
+         f.write("""Amateur radio log file. Generated on %s. Contains %d record(s). 
+         
+<adif_ver:%d>%s
+<programid:5>PyQSO
+<programversion:3>0.1
+<eoh>\n""" % (dt, len(records), len(str(ADIF_VERSION)), ADIF_VERSION))
+         
+         # Then write each log to the file.
+         for r in records:
+            for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
+               if(not(field_name.lower() in r.keys() or field_name.upper() in r.keys())): 
+                  # If the field_name does not exist in the record, then skip past it.
+                  # Only write out the fields that exist and that have some data in them.
+                  continue
+               else:
+                  if( (r[field_name] != "NULL") and (r[field_name] != "") ):
+                     f.write("<%s:%d>%s\n" % (field_name.lower(), len(r[field_name]), r[field_name]))
+            f.write("<eor>\n")
+
+         logging.debug("Finished writing records to the ADIF file.")
+         f.close()
+
+      except IOError as e:
+         logging.error("I/O error %d: %s" % (e.errno, e.strerror))
+      except:
+         logging.error("Unknown error occurred when writing the ADIF file.")
+
+      return
+
+
+   def is_valid(self, field_name, data, data_type):
+      """ Validate the data in a field (with name 'field_name') with respect to the ADIF specification. 
+      This method returns either True or False to indicate whether the data is valid or not. """
+
+      logging.debug("Validating the following data in field '%s': %s" % (field_name, data))
+
+      # Allow an empty string, in case the user doesn't want
+      # to fill in this field.
+      if(data == ""):
+         return True
+
+      if(data_type == "N"):
+         # Allow a decimal point before and/or after any numbers,
+         # but don't allow a decimal point on its own.
+         m = re.match(r"-?(([0-9]+\.?[0-9]*)|([0-9]*\.?[0-9]+))", data)
+         if(m is None):
+            # Did not match anything.
+            return False
+         else:
+            # Make sure we match the whole string,
+            # otherwise there may be an invalid character after the match. 
+            return (m.group(0) == data)
+      
+      elif(data_type == "B"):
+         # Boolean
+         m = re.match(r"(Y|N)", data)
+         if(m is None):
+            return False
+         else:
+            return (m.group(0) == data)
+
+      elif(data_type == "D"):
+         # Date
+         pattern = re.compile(r"([0-9]{4})")
+         m_year = pattern.match(data, 0)
+         if((m_year is None) or (int(m_year.group(0)) < 1930)):
+            # Did not match anything.
+            return False
+         else:
+            pattern = re.compile(r"([0-9]{2})")
+            m_month = pattern.match(data, 4)
+            if((m_month is None) or int(m_month.group(0)) > 12 or int(m_month.group(0)) < 1):
+               # Did not match anything.
+               return False
+            else:
+               pattern = re.compile(r"([0-9]{2})")
+               m_day = pattern.match(data, 6)
+               days_in_month = calendar.monthrange(int(m_year.group(0)), int(m_month.group(0)))
+               if((m_day is None) or int(m_day.group(0)) > days_in_month[1] or int(m_day.group(0)) < 1):
+                  # Did not match anything.
+                  return False
+               else:
+                  # Make sure we match the whole string,
+                  # otherwise there may be an invalid character after the match. 
+                  return (len(data) == 8)
+
+      elif(data_type == "T"):
+         # Time
+         pattern = re.compile(r"([0-9]{2})")
+         m_hour = pattern.match(data, 0)
+         if((m_hour is None) or (int(m_hour.group(0)) < 0) or (int(m_hour.group(0)) > 23)):
+            # Did not match anything.
+            return False
+         else:
+            pattern = re.compile(r"([0-9]{2})")
+            m_minutes = pattern.match(data, 2)
+            if((m_minutes is None) or int(m_minutes.group(0)) < 0 or int(m_minutes.group(0)) > 59):
+               # Did not match anything.
+               return False
+            else:
+               if(len(data) == 4):
+                  # HHMM format
+                  return True
+               pattern = re.compile(r"([0-9]{2})")
+               m_seconds = pattern.match(data, 4)
+               if((m_seconds is None) or int(m_seconds.group(0)) < 0 or int(m_seconds.group(0)) > 59):
+                  # Did not match anything.
+                  return False
+               else:
+                  # Make sure we match the whole string,
+                  # otherwise there may be an invalid character after the match. 
+                  return (len(data) == 6) # HHMMSS format
+
+      #FIXME: Need to make sure that the "S" and "M" data types accept ASCII-only characters
+      # in the range 32-126 inclusive.
+      elif(data_type == "S"):
+         # String
+         m = re.match(r"(.+)", data)
+         if(m is None):
+            return False
+         else:
+            return (m.group(0) == data)
+
+      elif(data_type == "I"):
+         # IntlString
+         m = re.match(ur"(.+)", data, re.UNICODE)
+         if(m is None):
+            return False
+         else:
+            return (m.group(0) == data)
+
+      elif(data_type == "G"):
+         # IntlMultilineString
+         m = re.match(ur"(.+(\r\n)*.*)", data, re.UNICODE)
+         if(m is None):
+            return False
+         else:
+            return (m.group(0) == data)
+
+      elif(data_type == "M"):
+         # MultilineString
+         #m = re.match(r"(.+(\r\n)*.*)", data)
+         #if(m is None):
+         #   return False
+         #else:
+         #   return (m.group(0) == data)
+         return True
+
+      elif(data_type == "L"):
+         # Location
+         pattern = re.compile(r"([EWNS]{1})", re.IGNORECASE)
+         m_directional = pattern.match(data, 0)
+         if(m_directional is None):
+            # Did not match anything.
+            return False
+         else:
+            pattern = re.compile(r"([0-9]{3})")
+            m_degrees = pattern.match(data, 1)
+            if((m_degrees is None) or int(m_degrees.group(0)) < 0 or int(m_degrees.group(0)) > 180):
+               # Did not match anything.
+               return False
+            else:
+               pattern = re.compile(r"([0-9]{2}\.[0-9]{3})")
+               m_minutes = pattern.match(data, 4)
+               if((m_minutes is None) or float(m_minutes.group(0)) < 0 or float(m_minutes.group(0)) > 59.999):
+                  # Did not match anything.
+                  return False
+               else:
+                  # Make sure we match the whole string,
+                  # otherwise there may be an invalid character after the match. 
+                  return (len(data) == 10)
+
+
+      elif(data_type == "E" or data_type == "A"):
+         # Enumeration, AwardList.
+         if(field_name == "MODE"):
+            modes = ["", "AM", "AMTORFEC", "ASCI", "ATV", "CHIP64", "CHIP128", "CLO", "CONTESTI", "CW", "DSTAR", "DOMINO", "DOMINOF", "FAX", "FM", "FMHELL", "FSK31", "FSK441", "GTOR", "HELL", "HELL80", "HFSK", "ISCAT", "JT44", "JT4A", "JT4B", "JT4C", "JT4D", "JT4E", "JT4F", "JT4G", "JT65", "JT65A", "JT65B", "JT65C", "JT6M", "MFSK8", "MFSK16", "MT63", "OLIVIA", "PAC", "PAC2", "PAC3", "PAX", "PAX2", "PCW", "PKT", "PSK10", "PSK31", "PSK63", "PSK63F", "PSK125", "PSKAM10", "PSKAM31", "PSKAM50 [...]
+            return (data in modes)
+         elif(field_name == "BAND"):
+            bands = ["", "2190m", "560m", "160m", "80m", "60m", "40m", "30m", "20m", "17m", "15m", "12m", "10m", "6m", "4m", "2m", "1.25m", "70cm", "33cm", "23cm", "13cm", "9cm", "6cm", "3cm", "1.25cm", "6mm", "4mm", "2.5mm", "2mm", "1mm"]
+            return (data in bands)
+         else:
+            return True
+
+      else:
+         return True
+      
+   
+class TestADIF(unittest.TestCase):
+
+   def setUp(self):
+      self.adif = ADIF()
+
+   def test_adif_read(self):
+      f = open("ADIF.test_read.adi", 'w')
+      f.write("""Some test ADI data.<eoh>
+
+<call:4>TEST<band:3>40m<mode:2>CW
+<qso_date:8:d>20130322<time_on:4>1955<eor>""")
+      f.close()
+    
+      records = self.adif.read("ADIF.test_read.adi")
+      expected_records = [{'TIME_ON': '1955', 'BAND': '40m', 'CALL': 'TEST', 'MODE': 'CW', 'QSO_DATE': '20130322'}]
+      print "Imported records: ", records
+      print "Expected records: ", expected_records
+      assert(len(records) == 1)
+      assert(len(records[0].keys()) == len(expected_records[0].keys()))
+      assert(records == expected_records)
+
+   def test_adif_write(self):
+      records = [{"CALL":"TEST123", "QSO_DATE":"20120402", "TIME_ON":"1234", "FREQ":"145.500", "BAND":"2m", "MODE":"FM", "RST_SENT":"59", "RST_RCVD":"59"},
+                 {"CALL":"TEST123", "QSO_DATE":"20130312", "TIME_ON":"0101", "FREQ":"145.750", "BAND":"2m", "MODE":"FM"}]
+      self.adif.write(records, "ADIF.test_write.adi")
+
+      f = open("ADIF.test_write.adi", 'r')
+      text = f.read()
+      print "File 'ADIF.test_write.adi' contains the following text:", text
+      assert("""        
+<adif_ver:3>1.0
+<programid:5>PyQSO
+<programversion:3>0.1
+<eoh>
+<call:7>TEST123
+<qso_date:8>20120402
+<time_on:4>1234
+<freq:7>145.500
+<band:2>2m
+<mode:2>FM
+<rst_sent:2>59
+<rst_rcvd:2>59
+<eor>
+<call:7>TEST123
+<qso_date:8>20130312
+<time_on:4>0101
+<freq:7>145.750
+<band:2>2m
+<mode:2>FM
+<eor>
+""" in text) # Ignore the header line here, since it contains the date and time the ADIF file was written, which will change each time 'make unittest' is run.
+      f.close()
+
+   def test_adif_write_sqlite3_Row(self):
+      import sqlite3
+      self.connection = sqlite3.connect("./unittest_resources/test.db")
+      self.connection.row_factory = sqlite3.Row
+
+      c = self.connection.cursor()
+      c.execute("SELECT * FROM test")
+      records = c.fetchall()
+      print records
+
+      self.adif.write(records, "ADIF.test_write_sqlite3_Row.adi")
+
+      f = open("ADIF.test_write_sqlite3_Row.adi", 'r')
+      text = f.read()
+      print "File 'ADIF.test_write_sqlite3_Row.adi' contains the following text:", text
+      assert("""        
+<adif_ver:3>1.0
+<programid:5>PyQSO
+<programversion:3>0.1
+<eoh>
+<call:7>TEST123
+<qso_date:8>20120402
+<time_on:4>1234
+<freq:7>145.500
+<band:2>2m
+<mode:2>FM
+<rst_sent:2>59
+<rst_rcvd:2>59
+<eor>
+<call:7>TEST456
+<qso_date:8>20130312
+<time_on:4>0101
+<freq:7>145.750
+<band:2>2m
+<mode:2>FM
+<eor>
+""" in text) # Ignore the header line here, since it contains the date and time the ADIF file was written, which will change each time 'make unittest' is run.
+      f.close()
+
+      self.connection.close()
+
+   def test_adif_is_valid(self):
+      assert(self.adif.is_valid("CALL", "TEST123", "S") == True)
+      assert(self.adif.is_valid("QSO_DATE", "20120402", "D") == True)
+      assert(self.adif.is_valid("TIME_ON", "1230", "T") == True)
+      assert(self.adif.is_valid("TX_PWR", "5", "N") == True)
+
+if(__name__ == '__main__'):
+   unittest.main()
+
diff --git a/pyqso/auxiliary_dialogs.py b/pyqso/auxiliary_dialogs.py
new file mode 100644
index 0000000..cea12c3
--- /dev/null
+++ b/pyqso/auxiliary_dialogs.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python 
+# File: auxiliary_dialogs.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+
+def error(parent, message):
+   """ Display an error message. """
+   logging.error(message)
+   dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
+                               Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, message)
+   dialog.run()
+   dialog.destroy()
+   return
+
+def info(parent, message):
+   """ Display some information. """
+   logging.debug(message)
+   dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
+                               Gtk.MessageType.INFO, Gtk.ButtonsType.OK, message)
+   dialog.run()
+   dialog.destroy()
+   return
+   
+def question(parent, message):
+   """ Ask the user a question. The dialog comes with 'Yes' and 'No' response buttons. """
+   dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
+                              Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, 
+                              message)
+   response = dialog.run()
+   dialog.destroy()
+   return response
diff --git a/pyqso/awards.py b/pyqso/awards.py
new file mode 100644
index 0000000..41d4c3a
--- /dev/null
+++ b/pyqso/awards.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+# File: awards.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+
+class Awards(Gtk.VBox):
+   """ A tool for tracking progress towards an award. Currently this only supports the DXCC award. For more information visit http://www.arrl.org/dxcc """
+   
+   def __init__(self, parent):
+      """ Set up a table for progress tracking purposes. """
+      #TODO: This only considers the DXCC award for now.
+      logging.debug("New Awards instance created!")
+         
+      Gtk.VBox.__init__(self, spacing=2)
+
+      self.parent = parent
+
+      self.bands = ["70cm", "2m", "6m", "10m", "12m", "15m", "17m", "20m", "30m", "40m", "80m", "160m"]
+      self.modes = ["Phone", "CW", "Digital", "Mixed"]
+      
+      data_types = [str] + [int]*len(self.bands)
+      self.awards = Gtk.ListStore(*data_types)
+
+      # The main table for the awards
+      self.treeview = Gtk.TreeView(self.awards)
+      # A separate, empty column just for the mode names
+      renderer = Gtk.CellRendererText()
+      column = Gtk.TreeViewColumn("Modes", renderer, text=0)
+      column.set_clickable(False)
+      self.treeview.append_column(column)
+      # Now for all the bands...
+      logging.debug("Initialising the columns in the awards table.")
+      for i in range(0, len(self.bands)):
+         renderer = Gtk.CellRendererText()
+         column = Gtk.TreeViewColumn(self.bands[i], renderer, text=i+1)
+         column.set_min_width(40)
+         column.set_clickable(False)
+         self.treeview.append_column(column)
+
+      # Add a label to inform the user that this only considers the DXCC award for now.
+      label = Gtk.Label(halign=Gtk.Align.START)
+      label.set_markup("<span size=\"x-large\">%s</span>" % "DXCC Award")
+      self.pack_start(label, False, False, 4)
+      # Show the table in the Awards tab
+      self.add(self.treeview)
+      self.show_all()
+
+      logging.debug("Awards table set up successfully.") 
+
+      self.count()
+
+      return
+
+   def count(self):
+      """ Update the table for progress tracking. """
+      logging.debug("Counting the band/mode combinations for the awards table...")
+      # Wipe everything and start again
+      self.awards.clear()
+      # For each mode, add a new list for holding the totals, and initialise the values to zero.
+      count = []
+      for i in range(0, len(self.bands)):
+         count.append([0]*len(self.bands))
+
+      for log in self.parent.logbook.logs:
+         records = log.get_all_records()
+         if(records is not None):
+            for r in records:
+               if(r["BAND"] is not None and r["MODE"] is not None):
+                  if(r["BAND"].lower() in self.bands and r["MODE"] != ""):
+                     band = self.bands.index(r["BAND"].lower())
+                     # Phone modes
+                     if(r["MODE"].upper() in ["FM", "AM", "SSB", "SSTV"]):
+                        count[0][band] += 1
+                     elif(r["MODE"].upper() == "CW"):
+                        count[1][band] += 1
+                     else: 
+                        #FIXME: This assumes that all the other modes in the ADIF list are digital modes. Is this the case?
+                        count[2][band] += 1
+                     count[3][band] += 1 # Keep the total of each column in the "Mixed" mode
+         else:
+            logging.error("Could not update the awards table for '%s' because of a database error." % log.name)
+      # Insert the rows containing the totals
+      for i in range(0, len(self.modes)):
+         self.awards.append([self.modes[i]] + count[i])
+      logging.debug("Awards table updated.") 
+      return
+
diff --git a/pyqso/callsign_lookup.py b/pyqso/callsign_lookup.py
new file mode 100644
index 0000000..833003d
--- /dev/null
+++ b/pyqso/callsign_lookup.py
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+# File: callsign_lookup.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+import httplib
+from xml.dom import minidom
+
+from auxiliary_dialogs import *
+
+class CallsignLookup():
+   """ Uses qrz.com to lookup details about a particular callsign. """
+
+   def __init__(self, parent):
+      self.parent = parent
+      self.connection = None
+      self.session_key = None
+      logging.debug("New CallsignLookup instance created!")
+      return
+
+   def connect(self, username, password):
+      """ Initiate a session with the qrz.com server. Hopefully this will return a session key. """
+      logging.debug("Connecting to the qrz.com server...")
+      self.connection = httplib.HTTPConnection('xmldata.qrz.com')
+      request = '/xml/current/?username=%s;password=%s;agent=pyqso' % (username, password)
+      self.connection.request('GET', request)
+      response = self.connection.getresponse()
+
+      xml_data = minidom.parseString(response.read())
+      session_node = xml_data.getElementsByTagName('Session')[0] # There should only be one Session element
+      session_key_node = session_node.getElementsByTagName('Key')
+      if(len(session_key_node) > 0):
+         self.session_key = session_key_node[0].firstChild.nodeValue
+         logging.debug("Successfully connected to the qrz.com server...")
+         connected = True
+      else:
+         connected = False
+
+      # If there are any errors or warnings, print them out
+      session_error_node = session_node.getElementsByTagName('Error')
+      if(len(session_error_node) > 0):
+         session_error = session_error_node[0].firstChild.nodeValue
+         error(parent=self.parent, message=session_error)
+         logging.error(session_error)
+
+      return connected
+
+   def lookup(self, callsign):
+      """ Parse the XML tree that is returned from the qrz.com XML server to obtain the NAME, ADDRESS, STATE, COUNTRY, DXCC, CQZ, ITUZ, and IOTA field data (if present),
+      and return the data in the dictionary called fields_and_data. """
+      logging.debug("Performing a callsign lookup...")
+      fields_and_data = {"NAME":"", "ADDRESS":"", "STATE":"", "COUNTRY":"", "DXCC":"", "CQZ":"", "ITUZ":"", "IOTA":""}
+      if(self.session_key):
+         request = '/xml/current/?s=%s;callsign=%s' % (self.session_key, callsign)
+         self.connection.request('GET', request)
+         response = self.connection.getresponse()
+
+         xml_data = minidom.parseString(response.read())
+         callsign_node = xml_data.getElementsByTagName('Callsign')
+         if(len(callsign_node) > 0): 
+            callsign_node = callsign_node[0] # There should only be a maximum of one Callsign element
+
+            callsign_fname_node = callsign_node.getElementsByTagName('fname')
+            callsign_name_node = callsign_node.getElementsByTagName('name')
+            if(len(callsign_fname_node) > 0):
+               fields_and_data["NAME"] = callsign_fname_node[0].firstChild.nodeValue
+            if(len(callsign_name_node) > 0): # Add the surname, if present
+               fields_and_data["NAME"] = fields_and_data["NAME"] + " " + callsign_name_node[0].firstChild.nodeValue
+
+            callsign_addr1_node = callsign_node.getElementsByTagName('addr1')
+            callsign_addr2_node = callsign_node.getElementsByTagName('addr2')
+            if(len(callsign_addr1_node) > 0):
+               fields_and_data["ADDRESS"] = callsign_addr1_node[0].firstChild.nodeValue
+            if(len(callsign_addr2_node) > 0): # Add the second line of the address, if present
+               fields_and_data["ADDRESS"] = fields_and_data["ADDRESS"] + ", " + callsign_addr2_node[0].firstChild.nodeValue
+
+            callsign_state_node = callsign_node.getElementsByTagName('state')
+            if(len(callsign_state_node) > 0):
+               fields_and_data["STATE"] = callsign_state_node[0].firstChild.nodeValue
+
+            callsign_country_node = callsign_node.getElementsByTagName('country')
+            if(len(callsign_country_node) > 0):
+               fields_and_data["COUNTRY"] = callsign_country_node[0].firstChild.nodeValue
+
+            callsign_ccode_node = callsign_node.getElementsByTagName('ccode')
+            if(len(callsign_ccode_node) > 0):
+               fields_and_data["DXCC"] = callsign_ccode_node[0].firstChild.nodeValue
+
+            callsign_cqzone_node = callsign_node.getElementsByTagName('cqzone')
+            if(len(callsign_cqzone_node) > 0):
+               fields_and_data["CQZ"] = callsign_cqzone_node[0].firstChild.nodeValue
+
+            callsign_ituzone_node = callsign_node.getElementsByTagName('ituzone')
+            if(len(callsign_ituzone_node) > 0):
+               fields_and_data["ITUZ"] = callsign_ituzone_node[0].firstChild.nodeValue
+
+            callsign_iota_node = callsign_node.getElementsByTagName('iota')
+            if(len(callsign_iota_node) > 0):
+               fields_and_data["IOTA"] = callsign_iota_node[0].firstChild.nodeValue
+         else:
+            # If there is no Callsign element, then print out the error message in the Session element
+            session_node = xml_data.getElementsByTagName('Session')
+            if(len(session_node) > 0): 
+               session_error_node = session_node.getElementsByTagName('Error')
+               if(len(session_error_node) > 0):
+                  session_error = session_error_node[0].firstChild.nodeValue
+                  error(parent=self.parent, message=session_error)
+            # Return empty strings for the field data
+         logging.debug("Callsign lookup complete. Returning data...")
+      return fields_and_data
+
diff --git a/pyqso/dx_cluster.py b/pyqso/dx_cluster.py
new file mode 100644
index 0000000..16324a5
--- /dev/null
+++ b/pyqso/dx_cluster.py
@@ -0,0 +1,180 @@
+#!/usr/bin/env python
+# File: dx_cluster.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+import os
+import os.path
+import sys
+import telnetlib
+
+from pyqso.telnet_connection_dialog import *
+
+class DXCluster(Gtk.VBox):
+   """ A tool for connecting to a DX cluster (specifically Telnet-based DX clusters). """
+   
+   def __init__(self, parent):
+      """ Set up the DX cluster's Gtk.VBox, and set up a timer so that PyQSO can retrieve new data from the Telnet server every few seconds. """
+      logging.debug("Setting up the DX cluster...") 
+      Gtk.VBox.__init__(self, spacing=2)
+
+      self.connection = None
+      self.parent = parent
+
+      # Set up the toolbar
+      self.toolbar = Gtk.HBox(spacing=2)
+      self.buttons = {}
+      # Connect
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_CONNECT, Gtk.IconSize.BUTTON)
+      button = Gtk.Button()
+      button.add(icon)
+      button.set_tooltip_text('Connect to Telnet Server')
+      button.connect("clicked", self.telnet_connect)
+      self.toolbar.pack_start(button, False, False, 0)
+      self.buttons["CONNECT"] = button
+
+      # Disconnect
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_DISCONNECT, Gtk.IconSize.BUTTON)
+      button = Gtk.Button()
+      button.add(icon)
+      button.set_tooltip_text('Disconnect from Telnet Server')
+      button.connect("clicked", self.telnet_disconnect)
+      self.toolbar.pack_start(button, False, False, 0)
+      self.buttons["DISCONNECT"] = button
+
+      self.toolbar.pack_start(Gtk.SeparatorToolItem(), False, False, 0)
+
+      self.command = Gtk.Entry()
+      self.toolbar.pack_start(self.command, False, False, 0)
+      self.send = Gtk.Button("Send Command")
+      self.send.connect("clicked", self.telnet_send_command)
+      self.toolbar.pack_start(self.send, False, False, 0)
+
+      self.pack_start(self.toolbar, False, False, 0)
+
+      # A TextView object to display the output from the Telnet server.
+      self.renderer = Gtk.TextView()
+      self.renderer.set_editable(False)
+      self.renderer.set_cursor_visible(False)
+      sw = Gtk.ScrolledWindow()
+      sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+      sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+      sw.add(self.renderer)
+      self.buffer = self.renderer.get_buffer()
+      self.pack_start(sw, True, True, 0)
+
+      self.set_connect_button_sensitive(True)
+
+      self.show_all()
+
+      logging.debug("DX cluster ready!") 
+
+      return
+
+   def telnet_connect(self, widget=None):
+      """ Connect to a user-specified Telnet server, with the host and login details specified in the Gtk.Entry boxes in the TelnetConnectionDialog. """
+      dialog = TelnetConnectionDialog(self.parent)
+      response = dialog.run()
+      if(response == Gtk.ResponseType.OK):
+         connection_info = dialog.get_connection_info()
+         host = connection_info["HOST"].get_text()
+         port = connection_info["PORT"].get_text()
+         username = connection_info["USERNAME"].get_text()
+         password = connection_info["PASSWORD"].get_text()
+         dialog.destroy()
+      else:
+         dialog.destroy()
+         return
+
+      if(host == ""):
+         logging.error("No Telnet server specified.")
+         return
+      if(port == ""):
+         port = 23 # The default Telnet port
+      else:
+         port = int(port)
+
+      try:
+         self.connection = telnetlib.Telnet(host, port)
+
+         if(username):
+            self.connection.read_until("login: ")
+            self.connection.write(username + "\n")
+         if(password):
+            self.connection.read_until("password: ")
+            self.connection.write(password + "\n")
+      except:
+         logging.exception("Could not create a connection to the Telnet server")
+         self.connection = None
+         return
+
+      self.set_connect_button_sensitive(False)
+
+      self.check_io_event = GObject.timeout_add(1000, self._on_telnet_io)
+
+      return
+
+   def telnet_disconnect(self, widget=None):
+      """ Disconnect from a Telnet server and remove the I/O timer. """
+      if(self.connection):
+         self.connection.close()
+      self.buffer.set_text("")
+      self.connection = None
+      self.set_connect_button_sensitive(True)
+      GObject.source_remove(self.check_io_event)
+      return
+
+   def telnet_send_command(self, widget=None):
+      """ Send the user-specified command in the Gtk.Entry box to the Telnet server (if PyQSO is connected to one). """
+      if(self.connection):
+         self.connection.write(self.command.get_text() + "\n")
+         self.command.set_text("")
+      return
+
+   def _on_telnet_io(self):
+      """ Retrieve any new data from the Telnet server and print it out in the Gtk.TextView widget. Always returns True to satisfy the GObject timer. """
+      if(self.connection):
+         text = self.connection.read_very_eager()
+         text = text.replace(u"\u0007", "") # Remove the BEL Unicode character from the end of the line
+
+         # Allow auto-scrolling to the new text entry if the focus is already at
+         # the very end of the Gtk.TextView. Otherwise, don't auto-scroll
+         # in case the user is reading something further up.
+         # Note: This is based on the code from http://forums.gentoo.org/viewtopic-t-445598-view-next.html
+         end_iter = self.buffer.get_end_iter()
+         end_mark = self.buffer.create_mark(None, end_iter)
+         self.renderer.move_mark_onscreen(end_mark)
+         at_end = self.buffer.get_iter_at_mark(end_mark).equal(end_iter)
+         self.buffer.insert(end_iter, text)
+         if(at_end):
+            end_mark = self.buffer.create_mark(None, end_iter)
+            self.renderer.scroll_mark_onscreen(end_mark) 
+
+      return True
+
+   def set_connect_button_sensitive(self, sensitive):
+      """ Enable/disable the relevant buttons for connecting/disconnecting from a DX cluster, so that users cannot click the connect button if PyQSO is already connected. """
+      self.buttons["CONNECT"].set_sensitive(sensitive)
+      self.buttons["DISCONNECT"].set_sensitive(not sensitive)
+      self.send.set_sensitive(not sensitive)
+      return
+
diff --git a/pyqso/grey_line.py b/pyqso/grey_line.py
new file mode 100644
index 0000000..5aff836
--- /dev/null
+++ b/pyqso/grey_line.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# File: grey_line.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+from datetime import datetime
+try:
+   import numpy
+   import matplotlib
+   matplotlib.rcParams['font.size'] = 10.0
+   from mpl_toolkits.basemap import Basemap
+   from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
+   have_necessary_modules = True
+except ImportError:
+   logging.error("Could not import a non-standard Python module needed by the GreyLine class. Check that all the PyQSO dependencies are satisfied.")
+   have_necessary_modules = False
+
+class GreyLine(Gtk.VBox):
+   """ A tool for visualising the grey line. """
+   
+   def __init__(self, parent):
+      """ Set up the drawing canvas and the timer which will re-plot the grey line every 30 minutes. """
+      logging.debug("Setting up the grey line...") 
+      Gtk.VBox.__init__(self, spacing=2)
+      self.parent = parent
+
+      if(have_necessary_modules):
+         self.fig = matplotlib.figure.Figure()
+         self.canvas = FigureCanvas(self.fig) # For embedding in the Gtk application
+         self.pack_start(self.canvas, True, True, 0)
+         self.refresh_event = GObject.timeout_add(1800000, self.draw) # Re-draw the grey line automatically after 30 minutes (if the grey line tool is visible).
+
+      self.show_all()
+
+      logging.debug("Grey line ready!") 
+
+      return
+
+   def draw(self):
+      """ Draw the world map and the grey line on top of it. This method always returns True to satisfy the GObject timer. """
+
+      if(have_necessary_modules):
+         if(self.parent.toolbox.tools.get_current_page() != 1 or not self.parent.toolbox.get_visible()):
+            # Don't re-draw if the grey line is not visible.
+            return True # We need to return True in case this is method was called by a timer event.
+         else:
+            logging.debug("Drawing the grey line...") 
+            # Re-draw the grey line
+            self.fig.clf()
+            sub = self.fig.add_subplot(111)
+
+            # Draw the map of the world. This is based on the example from:
+            # http://matplotlib.org/basemap/users/examples.html
+            m = Basemap(projection='mill', lon_0=0, ax=sub, resolution='c', fix_aspect=False)
+            m.drawcountries(linewidth=0.5)
+            m.drawcoastlines(linewidth=0.5)
+            m.drawparallels(numpy.arange(-90, 90, 30), labels=[1, 0, 0, 0])
+            m.drawmeridians(numpy.arange(m.lonmin, m.lonmax+30, 60), labels=[0, 0, 0, 1])
+            m.drawmapboundary(fill_color='lightblue')
+            m.fillcontinents(color='darkgreen', lake_color='lightblue')
+            m.nightshade(datetime.utcnow()) # Add in the grey line using UTC time. Note that this requires NetCDF.
+            logging.debug("Grey line drawn.") 
+            return True
+      else:
+         return False # Don't try to re-draw the canvas if the necessary modules to do so could not be imported.
+
diff --git a/pyqso/log.py b/pyqso/log.py
new file mode 100644
index 0000000..954375f
--- /dev/null
+++ b/pyqso/log.py
@@ -0,0 +1,377 @@
+#!/usr/bin/env python 
+# File: log.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+from os.path import basename
+import logging
+import sqlite3 as sqlite
+import unittest
+
+from adif import AVAILABLE_FIELD_NAMES_TYPES, AVAILABLE_FIELD_NAMES_ORDERED
+from record_dialog import *
+
+class Log(Gtk.ListStore):
+   """ A Log object can store multiple Record objects. """
+   
+   def __init__(self, connection, name):
+
+      # The ListStore constructor needs to know the data types of the columns.
+      # The index is always an integer. We will assume the fields are strings.
+      data_types = [int] + [str]*len(AVAILABLE_FIELD_NAMES_ORDERED)    
+      # Call the constructor of the super class (Gtk.ListStore)
+      Gtk.ListStore.__init__(self, *data_types)
+
+      self.connection = connection
+      self.name = name
+      
+      logging.debug("New Log instance created!")
+      return
+
+   def populate(self):
+      """ Remove everything in the Gtk.ListStore that is rendered already (via the TreeView), and start afresh. """
+
+      logging.debug("Populating '%s'..." % self.name)
+      self.add_missing_db_columns()
+      self.clear()
+      records = self.get_all_records()
+      if(records is not None):
+         for r in records:
+            liststore_entry = [r["id"]]
+            for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
+               # Note: r may contain column names that are not in AVAILABLE_FIELD_NAMES_ORDERED, 
+               # so we need to loop over and only select those that are, since the ListStore will
+               # expect a specific number of columns.
+               liststore_entry.append(r[field_name])
+            self.append(liststore_entry)
+         logging.debug("Finished populating '%s'." % self.name)
+      else:
+         logging.error("Could not populate '%s' because of a database error." % self.name)
+      return
+
+   def add_missing_db_columns(self):
+      """ Check whether each field name in AVAILABLE_FIELD_NAMES_ORDERED is in the database table. If not, add it
+      (with all entries being set to an empty string initially). """
+      logging.debug("Adding any missing database columns...")
+
+      # Get all the column names in the current database table.
+      column_names = []
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            c.execute("PRAGMA table_info(%s)" % self.name) 
+            result = c.fetchall()
+         for t in result:
+            column_names.append(t[1].upper())
+      except (sqlite.Error, IndexError) as e:
+         logging.exception(e)
+         logging.error("Could not obtain the database column names.")
+         return
+
+      for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
+         if(not(field_name in column_names)):
+            try:
+               with self.connection:
+                  c.execute("ALTER TABLE %s ADD COLUMN %s TEXT DEFAULT \"\"" % (self.name, field_name.lower()))
+            except sqlite.Error as e:
+               logging.exception(e)
+               logging.error("Could not add the missing database column '%s'." % field_name)
+               pass
+      logging.debug("Finished adding any missing database columns.")
+      return
+
+   def add_record(self, fields_and_data):
+      """ Add a record comprising data given in the 'fields_and_data' argument to the log. """
+      logging.debug("Adding record to log...")
+      liststore_entry = []
+      field_names = AVAILABLE_FIELD_NAMES_ORDERED
+      for i in range(0, len(field_names)):
+         if(field_names[i] in fields_and_data.keys()):
+            liststore_entry.append(fields_and_data[field_names[i]])
+         else:
+            liststore_entry.append("")
+
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            # What if the database columns are not necessarily in the same order as (or even exist in) AVAILABLE_FIELD_NAMES_ORDERED?
+            # PyQSO handles this here, but needs a separate list (called database_entry) to successfully perform the SQL query.
+            database_entry = []
+            c.execute("PRAGMA table_info(%s)" % self.name) # Get all the column names in the current database table.
+            column_names = c.fetchall()
+            query = "INSERT INTO %s VALUES (NULL" % self.name
+            for t in column_names:
+               # 't' here is a tuple
+               column_name = str(t[1])
+               if( (column_name.upper() in AVAILABLE_FIELD_NAMES_ORDERED) and (column_name.upper() in fields_and_data.keys()) ):
+                  database_entry.append(fields_and_data[column_name.upper()])
+                  query = query + ",?"
+               else:
+                  if(column_name != "id"): # Ignore the row index field. This is a special case since it's not in AVAILABLE_FIELD_NAMES_ORDERED.
+                     query = query + ",\"\""
+            query = query + ")"
+            c.execute(query, database_entry)
+            index = c.lastrowid
+
+         liststore_entry.insert(0, index) # Add the record's index.
+         self.append(liststore_entry)
+         logging.debug("Successfully added the record to the log.")
+      except (sqlite.Error, IndexError) as e:
+         logging.exception(e)
+         logging.error("Could not add the record to the log.")
+      return
+
+   def delete_record(self, index, iter=None):
+      """ Delete a record with a specific index in the SQL database. The corresponding record is also deleted from the Gtk.ListStore data structure. Note that iter should always be given. It is given a default value of None for unit testing purposes only. """
+      logging.debug("Deleting record from log...")
+      # Get the selected row in the logbook
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            query = "DELETE FROM %s" % self.name
+            c.execute(query+" WHERE id=?", [index])
+         if(iter is not None):
+            self.remove(iter)
+         logging.debug("Successfully deleted the record from the log.")
+      except (sqlite.Error, IndexError) as e:
+         logging.exception(e)
+         logging.error("Could not delete the record from the log.")
+      return
+
+   def edit_record(self, index, field_name, data, iter=None, column_index=None):
+      """ Edit a specified record by replacing the data in the field 'field_name' with the data given in the argument called 'data'. Note that both iter and column_index should always be given. These are given default values of None for unit testing purposes only. """
+      logging.debug("Editing field '%s' in record %d..." % (field_name, index))
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            query = "UPDATE %s SET %s" % (self.name, field_name)
+            query = query + "=? WHERE id=?"
+            c.execute(query, [data, index]) # First update the SQL database...
+         if(iter is not None and column_index is not None):
+            self.set(iter, column_index, data) # ...and then the ListStore.
+         logging.debug("Successfully edited field '%s' in record %d in the log." % (field_name, index))
+      except (sqlite.Error, IndexError) as e:
+         logging.exception(e)
+         logging.error("Could not edit field %s in record %d in the log." % (field_name, index))
+      return
+
+   def remove_duplicates(self):
+      """ Find the duplicates in the log, based on the CALL, QSO_DATE, TIME_ON, FREQ and MODE fields. Return a tuple containing the number of duplicates in the log, and the number of duplicates successfully removed. Hopefully these will be the same. """
+      duplicates = []
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            c.execute(
+   """SELECT rowid FROM %s WHERE rowid NOT IN
+   (
+   SELECT MIN(rowid) FROM %s GROUP BY call, qso_date, time_on, freq, mode
+   )""" % (self.name, self.name))
+            result = c.fetchall()
+         for rowid in result:
+            duplicates.append(rowid[0]) # Get the integer from inside the tuple.
+         if(len(duplicates) == 0):
+            return (0, 0) # Nothing to do here.
+      except (sqlite.Error, IndexError) as e:
+         logging.exception(e)
+         return (0, 0)
+
+      removed = 0 # Count the number of records that are removed. Hopefully this will be the same as len(duplicates).
+      path = Gtk.TreePath(0) # Start with the first row in the log.
+      iter = self.get_iter(path)
+      while iter is not None:
+         row_index = self.get_value(iter, 0) # Get the index.
+         if(row_index in duplicates): # Is this a duplicate row? If so, delete it.
+            self.delete_record(row_index, iter)
+            removed += 1
+         iter = self.iter_next(iter) # Move on to the next row, until iter_next returns None.
+
+      assert(len(duplicates) == removed)
+      return (len(duplicates), removed)
+
+   def get_record_by_index(self, index):
+      """ Return a record with a given index in the log. The record is represented by a dictionary of field-value pairs. """
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            query = "SELECT * FROM %s WHERE id=?" % self.name
+            c.execute(query, [index])
+            return c.fetchone()
+      except sqlite.Error as e:
+         logging.exception(e)
+         return None
+
+   def get_all_records(self):
+      """ Return a list of all the records in the log. Each record is represented by a dictionary. """
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            c.execute("SELECT * FROM %s" % self.name)
+            return c.fetchall()
+      except sqlite.Error as e:
+         logging.exception(e)
+         return None
+
+   def get_number_of_records(self):
+      """ Return the total number of records in the log. """
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            c.execute("SELECT Count(*) FROM %s" % self.name)
+            return c.fetchone()[0]
+      except (sqlite.Error, IndexError) as e:
+         logging.exception(e)
+         return None
+
+class TestLog(unittest.TestCase):
+
+   def setUp(self):
+      self.connection = sqlite.connect(":memory:")
+      self.connection.row_factory = sqlite.Row
+
+      self.field_names = ["CALL", "QSO_DATE", "TIME_ON", "FREQ", "BAND", "MODE", "RST_SENT", "RST_RCVD"]
+      self.fields_and_data = {"CALL":"TEST123", "QSO_DATE":"20130312", "TIME_ON":"1234", "FREQ":"145.500", "BAND":"2m", "MODE":"FM", "RST_SENT":"59", "RST_RCVD":"59"}
+
+      c = self.connection.cursor()
+      query = "CREATE TABLE test (id INTEGER PRIMARY KEY AUTOINCREMENT"
+      for field_name in self.field_names:
+         s = ", %s TEXT" % field_name.lower()
+         query = query + s
+      query = query + ")"
+      c.execute(query)
+
+      self.log = Log(self.connection, "test")
+
+   def tearDown(self):
+      self.connection.close()
+
+   def test_log_add_missing_db_columns(self):
+
+      column_names_before = []
+      column_names_after = []
+
+      c = self.connection.cursor()
+      c.execute("PRAGMA table_info(test)") 
+      result = c.fetchall()
+      for t in result:
+         column_names_before.append(t[1].upper())
+
+      self.log.add_missing_db_columns()
+
+      c.execute("PRAGMA table_info(test)") 
+      result = c.fetchall()
+      for t in result:
+         column_names_after.append(t[1].upper())
+
+      print "Column names before: ", column_names_before
+      print "Column names after: ", column_names_after
+
+      assert(len(column_names_before) == len(self.field_names) + 1) # Added 1 here because of the "ID" column in all database tables.
+      assert(len(column_names_after) == len(AVAILABLE_FIELD_NAMES_ORDERED) + 1)
+      for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
+         assert(field_name in column_names_after)
+
+   def test_log_add_record(self):
+      self.log.add_record(self.fields_and_data)
+      c = self.connection.cursor()
+      c.execute("SELECT * FROM test")
+      records = c.fetchall()
+      
+      assert len(records) == 1
+      
+      for field_name in self.field_names:
+         print self.fields_and_data[field_name], records[0][field_name]
+         assert self.fields_and_data[field_name] == records[0][field_name]
+
+   def test_log_delete_record(self):
+      query = "INSERT INTO test VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)"
+      c = self.connection.cursor()
+      c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"]))
+
+      c.execute("SELECT * FROM test")
+      records_before = c.fetchall()
+
+      self.log.delete_record(1)
+
+      c.execute("SELECT * FROM test")
+      records_after = c.fetchall()
+
+      assert(len(records_before) == 1)
+      assert(len(records_after) == 0)
+      
+   def test_log_edit_record(self):
+      query = "INSERT INTO test VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)"
+      c = self.connection.cursor()
+      c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"]))
+
+      c.execute("SELECT * FROM test")
+      record_before = c.fetchall()[0]
+
+      self.log.edit_record(1, "CALL", "TEST456")
+      self.log.edit_record(1, "FREQ", "145.450")
+
+      c.execute("SELECT * FROM test")
+      record_after = c.fetchall()[0]
+
+      assert(record_before["CALL"] == "TEST123")
+      assert(record_after["CALL"] == "TEST456")
+      assert(record_before["FREQ"] == "145.500")
+      assert(record_after["FREQ"] == "145.450")
+
+   def test_log_get_record_by_index(self):
+      query = "INSERT INTO test VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)"
+      c = self.connection.cursor()
+      c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"]))
+
+      record = self.log.get_record_by_index(1)
+      print "Contents of retrieved record: ", record
+      for field_name in record.keys():
+         if(field_name.upper() == "ID"):
+            continue
+         else:
+            assert(record[field_name.upper()] == self.fields_and_data[field_name.upper()])
+      assert(len(record) == len(self.fields_and_data) + 1)
+
+   def test_log_get_all_records(self):
+      query = "INSERT INTO test VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)"
+      c = self.connection.cursor()
+      # Add the same record twice
+      c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"]))
+      c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"]))
+
+      records = self.log.get_all_records()
+      print "Contents of all retrieved records: ", records
+      assert(len(records) == 2) # There should be 2 records
+      for field_name in self.field_names:
+         assert(records[0][field_name] == self.fields_and_data[field_name])
+         assert(records[1][field_name] == self.fields_and_data[field_name])
+
+   def test_log_get_number_of_records(self):
+      query = "INSERT INTO test VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)"
+      c = self.connection.cursor()
+      # Add the same record twice
+      c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"]))
+      c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"]))
+
+      number_of_records = self.log.get_number_of_records()
+      print "Number of records in the log: ", number_of_records
+      assert(number_of_records == 2) # There should be 2 records
+
+
+if(__name__ == '__main__'):
+   unittest.main()
diff --git a/pyqso/log_name_dialog.py b/pyqso/log_name_dialog.py
new file mode 100644
index 0000000..be25c5b
--- /dev/null
+++ b/pyqso/log_name_dialog.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# File: new_log_dialog.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+import re
+import calendar
+
+class LogNameDialog(Gtk.Dialog):
+   
+   def __init__(self, parent, title=None, name=None):
+      
+      if(title is None):
+         title = "New Log"
+      else:
+         title = title
+      Gtk.Dialog.__init__(self, title=title, parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
+
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label("Log Name:")
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 6)
+      self.entry = Gtk.Entry()
+      if(name is not None):
+         self.entry.set_text(name)
+      hbox_temp.pack_start(self.entry, False, False, 6)
+      self.vbox.pack_start(hbox_temp, False, False, 6)
+
+      self.show_all()
+
+      logging.debug("New LogNameDialog instance created!")
+
+      return
+
+   def get_log_name(self):
+      logging.debug("Retrieving the log name from the LogNameDialog...")
+      return self.entry.get_text()
+
+
diff --git a/pyqso/logbook.py b/pyqso/logbook.py
new file mode 100644
index 0000000..705f00d
--- /dev/null
+++ b/pyqso/logbook.py
@@ -0,0 +1,947 @@
+#!/usr/bin/env python 
+# File: logbook.py
+
+#    Copyright (C) 2012 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject, Pango, PangoCairo
+import logging
+import sqlite3 as sqlite
+from os.path import basename, getctime, getmtime, expanduser
+import datetime
+import ConfigParser
+
+from adif import *
+from log import *
+from log_name_dialog import *
+from auxiliary_dialogs import *
+
+class Logbook(Gtk.Notebook):
+   """ A Logbook object can store multiple Log objects. """
+   
+   def __init__(self, parent):
+
+      Gtk.Notebook.__init__(self)
+
+      self.parent = parent
+      self.connection = None
+      self.summary = {}
+      self.logs = []
+      logging.debug("New Logbook instance created!")
+      return
+   
+   def open(self, widget=None, path=None):
+      """ Open a logbook, and render all the logs within it. 
+      An optional 'path' argument can be specified if the database file location is known.
+      Otherwise, a file selection dialog will appear. """
+
+      connected = self.db_connect(path)
+      if(connected):
+         # If the connection setup was successful, then open all the logs in the database
+
+         logging.debug("Trying to retrieve all the logs in the logbook...")
+         self.logs = [] # A fresh stack of Log objects
+         try:
+            with self.connection:
+               c = self.connection.cursor()
+               c.execute("SELECT name FROM sqlite_master WHERE type='table'")
+               names = c.fetchall()
+               for name in names:
+                  if(name[0][0:7] == "sqlite_"):
+                     continue # Skip SQLite internal tables
+                  l = Log(self.connection, name[0])
+                  l.populate()
+                  self.logs.append(l)
+         except (sqlite.Error, IndexError) as e:
+            logging.exception(e)
+            logging.exception("Oops! Something went wrong when trying to retrieve the logs from the logbook.")
+            return
+
+         logging.debug("All logs retrieved successfully. Now attempting to render them all in the Gtk.Notebook...")
+         # For rendering the logs. One treeview and one treeselection per Log.
+         self.treeview = []
+         self.treeselection = []
+         self.sorter = []
+         self.filter = []
+         self._create_summary_page()
+         self._create_dummy_page()
+
+         # FIXME: This is an unfortunate work-around. If the area around the "+/New Log" button
+         # is clicked, PyQSO will change to an empty page. This signal is used to stop this from happening. 
+         self.connect("switch-page", self._on_switch_page)
+
+         for i in range(len(self.logs)):
+            self._render_log(i) 
+         logging.debug("All logs rendered successfully.")
+
+         self.update_summary()  
+         self.parent.toolbox.awards.count()  
+
+         context_id = self.parent.statusbar.get_context_id("Status")
+         self.parent.statusbar.push(context_id, "Logbook: %s" % self.path)
+         self.parent.toolbar.set_logbook_button_sensitive(False)
+         self.parent.menu.set_logbook_item_sensitive(False)
+         self.parent.menu.set_log_items_sensitive(True)
+         self.parent.toolbar.filter_source.set_sensitive(True)
+
+         self.show_all()
+
+      else:
+         logging.debug("Not connected to a logbook. No logs were opened.")
+
+      return
+
+   def close(self, widget=None):
+      """ Close the logbook that is currently open. """
+
+      disconnected = self.db_disconnect()
+      if(disconnected):
+         logging.debug("Closing all logs in the logbook...")
+         while(self.get_n_pages() > 0):
+            # Once a page is removed, the other pages get re-numbered,
+            # so a 'for' loop isn't the best option here.
+            self.remove_page(0)
+         logging.debug("All logs now closed.")
+
+         context_id = self.parent.statusbar.get_context_id("Status")
+         self.parent.statusbar.push(context_id, "No logbook is currently open.")
+         self.parent.toolbar.set_logbook_button_sensitive(True)
+         self.parent.menu.set_logbook_item_sensitive(True)
+         self.parent.menu.set_log_items_sensitive(False)
+         self.parent.toolbar.filter_source.set_sensitive(False)
+      else:
+         logging.debug("Unable to disconnect from the database. No logs were closed.")
+      return
+
+   def db_connect(self, path=None):
+      """ Create an SQL database connection to the Logbook's data source """
+
+      logging.debug("Attempting to connect to the logbook database...")
+      if(path is None):
+         # If no path has been provided, get one from a "File Open" dialog.
+         dialog = Gtk.FileChooserDialog("Open SQLite Database File",
+                                    None,
+                                    Gtk.FileChooserAction.OPEN,
+                                    (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+                                    Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
+         
+         response = dialog.run()
+         if(response == Gtk.ResponseType.OK):
+            path = dialog.get_filename()
+         dialog.destroy()
+         
+         if(path is None): # If the Cancel button has been clicked, path will still be None
+            logging.debug("No file path specified.")
+            return False
+         else:
+            self.path = path
+      else:
+         # Use existing user input
+         self.path = path
+
+      # Try setting up the SQL database connection
+      try:
+         self.db_disconnect() # Destroy any existing connections first.
+         self.connection = sqlite.connect(self.path)
+         self.connection.row_factory = sqlite.Row
+      except sqlite.Error as e:
+         # PyQSO can't connect to the database.
+         logging.exception(e)
+         error(parent=self.parent, message="PyQSO cannot connect to the database. Check file permissions?")
+         return False
+
+      logging.debug("Database connection created successfully!")
+      return True
+         
+   def db_disconnect(self):
+      """ Destroy the connection to the Logbook's data source. """
+      logging.debug("Cleaning up any existing database connections...")
+      if(self.connection):
+         try:
+            self.connection.close()
+         except sqlite.Error as e:
+            logging.exception(e)
+            return False
+      else:
+         logging.debug("Already disconnected. Nothing to do here.")
+      return True
+
+   def _create_dummy_page(self):
+      """ Create a blank page in the Gtk.Notebook for the "+" (New Log) tab. """
+      blank_treeview = Gtk.TreeView([])
+      # Allow the Log to be scrolled up/down
+      sw = Gtk.ScrolledWindow()
+      sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+      sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+      sw.add(blank_treeview)
+      vbox = Gtk.VBox()
+      vbox.pack_start(sw, True, True, 0)
+
+      # Add a "+" button to the tab
+      hbox = Gtk.HBox(False, 0)
+      icon = Gtk.Image.new_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.MENU)
+      button = Gtk.Button()
+      button.set_relief(Gtk.ReliefStyle.NONE)
+      button.set_focus_on_click(False)
+      button.connect("clicked", self.new_log)
+      button.add(icon)
+      button.set_tooltip_text('New Log')
+      hbox.pack_start(button, False, False, 0)
+      hbox.show_all()
+      vbox.show_all()
+
+      self.insert_page(vbox, hbox, 1)
+      self.show_all()
+      self.set_current_page(0)
+      return
+
+   def _create_summary_page(self):
+      """ Create a summary page containing the number of logs in the logbook, and the logbook's modification date. """
+      vbox = Gtk.VBox()
+
+      # Database name in large font at the top of the summary page
+      hbox = Gtk.HBox()
+      label = Gtk.Label(halign=Gtk.Align.START)
+      label.set_markup("<span size=\"x-large\">%s</span>" % basename(self.path))
+      hbox.pack_start(label, False, False, 6)
+      vbox.pack_start(hbox, False, False, 2)
+
+      hbox = Gtk.HBox()
+      label = Gtk.Label("Number of logs: ", halign=Gtk.Align.START)
+      hbox.pack_start(label, False, False, 6)
+      self.summary["NUMBER_OF_LOGS"] = Gtk.Label("0")
+      hbox.pack_start(self.summary["NUMBER_OF_LOGS"], False, False, 2)
+      vbox.pack_start(hbox, False, False, 2)
+
+      hbox = Gtk.HBox()
+      label = Gtk.Label("Date modified: ", halign=Gtk.Align.START)
+      hbox.pack_start(label, False, False, 6)
+      self.summary["DATE_MODIFIED"] = Gtk.Label("0")
+      hbox.pack_start(self.summary["DATE_MODIFIED"], False, False, 2)
+      vbox.pack_start(hbox, False, False, 2)
+
+      hbox = Gtk.HBox(False, 0)
+      label = Gtk.Label("Summary  ")
+      icon = Gtk.Image.new_from_stock(Gtk.STOCK_INDEX, Gtk.IconSize.MENU)
+      hbox.pack_start(label, False, False, 0)
+      hbox.pack_start(icon, False, False, 0)
+      hbox.show_all()
+
+      self.insert_page(vbox, hbox, 0) # Append the new log as a new tab
+      self.show_all()
+
+      return
+
+   def update_summary(self):
+      """ Update the information presented on the summary page. """
+      self.summary["NUMBER_OF_LOGS"].set_label(str(self.get_number_of_logs()))
+      try:
+         t = datetime.fromtimestamp(getmtime(self.path)).strftime("%d %B %Y @ %H:%M")
+         self.summary["DATE_MODIFIED"].set_label(str(t))
+      except (IOError, OSError) as e:
+         logging.exception(e)
+      return
+
+   def _on_switch_page(self, widget, label, new_page):
+      if(new_page == self.get_n_pages()-1): # The last (right-most) tab is the "New Log" tab.
+         self.stop_emission("switch-page")
+         
+      # Disable the record buttons if a log page is not selected.
+      if(new_page == 0):
+         self.parent.toolbar.set_record_buttons_sensitive(False)
+         self.parent.menu.set_record_items_sensitive(False)
+      else:
+         self.parent.toolbar.set_record_buttons_sensitive(True)
+         self.parent.menu.set_record_items_sensitive(True)
+      return
+
+   def new_log(self, widget=None):
+      """ Create a new log in the logbook. """
+      if(self.connection is None):
+         return
+      exists = True
+      dialog = LogNameDialog(self.parent)
+      while(exists):
+         response = dialog.run()
+         if(response == Gtk.ResponseType.OK):
+            log_name = dialog.get_log_name()
+            try:
+               with self.connection:
+                  c = self.connection.cursor()
+                  query = "CREATE TABLE %s (id INTEGER PRIMARY KEY AUTOINCREMENT" % log_name
+                  for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
+                     s = ", %s TEXT" % field_name.lower()
+                     query = query + s
+                  query = query + ")"
+                  c.execute(query)
+                  exists = False
+            except sqlite.Error as e:
+               logging.exception(e)
+               # Data is not valid - inform the user.
+               error(parent=self.parent, message="Database error. Try another log name.")
+               exists = True
+         else:
+            dialog.destroy()
+            return
+
+      dialog.destroy()
+
+      l = Log(self.connection, log_name) # Empty log
+      l.populate()
+
+      self.logs.append(l)
+      self._render_log(self.get_number_of_logs()-1)
+      self.update_summary()
+
+      self.set_current_page(self.get_number_of_logs())
+      return
+
+   def delete_log(self, widget, page=None):
+      """ Delete the log that is currently selected in the logbook. """
+      if(self.connection is None):
+         return
+         
+      if(page is None):
+         page_index = self.get_current_page() # Gets the index of the selected tab in the logbook
+         if(page_index == 0): # If we are on the Summary page...
+            logging.debug("No log currently selected!")
+            return
+         else:
+            page = self.get_nth_page(page_index) # Gets the Gtk.VBox of the selected tab in the logbook
+
+      log_index = self._get_log_index(name=page.get_name())
+      log = self.logs[log_index]
+      
+      # We also need the page's index in order to remove it using remove_page below.   
+      # This may not be the same as what self.get_current_page() returns.  
+      page_index = self.page_num(page)
+            
+      if(page_index == 0 or page_index == self.get_n_pages()-1): # Only the "New Log" tab is present (i.e. no actual logs in the logbook)
+         logging.debug("No logs to delete!")
+         return
+
+      response = question(parent=self.parent, message="Are you sure you want to delete log %s?" % log.name)
+      if(response == Gtk.ResponseType.YES):
+         try:
+            with self.connection:
+               c = self.connection.cursor()
+               c.execute("DROP TABLE %s" % log.name)
+         except sqlite.Error as e:
+            logging.exception(e)
+            error(parent=self.parent, message="Database error. Could not delete the log.")
+            return
+
+         self.logs.pop(log_index)
+         # Remove the log from the renderers too
+         self.treeview.pop(log_index)
+         self.treeselection.pop(log_index)
+         self.sorter.pop(log_index)
+         self.filter.pop(log_index)
+         # And finally remove the tab in the Logbook
+         self.remove_page(page_index)
+
+      self.update_summary()
+      self.parent.toolbox.awards.count()
+      return
+
+   def filter_logs(self, widget):
+      """ Re-filter all the logs when the user-defined expression is changed. """
+      for i in range(0, len(self.filter)):
+         self.filter[i].refilter()
+      return
+
+   def _filter_by_callsign(self, model, iter, data):
+      """ Filter all the logs in the logbook by the callsign field, based on a user-defined expression. """
+      value = model.get_value(iter, 1)
+      callsign = self.parent.toolbar.filter_source.get_text()
+      
+      if(callsign is None or callsign == ""):
+         # If there is nothing to filter with, then show all the records!
+         return True
+      else:
+         # This should be case insensitive. 
+         # Also, we could use value[:][0:len(callsign))] if we wanted to match from the very start of each callsign.
+         return callsign.upper() in value or callsign.lower() in value
+
+   def _render_log(self, index):
+      """ Render the Log (identified by 'index') in the Gtk.Notebook. """
+      self.filter.append(self.logs[index].filter_new(root=None))
+      # Set the callsign column as the column we want to filter by
+      self.filter[index].set_visible_func(self._filter_by_callsign, data=None)
+      self.sorter.append(Gtk.TreeModelSort(model=self.filter[index]))
+      self.sorter[index].set_sort_column_id(0, Gtk.SortType.ASCENDING)
+
+      self.treeview.append(Gtk.TreeView(self.sorter[index]))
+      self.treeview[index].set_grid_lines(Gtk.TreeViewGridLines.BOTH)
+      self.treeview[index].connect("row-activated", self.edit_record_callback)
+      self.treeselection.append(self.treeview[index].get_selection())
+      self.treeselection[index].set_mode(Gtk.SelectionMode.SINGLE)
+      # Allow the Log to be scrolled up/down
+      sw = Gtk.ScrolledWindow()
+      sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+      sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+      sw.add(self.treeview[index])
+      vbox = Gtk.VBox()
+      vbox.set_name(self.logs[index].name) # Set a name for the tab itself so we can match it up with the associated Log object later.
+      vbox.pack_start(sw, True, True, 0)
+
+      # Add a close button to the tab
+      hbox = Gtk.HBox(False, 0)
+      label = Gtk.Label(self.logs[index].name)
+      hbox.pack_start(label, False, False, 0)
+      hbox.show_all()
+
+      self.insert_page(vbox, hbox, index+1) # Append the new log as a new tab
+
+      # The first column of the logbook will always be the unique record index.
+      # Let's append this separately to the field names.
+      renderer = Gtk.CellRendererText()
+      column = Gtk.TreeViewColumn("Index", renderer, text=0)
+      column.set_resizable(True)
+      column.set_min_width(50)
+      column.set_clickable(True)
+      column.set_sort_order(Gtk.SortType.ASCENDING)
+      column.set_sort_indicator(True)
+      column.connect("clicked", self.sort_log, 0)
+      self.treeview[index].append_column(column)
+         
+      # Set up column names for each selected field
+      field_names = AVAILABLE_FIELD_NAMES_ORDERED
+      for i in range(0, len(field_names)):
+         renderer = Gtk.CellRendererText()
+         column = Gtk.TreeViewColumn(AVAILABLE_FIELD_NAMES_FRIENDLY[field_names[i]], renderer, text=i+1)
+         column.set_resizable(True)
+         column.set_min_width(50)
+         column.set_clickable(True)
+
+         # Special cases
+         if(field_names[i] == "NOTES"):
+            # Give the 'Notes' column some extra space, since this is likely to contain some long sentences...
+            column.set_min_width(300)
+            # ... but don't let it automatically re-size itself.
+            column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
+
+         column.connect("clicked", self.sort_log, i+1)
+
+         config = ConfigParser.ConfigParser()
+         have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
+         if(have_config):
+            column.set_visible(config.get("view", AVAILABLE_FIELD_NAMES_ORDERED[i].lower()) == "True")
+         self.treeview[index].append_column(column)
+
+      self.show_all()
+      return
+
+   def _compare_date_and_time(self, model, row1, row2, user_data):
+      """ Compares two rows in a Gtk.ListStore, and sorts by both date and time. """
+      date1 = model.get_value(row1, user_data[0])
+      date2 = model.get_value(row2, user_data[0])
+      time1 = model.get_value(row1, user_data[1])
+      time2 = model.get_value(row2, user_data[1])
+      if(date1 < date2):
+         return 1
+      elif(date1 == date2):
+         # If the dates are the same, then let's also sort by time.
+         if(time1 > time2):
+            return -1
+         elif(time1 == time2):
+            return 0
+         else:
+            return 1
+      else:
+         return -1
+
+   def _compare_default(self, model, row1, row2, user_data):
+      """ The default sorting function for all Gtk.ListStore objects. """
+      value1 = model.get_value(row1, user_data)
+      value2 = model.get_value(row2, user_data)
+      if(value1 < value2):
+         return 1
+      elif(value1 == value2):
+         return 0
+      else:
+         return -1
+
+   def sort_log(self, widget, column_index):
+      """ Sort the log (that is currently selected) based on the column identified by column_index. """
+      log_index = self._get_log_index()
+      column = self.treeview[log_index].get_column(column_index)
+
+      if(AVAILABLE_FIELD_NAMES_ORDERED[column_index-1] == "QSO_DATE"):
+         # If the field being sorted is the QSO_DATE, then also sort by the TIME_ON field so we get the
+         # correct chronological order.
+         # Note: This assumes that the TIME_ON field is always immediately to the right of the QSO_DATE field.
+         self.sorter[log_index].set_sort_func(column_index, self._compare_date_and_time, user_data=[column_index, column_index+1])
+      else:
+         self.sorter[log_index].set_sort_func(column_index, self._compare_default, user_data=column_index)
+
+      # If we are operating on the currently-sorted column...
+      if(self.sorter[log_index].get_sort_column_id()[0] == column_index):
+         order = column.get_sort_order()
+         # ...then check if we need to reverse the order of searching.
+         if(order == Gtk.SortType.ASCENDING):
+            self.sorter[log_index].set_sort_column_id(column_index, Gtk.SortType.DESCENDING)
+            column.set_sort_order(Gtk.SortType.DESCENDING)
+         else:
+            self.sorter[log_index].set_sort_column_id(column_index, Gtk.SortType.ASCENDING)
+            column.set_sort_order(Gtk.SortType.ASCENDING)
+      else:
+         # Otherwise, change to the new sorted column. Default to ASCENDING order.
+         self.sorter[log_index].set_sort_column_id(column_index, Gtk.SortType.ASCENDING)
+         column.set_sort_order(Gtk.SortType.ASCENDING)
+
+         # Show an arrow pointing in the direction of the sorting.
+         # (First we need to remove the arrow from the previously-sorted column.
+         # Since we don't know which one that was, just remove the arrow from all columns
+         # and start again. This only loops over a few dozen columns at most, so
+         # hopefully it won't take too much time.)
+         for i in range(0, len(AVAILABLE_FIELD_NAMES_ORDERED)):
+            column = self.treeview[log_index].get_column(i)
+            column.set_sort_indicator(False)
+         column = self.treeview[log_index].get_column(column_index)
+         column.set_sort_indicator(True)
+      return
+      
+   def rename_log(self, widget=None):
+      """ Rename the log that is currently selected. """
+      if(self.connection is None):
+         return
+      page_index = self.get_current_page()
+      if(page_index == 0): # If we are on the Summary page...
+         logging.debug("No log currently selected!")
+         return
+      page = self.get_nth_page(page_index) # Gets the Gtk.VBox of the selected tab in the logbook
+      old_log_name = page.get_name()
+      
+      log_index = self._get_log_index(name=old_log_name)
+      
+      exists = True
+      dialog = LogNameDialog(self.parent, title="Rename Log", name=old_log_name)
+      while(exists):
+         response = dialog.run()
+         if(response == Gtk.ResponseType.OK):
+            new_log_name = dialog.get_log_name()
+            try:
+               with self.connection:
+                  c = self.connection.cursor()
+                  query = "ALTER TABLE %s RENAME TO %s" % (old_log_name, new_log_name)
+                  c.execute(query)
+                  exists = False
+            except sqlite.Error as e:
+               logging.exception(e)
+               # Data is not valid - inform the user.
+               error(parent=self.parent, message="Database error. Try another log name.")
+               exists = True
+         else:
+            dialog.destroy()
+            return
+
+      dialog.destroy()
+      
+      # Remember to change the Log object's name...
+      self.logs[log_index].name = new_log_name
+      
+      # ...and the page's name
+      page.set_name(self.logs[log_index].name)
+
+      # ...and update the tab's label
+      hbox = Gtk.HBox(False, 0)
+      label = Gtk.Label(new_log_name)
+      hbox.pack_start(label, False, False, 0)
+      hbox.show_all()
+      self.set_tab_label(page, hbox)
+      
+      # The number of logs will obviously stay the same, but
+      # we want to update the logbook's modification date.
+      self.update_summary()
+      
+      return
+
+   def import_log(self, widget=None):
+      """ Import a log from an ADIF file. """
+      dialog = Gtk.FileChooserDialog("Import ADIF Log File",
+                                    None,
+                                    Gtk.FileChooserAction.OPEN,
+                                    (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+                                    Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
+      filter = Gtk.FileFilter()
+      filter.set_name("All ADIF files (*.adi)")
+      filter.add_pattern("*.adi")
+      dialog.add_filter(filter)
+
+      filter = Gtk.FileFilter()
+      filter.set_name("All files")
+      filter.add_pattern("*")
+      dialog.add_filter(filter)
+      
+      response = dialog.run()
+      if(response == Gtk.ResponseType.OK):
+         path = dialog.get_filename()
+      else:
+         path = None
+      dialog.destroy()
+      
+      if(path is None):
+         logging.debug("No file path specified.")
+         return
+
+      dialog = LogNameDialog(self.parent, title="Import Log")
+      while(True):
+         response = dialog.run()
+         if(response == Gtk.ResponseType.OK):
+            log_name = dialog.get_log_name()
+            if(self.log_name_exists(log_name)):
+               # Import into existing log
+               exists = True
+               l = self.logs[self._get_log_index(name=log_name)]
+               response = question(parent=self.parent, message="Are you sure you want to import into an existing log?")
+               if(response == Gtk.ResponseType.YES):
+                  break
+            elif(self.log_name_exists(log_name) is None):
+               # Could not determine if the log name exists. It's safer to stop here than to try to add a new log.
+               error(parent=self.parent, message="Database error. Could not check if the log name exists.")
+               dialog.destroy()
+               return
+            else:
+               # Create a new log with the name the user supplies
+               exists = False
+               try:
+                  with self.connection:
+                     c = self.connection.cursor()
+                     query = "CREATE TABLE %s (id INTEGER PRIMARY KEY AUTOINCREMENT" % log_name
+                     for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
+                        s = ", %s TEXT" % field_name.lower()
+                        query = query + s
+                     query = query + ")"
+                     c.execute(query)
+                     l = Log(self.connection, log_name)
+                     break
+               except sqlite.Error as e:
+                  logging.exception(e)
+                  # Data is not valid - inform the user.
+                  error(parent=self.parent, message="Database error. Try another log name.")
+         else:
+            dialog.destroy()
+            return
+      
+      dialog.destroy()
+
+      adif = ADIF()
+      records = adif.read(path)      
+      logging.debug("Importing records from the ADIF file with path: %s" % path)
+      for record in records:
+         l.add_record(record)
+      l.populate()
+
+      if(not exists):
+         self.logs.append(l)
+         self._render_log(self.get_number_of_logs()-1)
+      self.update_summary()
+      self.parent.toolbox.awards.count()
+      
+      return
+      
+   def export_log(self, widget=None):
+      """ Export the log (that is currently selected) to an ADIF file. """
+      page_index = self.get_current_page() # Gets the index of the selected tab in the logbook
+      if(page_index == 0): # If we are on the Summary page...
+         logging.debug("No log currently selected!")
+         return
+
+      log_index = self._get_log_index()
+      log = self.logs[log_index]
+
+      dialog = Gtk.FileChooserDialog("Export Log to File",
+                              None,
+                              Gtk.FileChooserAction.SAVE,
+                              (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+                              Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
+      dialog.set_do_overwrite_confirmation(True)
+
+      filter = Gtk.FileFilter()
+      filter.set_name("All ADIF files (*.adi)")
+      filter.add_pattern("*.adi")
+      dialog.add_filter(filter)
+
+      filter = Gtk.FileFilter()
+      filter.set_name("All files")
+      filter.add_pattern("*")
+      dialog.add_filter(filter)
+
+      response = dialog.run()
+      if(response == Gtk.ResponseType.OK):
+         path = dialog.get_filename()
+      else:
+         path = None
+      dialog.destroy()
+         
+      if(path is None):
+         logging.debug("No file path specified.")
+      else:
+         adif = ADIF()
+         records = log.get_all_records()
+         if(records is not None):
+            adif.write(records, path)
+         else:
+            error(self.parent, "Could not retrieve the records from the SQL database. No records have been exported.")
+      return
+
+   def print_log(self, widget=None):
+      """ Print all the records in the log (that is currently selected). 
+      Note that only a few important fields are printed because of the restricted width of the page. """
+      page_index = self.get_current_page() # Gets the index of the selected tab in the logbook
+      if(page_index == 0): # If we are on the Summary page...
+         logging.debug("No log currently selected!")
+         return
+      log_index = self._get_log_index()
+      log = self.logs[log_index]
+
+      self.text_to_print = "Callsign\t---\tDate\t---\tTime\t---\tFrequency\t---\tMode\n"
+      records = log.get_all_records()
+      if(records is not None):
+         for r in records:
+            self.text_to_print += str(r["CALL"]) + "\t---\t" + str(r["QSO_DATE"]) + "\t---\t" + str(r["TIME_ON"]) + "\t---\t" + str(r["FREQ"]) + "\t---\t" + str(r["MODE"]) + "\n"
+
+         action = Gtk.PrintOperationAction.PRINT_DIALOG
+         operation = Gtk.PrintOperation()
+         operation.set_default_page_setup(Gtk.PageSetup())
+         operation.set_unit(Gtk.Unit.MM)
+
+         operation.connect("begin_print", self._begin_print)
+         operation.connect("draw_page", self._draw_page)
+         result = operation.run(action, parent=self.parent)
+      else:
+         error(self.parent, "Could not retrieve the records from the SQL database. No records have been printed.")
+      return
+    
+   def _begin_print(self, operation, context):
+      width = context.get_width()
+      height = context.get_height()
+      layout = context.create_pango_layout()
+      layout.set_font_description(Pango.FontDescription("normal 10"))
+      layout.set_width(int(width*Pango.SCALE))
+      layout.set_text(self.text_to_print, -1)
+
+      number_of_pages = 0
+      page_height = 0
+      for line in range(0, layout.get_line_count()):
+         layout_line = layout.get_line(line)
+         ink_rectangle, logical_rectangle = layout_line.get_extents()
+         x_bearing, y_bearing, logical_rectangle_width, logical_rectangle_height = logical_rectangle.x, logical_rectangle.y, logical_rectangle.width, logical_rectangle.height
+         self.line_height = logical_rectangle.height/1024.0 + 3
+         page_height += self.line_height
+         if(page_height + self.line_height > height):
+            number_of_pages += 1
+            page_height = self.line_height
+      operation.set_n_pages(number_of_pages + 1)
+      self.text_to_print = self.text_to_print.split("\n")
+      return
+
+   def _draw_page(self, operation, context, page_number):
+      cr = context.get_cairo_context()
+      cr.set_source_rgb(0, 0, 0)
+      layout = context.create_pango_layout()
+ 
+      current_line_number = 0
+      for line in self.text_to_print:
+         layout.set_text(line, -1)  
+         cr.move_to(5, current_line_number*self.line_height)
+         PangoCairo.update_layout(cr, layout)
+         PangoCairo.show_layout(cr, layout)
+         current_line_number = current_line_number + 1
+         if(current_line_number*self.line_height > context.get_height()):
+            for j in range(0, current_line_number):
+               self.text_to_print.pop(0) # Remove what has been printed already before draw_page is called again
+            break
+      return
+
+   def add_record_callback(self, widget):
+      log_index = self._get_log_index()
+      log = self.logs[log_index]
+      
+      dialog = RecordDialog(parent=self.parent, log=log, index=None)
+      all_valid = False # Are all the field entries valid?
+
+      adif = ADIF()
+      while(not all_valid): 
+         # This while loop gives the user infinite attempts at giving valid data.
+         # The add/edit record window will stay open until the user gives valid data,
+         # or until the Cancel button is clicked.
+         all_valid = True
+         response = dialog.run()
+         if(response == Gtk.ResponseType.OK):
+            fields_and_data = {}
+            field_names = AVAILABLE_FIELD_NAMES_ORDERED
+            for i in range(0, len(field_names)):
+               #TODO: Validate user input!
+               fields_and_data[field_names[i]] = dialog.get_data(field_names[i])
+               if(not(adif.is_valid(field_names[i], fields_and_data[field_names[i]], AVAILABLE_FIELD_NAMES_TYPES[field_names[i]]))):
+                  # Data is not valid - inform the user.
+                  error(parent=self.parent, message="The data in field \"%s\" is not valid!" % field_names[i])
+                  all_valid = False
+                  break # Don't check the other data until the user has fixed the current one.
+
+            if(all_valid):
+               # All data has been validated, so we can go ahead and add the new record.
+               log.add_record(fields_and_data)
+               self.update_summary()
+               self.parent.toolbox.awards.count()
+               # Select the new Record's row in the treeview.
+               number_of_records = log.get_number_of_records()
+               if(number_of_records is not None):
+                  self.treeselection[log_index].select_path(number_of_records)
+
+      dialog.destroy()
+      return
+      
+   def delete_record_callback(self, widget):
+      log_index = self._get_log_index()
+      log = self.logs[log_index]
+      (sort_model, path) = self.treeselection[log_index].get_selected_rows() # Get the selected row in the log
+      try:
+         sort_iter = sort_model.get_iter(path[0])
+         # Remember that the filter model is a child of the sort model...
+         filter_model = sort_model.get_model()
+         filter_iter = self.sorter[log_index].convert_iter_to_child_iter(sort_iter)
+         # ...and the ListStore model (i.e. the log) is a child of the filter model.
+         child_iter = self.filter[log_index].convert_iter_to_child_iter(filter_iter)
+         row_index = log.get_value(child_iter,0)
+      except IndexError:
+         logging.debug("Trying to delete a record, but there are no records in the log!")
+         return
+
+      response = question(parent=self.parent, message = "Are you sure you want to delete record %d?" % row_index)
+      if(response == Gtk.ResponseType.YES):
+         # Deletes the record with index 'row_index' from the Records list.
+         # 'iter' is needed to remove the record from the ListStore itself.
+         log.delete_record(row_index, iter=child_iter)
+         self.update_summary()
+         self.parent.toolbox.awards.count()
+      return
+
+   def edit_record_callback(self, widget, path, view_column):
+      # Note: the path and view_column arguments need to be passed in
+      # since they associated with the row-activated signal.
+
+      log_index = self._get_log_index()
+      log = self.logs[log_index]
+
+      (sort_model, path) = self.treeselection[log_index].get_selected_rows() # Get the selected row in the log
+      try:
+         sort_iter = sort_model.get_iter(path[0])
+         # Remember that the filter model is a child of the sort model...
+         filter_model = sort_model.get_model()
+         filter_iter = self.sorter[log_index].convert_iter_to_child_iter(sort_iter)
+         # ...and the ListStore model (i.e. the log) is a child of the filter model.
+         child_iter = self.filter[log_index].convert_iter_to_child_iter(filter_iter)
+         row_index = log.get_value(child_iter,0)
+      except IndexError:
+         logging.debug("Could not find the selected row's index!")
+         return
+
+      dialog = RecordDialog(parent=self.parent, log=self.logs[log_index], index=row_index)
+      all_valid = False # Are all the field entries valid?
+
+      adif = ADIF()
+      while(not all_valid): 
+         # This while loop gives the user infinite attempts at giving valid data.
+         # The add/edit record window will stay open until the user gives valid data,
+         # or until the Cancel button is clicked.
+         all_valid = True
+         response = dialog.run()
+         if(response == Gtk.ResponseType.OK):
+            fields_and_data = {}
+            field_names = AVAILABLE_FIELD_NAMES_ORDERED
+            for i in range(0, len(field_names)):
+               #TODO: Validate user input!
+               fields_and_data[field_names[i]] = dialog.get_data(field_names[i])
+               if(not(adif.is_valid(field_names[i], fields_and_data[field_names[i]], AVAILABLE_FIELD_NAMES_TYPES[field_names[i]]))):
+                  # Data is not valid - inform the user.
+                  error(parent=self.parent, message="The data in field \"%s\" is not valid!" % field_names[i])
+                  all_valid = False
+                  break # Don't check the other fields until the user has fixed the current field's data.
+
+            if(all_valid):
+               # All data has been validated, so we can go ahead and update the record.
+               record = log.get_record_by_index(row_index)
+               if(record is None):
+                  message = "Could not retrieve record with row_index %d from the SQL database. The record has not been edited." % row_index
+                  logging.error(message)
+                  error(parent=self.parent, message=message)
+               else:
+                  for i in range(0, len(field_names)):
+                     # Check whether the data has actually changed. Database updates can be expensive.
+                     if(record[field_names[i].lower()] != fields_and_data[field_names[i]]):
+                        # Update the record in the database and then in the ListStore.
+                        # We add 1 onto the column_index here because we don't want to consider the index column.
+                        log.edit_record(row_index, field_names[i], fields_and_data[field_names[i]], iter=child_iter, column_index=i+1)
+                  self.update_summary()
+                  self.parent.toolbox.awards.count()
+
+      dialog.destroy()
+      return
+
+   def remove_duplicates_callback(self, widget=None):
+      """ Remove duplicate records in a log. 
+      Detecting duplicate records is done based on the CALL, QSO_DATE, TIME_ON, FREQ, and MODE fields. """
+      logging.debug("Removing duplicate records...")
+
+      log_index = self._get_log_index()
+      log = self.logs[log_index]
+
+      (number_of_duplicates, number_of_duplicates_removed) = log.remove_duplicates()
+      info(self.parent, "Found %d duplicate(s). Successfully removed %d duplicate(s)." % (number_of_duplicates, number_of_duplicates_removed))
+      return
+
+   def get_number_of_logs(self):
+      """ Return the total number of logs in the logbook. """
+      return len(self.logs)
+
+   def log_name_exists(self, table_name):
+      """ Return True if the log name already exists in the logbook, and False if it does not already exist. Return None if there is a database error. """
+      try:
+         with self.connection:
+            c = self.connection.cursor()
+            c.execute("SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE name=?)", [table_name])
+            exists = c.fetchone()
+         if(exists[0] == 1):
+            return True
+         else:
+            return False
+      except (sqlite.Error, IndexError) as e:
+         logging.exception(e) # Database error. PyQSO could not check if the log name exists.
+         return None
+
+   def _get_log_index(self, name=None):
+      """ Given the name of a log, return its index in the self.log list. """
+      if(name is None):
+         # If no page name is supplied, then just use the currently selected page
+         page_index = self.get_current_page() # Gets the index of the selected tab in the logbook
+         if(page_index == 0 or page_index == self.get_n_pages()-1):
+            # We either have the Summary page, or the "+" (add log) dummy page.
+            logging.debug("No log currently selected!")
+            return None
+         name = self.get_nth_page(page_index).get_name()
+      # If a page of the logbook (and therefore a Log object) gets deleted, 
+      # then the page_index may not correspond to the index of the log in the self.logs list.
+      # Therefore, we have to search for the tab with the same name as the log.
+      for i in range(0, len(self.logs)):
+         if(self.logs[i].name == name):
+            log_index = i
+            break
+      return log_index
+
diff --git a/pyqso/menu.py b/pyqso/menu.py
new file mode 100644
index 0000000..fb1e297
--- /dev/null
+++ b/pyqso/menu.py
@@ -0,0 +1,259 @@
+#!/usr/bin/env python
+# logbook: menu.py
+
+#    Copyright (C) 2012 Christian Jacobs.
+
+#    This logbook is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+import ConfigParser
+import os.path
+
+class Menu(Gtk.MenuBar):
+   
+   def __init__(self, parent):
+      logging.debug("New Menu instance created!")
+      
+      # First let's call the constructor of the super class (Gtk.MenuBar)
+      Gtk.MenuBar.__init__(self)
+
+      logging.debug("Setting up the menu bar...")      
+      agrp = Gtk.AccelGroup()
+      parent.add_accel_group(agrp)
+
+      self.items = {}
+      
+      ###### LOGBOOK ######
+      mitem_logbook = Gtk.MenuItem("Logbook")
+      self.append(mitem_logbook)  
+      subm_logbook = Gtk.Menu()
+      mitem_logbook.set_submenu(subm_logbook)
+    
+      # Create/open logbook
+      mitem_connect = Gtk.ImageMenuItem("Open New or Existing Logbook...")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.MENU)
+      mitem_connect.set_image(icon)
+      mitem_connect.connect("activate", parent.logbook.open)
+      key, mod = Gtk.accelerator_parse("<Control>O")
+      mitem_connect.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_logbook.append(mitem_connect)
+      self.items["OPEN_LOGBOOK"] = mitem_connect
+
+      # Close logbook
+      mitem_disconnect = Gtk.ImageMenuItem("Close Logbook")
+      mitem_disconnect.connect("activate", parent.logbook.close)
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
+      mitem_disconnect.set_image(icon)
+      key, mod = Gtk.accelerator_parse("<Control>W")
+      mitem_disconnect.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_logbook.append(mitem_disconnect)
+      self.items["CLOSE_LOGBOOK"] = mitem_disconnect
+
+      subm_logbook.append(Gtk.SeparatorMenuItem())
+
+      # New log
+      mitem_new = Gtk.ImageMenuItem("New Log")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.MENU)
+      mitem_new.set_image(icon)
+      mitem_new.connect("activate", parent.logbook.new_log)
+      key, mod = Gtk.accelerator_parse("<Control>N")
+      mitem_new.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_logbook.append(mitem_new)
+      self.items["NEW_LOG"] = mitem_new
+
+      # Delete the current log
+      mitem_delete = Gtk.ImageMenuItem("Delete Selected Log")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.MENU)
+      mitem_delete.set_image(icon)
+      mitem_delete.connect("activate", parent.logbook.delete_log)
+      subm_logbook.append(mitem_delete)
+      self.items["DELETE_LOG"] = mitem_delete
+      
+      # Rename the current log
+      mitem_rename = Gtk.ImageMenuItem("Rename Selected Log")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_EDIT, Gtk.IconSize.MENU)
+      mitem_rename.set_image(icon)
+      mitem_rename.connect("activate", parent.logbook.rename_log)
+      subm_logbook.append(mitem_rename)
+      self.items["RENAME_LOG"] = mitem_rename
+
+      subm_logbook.append(Gtk.SeparatorMenuItem())
+
+      # Import log
+      mitem_import = Gtk.ImageMenuItem("Import Log")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_GO_FORWARD, Gtk.IconSize.MENU)
+      mitem_import.set_image(icon)
+      mitem_import.connect("activate", parent.logbook.import_log)
+      subm_logbook.append(mitem_import)
+      self.items["IMPORT_LOG"] = mitem_import
+
+      # Export the current log
+      mitem_export = Gtk.ImageMenuItem("Export Log")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.MENU)
+      mitem_export.set_image(icon)
+      mitem_export.connect("activate", parent.logbook.export_log)
+      subm_logbook.append(mitem_export)
+      self.items["EXPORT_LOG"] = mitem_export
+ 
+      subm_logbook.append(Gtk.SeparatorMenuItem())
+
+      # Print log
+      mitem_print = Gtk.ImageMenuItem("Print Log")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_PRINT, Gtk.IconSize.MENU)
+      mitem_print.set_image(icon)
+      mitem_print.connect("activate", parent.logbook.print_log)
+      key, mod = Gtk.accelerator_parse("<Control>P")
+      mitem_print.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_logbook.append(mitem_print)
+      self.items["PRINT_LOG"] = mitem_print
+
+      subm_logbook.append(Gtk.SeparatorMenuItem())
+
+      # Quit
+      mitem_quit = Gtk.ImageMenuItem("Quit")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_QUIT, Gtk.IconSize.MENU)
+      mitem_quit.set_image(icon)
+      mitem_quit.connect("activate", Gtk.main_quit)
+      key, mod = Gtk.accelerator_parse("<Control>Q")
+      mitem_quit.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_logbook.append(mitem_quit)
+      self.items["QUIT"] = mitem_quit
+      
+      
+      ###### RECORDS ######
+      mitem_records = Gtk.MenuItem("Records")
+      self.append(mitem_records)  
+      subm_records = Gtk.Menu()
+      mitem_records.set_submenu(subm_records)
+      
+      mitem_addrecord = Gtk.ImageMenuItem("Add Record...")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.MENU)
+      mitem_addrecord.set_image(icon)
+      mitem_addrecord.connect("activate", parent.logbook.add_record_callback)
+      key, mod = Gtk.accelerator_parse("<Control>R")
+      mitem_addrecord.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_records.append(mitem_addrecord)
+      self.items["ADD_RECORD"] = mitem_addrecord
+      
+      mitem_editrecord = Gtk.ImageMenuItem("Edit Selected Record...")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_EDIT, Gtk.IconSize.MENU)
+      mitem_editrecord.set_image(icon)
+      mitem_editrecord.connect("activate", parent.logbook.edit_record_callback, None, None)
+      key, mod = Gtk.accelerator_parse("<Control>E")
+      mitem_editrecord.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_records.append(mitem_editrecord)
+      self.items["EDIT_RECORD"] = mitem_editrecord
+
+      mitem_deleterecord = Gtk.ImageMenuItem("Delete Selected Record...")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.MENU)
+      mitem_deleterecord.set_image(icon)
+      mitem_deleterecord.connect("activate", parent.logbook.delete_record_callback)
+      key, mod = Gtk.accelerator_parse("Delete")
+      mitem_deleterecord.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
+      subm_records.append(mitem_deleterecord)
+      self.items["DELETE_RECORD"] = mitem_deleterecord
+
+      mitem_removeduplicates = Gtk.ImageMenuItem("Remove Duplicate Records")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_FIND_AND_REPLACE, Gtk.IconSize.MENU)
+      mitem_removeduplicates.set_image(icon)
+      mitem_removeduplicates.connect("activate", parent.logbook.remove_duplicates_callback)
+      subm_records.append(mitem_removeduplicates)
+      self.items["REMOVE_DUPLICATES"] = mitem_removeduplicates
+      
+      
+      ###### VIEW ######
+      mitem_view = Gtk.MenuItem("View")
+      self.append(mitem_view)  
+      subm_view = Gtk.Menu()
+      mitem_view.set_submenu(subm_view)
+
+      mitem_toolbox = Gtk.CheckMenuItem("Toolbox")
+      config = ConfigParser.ConfigParser()
+      have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
+      if(have_config):
+         mitem_toolbox.set_active(config.get("general", "show_toolbox") == "True")
+      else:
+         mitem_toolbox.set_active(False) # Don't show the toolbox by default
+      mitem_toolbox.connect("activate", parent.toolbox.toggle_visible_callback)
+      subm_view.append(mitem_toolbox)
+      self.items["TOOLBOX"] = mitem_toolbox
+
+      mitem_preferences = Gtk.ImageMenuItem("Preferences...")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU)
+      mitem_preferences.set_image(icon)
+      mitem_preferences.connect("activate", parent.show_preferences)
+      subm_view.append(mitem_preferences)
+      self.items["PREFERENCES"] = mitem_preferences
+            
+
+      ###### HELP ######
+      mitem_help = Gtk.MenuItem("Help")
+      self.append(mitem_help)  
+      subm_help = Gtk.Menu()
+      mitem_help.set_submenu(subm_help)
+      
+      # About
+      mitem_about = Gtk.ImageMenuItem("About PyQSO")
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_ABOUT, Gtk.IconSize.MENU)
+      mitem_about.set_image(icon)
+      mitem_about.connect("activate", parent.show_about)
+      subm_help.append(mitem_about)
+
+      self.set_logbook_item_sensitive(True)
+      self.set_log_items_sensitive(False)
+      self.set_record_items_sensitive(False)
+      
+      logging.debug("Menu bar ready!") 
+
+      return
+      
+   def set_logbook_item_sensitive(self, sensitive):
+      logging.debug("Setting the 'Create/Open Logbook' menu item's sensitivity to: %s..." % sensitive) 
+      self.items["OPEN_LOGBOOK"].set_sensitive(sensitive)
+      self.items["CLOSE_LOGBOOK"].set_sensitive(not sensitive)
+      logging.debug("Set the 'Create/Open Logbook' menu item's sensitivity to: %s." % sensitive) 
+      return
+
+   def set_log_items_sensitive(self, sensitive):
+      logging.debug("Setting log-related menu item sensitivity to: %s..." % sensitive) 
+      for item_name in ["NEW_LOG", "DELETE_LOG", "RENAME_LOG", "IMPORT_LOG", "EXPORT_LOG", "PRINT_LOG"]:
+         self.items[item_name].set_sensitive(sensitive)
+      logging.debug("Set log-related menu item sensitivity to: %s." % sensitive) 
+      return
+
+   def set_record_items_sensitive(self, sensitive):
+      logging.debug("Setting record-related menu item sensitivity to: %s..." % sensitive) 
+      for item_name in ["ADD_RECORD", "EDIT_RECORD", "DELETE_RECORD", "REMOVE_DUPLICATES"]:
+         self.items[item_name].set_sensitive(sensitive)
+      logging.debug("Set record-related menu item sensitivity to: %s." % sensitive) 
+      return
+
diff --git a/pyqso/preferences_dialog.py b/pyqso/preferences_dialog.py
new file mode 100644
index 0000000..a01c997
--- /dev/null
+++ b/pyqso/preferences_dialog.py
@@ -0,0 +1,283 @@
+#!/usr/bin/env python
+# File: preferences_dialog.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+import ConfigParser
+import os.path
+import base64
+from math import ceil
+try:
+   import Hamlib
+   have_hamlib = True
+except ImportError:
+   logging.error("Could not import the Hamlib module!")
+   have_hamlib = False
+
+from pyqso.adif import AVAILABLE_FIELD_NAMES_FRIENDLY, AVAILABLE_FIELD_NAMES_ORDERED
+
+class PreferencesDialog(Gtk.Dialog):
+   
+   def __init__(self, parent):
+      logging.debug("Setting up the preferences dialog...")
+
+      Gtk.Dialog.__init__(self, title="Preferences", parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
+
+      self.preferences = Gtk.Notebook()
+
+      self.general = GeneralPage()
+      self.preferences.insert_page(self.general, Gtk.Label("General"), 0)
+
+      self.view = ViewPage()
+      self.preferences.insert_page(self.view, Gtk.Label("View"), 1)
+
+      self.hamlib = HamlibPage()
+      self.preferences.insert_page(self.hamlib, Gtk.Label("Hamlib"), 2)
+
+      self.vbox.pack_start(self.preferences, True, True, 2)
+      self.show_all()
+
+      logging.debug("Preferences dialog ready!")
+
+      return
+
+   def commit(self):
+      """ Commit the user preferences to the configuration file. """
+      logging.debug("Committing the user preferences to the configuration file...")
+      general_data = self.general.get_data()
+      view_data = self.view.get_data()
+      hamlib_data = self.hamlib.get_data()
+
+      config = ConfigParser.ConfigParser()
+
+      # General
+      config.add_section("general")
+      for key in general_data.keys():
+         config.set("general", key.lower(), general_data[key])
+
+      # View
+      config.add_section("view")
+      for key in view_data.keys():
+         config.set("view", key.lower(), view_data[key])
+
+      # Hamlib
+      config.add_section("hamlib")
+      for key in hamlib_data.keys():
+         config.set("hamlib", key.lower(), hamlib_data[key])
+      
+      with open(os.path.expanduser('~/.pyqso.ini'), 'w') as f:
+         config.write(f)
+
+      return
+
+class GeneralPage(Gtk.VBox):
+   
+   def __init__(self):
+      logging.debug("Setting up the General page of the preferences dialog...")
+
+      Gtk.VBox.__init__(self, spacing=2)
+
+      # Remember that the have_config conditional in the PyQSO class may be out-of-date the next time the user opens up the preferences dialog
+      # because a configuration file may have been created after launching the application. Let's check to see if one exists again...
+      config = ConfigParser.ConfigParser()
+      have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
+
+      self.sources = {}
+
+      frame = Gtk.Frame()
+      frame.set_label("Startup")
+      hbox = Gtk.HBox()
+      self.sources["SHOW_TOOLBOX"] = Gtk.CheckButton("Show toolbox by default")
+      if(have_config):
+         self.sources["SHOW_TOOLBOX"].set_active(config.get("general", "show_toolbox") == "True")
+      else:
+         self.sources["SHOW_TOOLBOX"].set_active(False)
+      hbox.pack_start(self.sources["SHOW_TOOLBOX"], False, False, 2)
+      frame.add(hbox)
+      self.pack_start(frame, False, False, 2)
+
+      frame = Gtk.Frame()
+      frame.set_label("Login details (qrz.com)")
+      inner_vbox = Gtk.VBox()
+
+      hbox = Gtk.HBox()
+      label = Gtk.Label("Username: ")
+      label.set_width_chars(9)
+      label.set_alignment(0, 0.5)
+      hbox.pack_start(label, False, False, 2)
+      self.sources["QRZ_USERNAME"] = Gtk.Entry()
+      if(have_config):
+         self.sources["QRZ_USERNAME"].set_text(config.get("general", "qrz_username"))
+      hbox.pack_start(self.sources["QRZ_USERNAME"], False, False, 2)
+      inner_vbox.pack_start(hbox, False, False, 2)
+
+      hbox = Gtk.HBox()
+      label = Gtk.Label("Password: ")
+      label.set_width_chars(9)
+      label.set_alignment(0, 0.5)
+      hbox.pack_start(label, False, False, 2)
+      self.sources["QRZ_PASSWORD"] = Gtk.Entry()
+      self.sources["QRZ_PASSWORD"].set_visibility(False) # Mask the password with the "*" character.
+      if(have_config):
+         self.sources["QRZ_PASSWORD"].set_text(base64.b64decode(config.get("general", "qrz_password")))
+      hbox.pack_start(self.sources["QRZ_PASSWORD"], False, False, 2)
+      inner_vbox.pack_start(hbox, False, False, 2)
+
+      label = Gtk.Label("Warning: Login details are currently stored as\nBase64-encoded plain text in the configuration file.")
+      inner_vbox.pack_start(label, False, False, 2)
+
+      frame.add(inner_vbox)
+      self.pack_start(frame, False, False, 2)
+
+      logging.debug("General page of the preferences dialog ready!")
+      return
+
+   def get_data(self):
+      logging.debug("Retrieving data from the General page of the preferences dialog...")
+      data = {}
+      data["SHOW_TOOLBOX"] = self.sources["SHOW_TOOLBOX"].get_active()
+      data["QRZ_USERNAME"] = self.sources["QRZ_USERNAME"].get_text()
+      data["QRZ_PASSWORD"] = base64.b64encode(self.sources["QRZ_PASSWORD"].get_text())
+      return data
+
+class ViewPage(Gtk.VBox):
+   
+   def __init__(self):
+      logging.debug("Setting up the View page of the preferences dialog...")
+
+      Gtk.VBox.__init__(self, spacing=2)
+
+      config = ConfigParser.ConfigParser()
+      have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
+
+      self.sources = {}
+
+      # Divide the list of available field names up into multiple columns (of maximum length 'max_buttons_per_column')
+      # so we don't make the Preferences dialog too long. 
+      hbox = Gtk.HBox(spacing=2)
+      max_buttons_per_column = 6
+      number_of_columns = int( len(AVAILABLE_FIELD_NAMES_ORDERED)/max_buttons_per_column ) + 1 # Number of check buttons per column
+      for i in range(0, number_of_columns):
+         vbox = Gtk.VBox(spacing=2)
+         for j in range(0, max_buttons_per_column):
+            if(i*max_buttons_per_column + j >= len(AVAILABLE_FIELD_NAMES_ORDERED)):
+               break
+            field_name = AVAILABLE_FIELD_NAMES_ORDERED[i*max_buttons_per_column + j]
+            button = Gtk.CheckButton(AVAILABLE_FIELD_NAMES_FRIENDLY[field_name ])
+            if(have_config):
+               button.set_active(config.get("view", field_name.lower()) == "True")
+            else:
+               button.set_active(True)
+            self.sources[field_name] = button
+            vbox.pack_start(button, False, False, 2)
+         hbox.pack_start(vbox, False, False, 2)
+      self.pack_start(hbox, False, False, 2)
+
+      self.label = Gtk.Label("Note: View-related changes will not take effect\nuntil PyQSO is restarted.")
+      self.pack_start(self.label, False, False, 2)
+
+      logging.debug("View page of the preferences dialog ready!")
+      return
+
+   def get_data(self):
+      logging.debug("Retrieving data from the View page of the preferences dialog...")
+      data = {}
+      for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
+         data[field_name] = self.sources[field_name].get_active()
+      return data
+
+class HamlibPage(Gtk.VBox):
+   
+   def __init__(self):
+      logging.debug("Setting up the Hamlib page of the preferences dialog...")
+
+      Gtk.VBox.__init__(self, spacing=2)
+
+      config = ConfigParser.ConfigParser()
+      have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
+
+      self.sources = {}
+
+      frame = Gtk.Frame()
+      frame.set_label("Hamlib support")
+
+      vbox_inner = Gtk.VBox(spacing=2)
+
+      self.sources["AUTOFILL"] = Gtk.CheckButton("Auto-fill Frequency field")
+      if(have_config):
+         self.sources["AUTOFILL"].set_active(config.get("hamlib", "autofill") == "True")
+      else:
+         self.sources["AUTOFILL"].set_active(False)
+      vbox_inner.pack_start(self.sources["AUTOFILL"], False, False, 2)
+
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label("Model: ")
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(17)
+      hbox_temp.pack_start(label, False, False, 2)
+
+      # Get the list of rig models
+      models = ["RIG_MODEL_NONE"]
+      if(have_hamlib):
+         try:
+            for item in dir(Hamlib):
+               if(item.startswith("RIG_MODEL_")):
+                  models.append(item)
+         except:
+            logging.error("Could not obtain rig models list via Hamlib!")
+      else:
+         logging.debug("Hamlib module not present. Could not obtain a list of rig models.")
+
+      self.sources["RIG_MODEL"] = Gtk.ComboBoxText()
+      for model in models:
+         self.sources["RIG_MODEL"].append_text(model)
+      if(have_config):
+         self.sources["RIG_MODEL"].set_active(models.index(config.get("hamlib", "rig_model")))
+      else:
+         self.sources["RIG_MODEL"].set_active(models.index("RIG_MODEL_NONE")) # Set to RIG_MODEL_NONE as the default option.
+      hbox_temp.pack_start(self.sources["RIG_MODEL"], True, True, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # Path to rig
+      hbox_temp = Gtk.HBox()
+      label = Gtk.Label("Path to radio device: ")
+      label.set_width_chars(17)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["RIG_PATHNAME"] = Gtk.Entry()
+      if(have_config):
+         self.sources["RIG_PATHNAME"].set_text(config.get("hamlib", "rig_pathname"))
+      hbox_temp.pack_start(self.sources["RIG_PATHNAME"], True, True, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      frame.add(vbox_inner)
+      self.pack_start(frame, True, True, 2)
+
+      logging.debug("Hamlib page of the preferences dialog ready!")
+      return
+
+   def get_data(self):
+      logging.debug("Retrieving data from the Hamlib page of the preferences dialog...")
+      data = {}
+      data["AUTOFILL"] = self.sources["AUTOFILL"].get_active()
+      data["RIG_PATHNAME"] = self.sources["RIG_PATHNAME"].get_text()
+      data["RIG_MODEL"] = self.sources["RIG_MODEL"].get_active_text()
+      return data
+
diff --git a/pyqso/record_dialog.py b/pyqso/record_dialog.py
new file mode 100644
index 0000000..8a647a4
--- /dev/null
+++ b/pyqso/record_dialog.py
@@ -0,0 +1,482 @@
+#!/usr/bin/env python
+# File: record_dialog.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+import ConfigParser
+from datetime import datetime
+from os.path import expanduser
+import base64
+try:
+   import Hamlib
+   have_hamlib = True
+except ImportError:
+   logging.error("Could not import the Hamlib module!")
+   have_hamlib = False
+
+from adif import AVAILABLE_FIELD_NAMES_FRIENDLY, AVAILABLE_FIELD_NAMES_ORDERED
+from callsign_lookup import *
+from auxiliary_dialogs import *
+
+class RecordDialog(Gtk.Dialog):
+   """ A dialog through which users can enter information about a QSO/record. """
+   
+   def __init__(self, parent, log, index=None):
+      """ Set up the layout of the record dialog.
+      If a record index is specified in the 'index' argument, then the dialog turns into 'edit record mode' and fills the data sources with the existing data in the log.
+      If the 'index' argument is None, then the dialog starts off with nothing in the data sources (e.g. the Gtk.Entry boxes). """
+
+      logging.debug("Setting up the record dialog...")
+      
+      if(index is not None):
+         title = "Edit Record %d" % index
+      else:
+         title = "Add Record"
+      Gtk.Dialog.__init__(self, title=title, parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
+
+      ## QSO DATA FRAME
+      qso_frame = Gtk.Frame()
+      qso_frame.set_label("QSO Information")
+      self.vbox.add(qso_frame)
+
+      hbox_inner = Gtk.HBox(spacing=2)
+
+      vbox_inner = Gtk.VBox(spacing=2)
+      hbox_inner.pack_start(vbox_inner, True, True, 2)
+
+      # Create label:entry pairs and store them in a dictionary
+      self.sources = {}
+
+      # CALL
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["CALL"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["CALL"] = Gtk.Entry()
+      self.sources["CALL"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["CALL"], False, False, 2)
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_INFO, Gtk.IconSize.MENU)
+      button = Gtk.Button()
+      button.add(icon)
+      button.connect("clicked", self.lookup_callback) # Looks up the callsign on qrz.com for callsign and station information.
+      button.set_tooltip_text("Lookup on qrz.com")
+      hbox_temp.pack_start(button, True, True, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # DATE
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["QSO_DATE"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["QSO_DATE"] = Gtk.Entry()
+      self.sources["QSO_DATE"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["QSO_DATE"], False, False, 2)
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.MENU)
+      button = Gtk.Button()
+      button.add(icon)
+      button.connect("clicked", self.calendar_callback)
+      button.set_tooltip_text("Select date from calendar")
+      hbox_temp.pack_start(button, True, True, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # TIME
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["TIME_ON"], halign=Gtk.Align.START)
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["TIME_ON"] = Gtk.Entry()
+      self.sources["TIME_ON"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["TIME_ON"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # FREQ
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["FREQ"], halign=Gtk.Align.START)
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["FREQ"] = Gtk.Entry()
+      self.sources["FREQ"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["FREQ"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # BAND
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["BAND"], halign=Gtk.Align.START)
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      bands = ["", "2190m", "560m", "160m", "80m", "60m", "40m", "30m", "20m", "17m", "15m", "12m", "10m", "6m", "4m", "2m", "1.25m", "70cm", "33cm", "23cm", "13cm", "9cm", "6cm", "3cm", "1.25cm", "6mm", "4mm", "2.5mm", "2mm", "1mm"]
+      self.sources["BAND"] = Gtk.ComboBoxText()
+      for band in bands:
+         self.sources["BAND"].append_text(band)
+      self.sources["BAND"].set_active(0) # Set an empty string as the default option.
+      hbox_temp.pack_start(self.sources["BAND"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # MODE
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["MODE"])
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      modes = ["", "AM", "AMTORFEC", "ASCI", "ATV", "CHIP64", "CHIP128", "CLO", "CONTESTI", "CW", "DSTAR", "DOMINO", "DOMINOF", "FAX", "FM", "FMHELL", "FSK31", "FSK441", "GTOR", "HELL", "HELL80", "HFSK", "ISCAT", "JT44", "JT4A", "JT4B", "JT4C", "JT4D", "JT4E", "JT4F", "JT4G", "JT65", "JT65A", "JT65B", "JT65C", "JT6M", "MFSK8", "MFSK16", "MT63", "OLIVIA", "PAC", "PAC2", "PAC3", "PAX", "PAX2", "PCW", "PKT", "PSK10", "PSK31", "PSK63", "PSK63F", "PSK125", "PSKAM10", "PSKAM31", "PSKAM50", "PS [...]
+      self.sources["MODE"] = Gtk.ComboBoxText()
+      for mode in modes:
+         self.sources["MODE"].append_text(mode)
+      self.sources["MODE"].set_active(0) # Set an empty string as the default option.
+      hbox_temp.pack_start(self.sources["MODE"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # POWER
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["TX_PWR"], halign=Gtk.Align.START)
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["TX_PWR"] = Gtk.Entry()
+      self.sources["TX_PWR"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["TX_PWR"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      vbox_inner = Gtk.VBox(spacing=2)
+      hbox_inner.pack_start(Gtk.SeparatorToolItem(), False, False, 0)
+      hbox_inner.pack_start(vbox_inner, True, True, 2)
+
+      # RST_SENT
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["RST_SENT"])
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["RST_SENT"] = Gtk.Entry()
+      self.sources["RST_SENT"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["RST_SENT"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # RST_RCVD
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["RST_RCVD"])
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["RST_RCVD"] = Gtk.Entry()
+      self.sources["RST_RCVD"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["RST_RCVD"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # QSL_SENT
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["QSL_SENT"])
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      qsl_options = ["", "Y", "N", "R", "I"]
+      self.sources["QSL_SENT"] = Gtk.ComboBoxText()
+      for option in qsl_options:
+         self.sources["QSL_SENT"].append_text(option)
+      self.sources["QSL_SENT"].set_active(0) # Set an empty string as the default option.
+      hbox_temp.pack_start(self.sources["QSL_SENT"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # QSL_RCVD
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["QSL_RCVD"])
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      qsl_options = ["", "Y", "N", "R", "I"]
+      self.sources["QSL_RCVD"] = Gtk.ComboBoxText()
+      for option in qsl_options:
+         self.sources["QSL_RCVD"].append_text(option)
+      self.sources["QSL_RCVD"].set_active(0) # Set an empty string as the default option.
+      hbox_temp.pack_start(self.sources["QSL_RCVD"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # NOTES
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["NOTES"])
+      label.set_alignment(0, 0.5)
+      label.set_width_chars(15)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.textview = Gtk.TextView()
+      sw = Gtk.ScrolledWindow()
+      sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+      sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+      sw.add(self.textview)
+      self.sources["NOTES"] = self.textview.get_buffer()
+      hbox_temp.pack_start(sw, True, True, 2)
+      vbox_inner.pack_start(hbox_temp, True, True, 2)
+
+      qso_frame.add(hbox_inner)
+
+
+      ## STATION INFORMATION FRAME
+      station_frame = Gtk.Frame()
+      station_frame.set_label("Station Information")
+      self.vbox.add(station_frame)
+
+      hbox_inner = Gtk.HBox(spacing=2)
+
+      vbox_inner = Gtk.VBox(spacing=2)
+      hbox_inner.pack_start(vbox_inner, True, True, 2)
+
+      # NAME
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["NAME"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["NAME"] = Gtk.Entry()
+      self.sources["NAME"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["NAME"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # ADDRESS
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["ADDRESS"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["ADDRESS"] = Gtk.Entry()
+      self.sources["ADDRESS"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["ADDRESS"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # STATE
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["STATE"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["STATE"] = Gtk.Entry()
+      self.sources["STATE"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["STATE"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # COUNTRY
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["COUNTRY"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["COUNTRY"] = Gtk.Entry()
+      self.sources["COUNTRY"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["COUNTRY"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      vbox_inner = Gtk.VBox(spacing=2)
+      hbox_inner.pack_start(Gtk.SeparatorToolItem(), False, False, 0)
+      hbox_inner.pack_start(vbox_inner, True, True, 2)
+
+      # DXCC
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["DXCC"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["DXCC"] = Gtk.Entry()
+      self.sources["DXCC"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["DXCC"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # CQZ
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["CQZ"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["CQZ"] = Gtk.Entry()
+      self.sources["CQZ"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["CQZ"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # ITUZ
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["ITUZ"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["ITUZ"] = Gtk.Entry()
+      self.sources["ITUZ"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["ITUZ"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      # IOTA
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label(AVAILABLE_FIELD_NAMES_FRIENDLY["IOTA"], halign=Gtk.Align.START)
+      label.set_width_chars(15)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 2)
+      self.sources["IOTA"] = Gtk.Entry()
+      self.sources["IOTA"].set_width_chars(15)
+      hbox_temp.pack_start(self.sources["IOTA"], False, False, 2)
+      vbox_inner.pack_start(hbox_temp, False, False, 2)
+
+      station_frame.add(hbox_inner)
+
+      if(index is not None):
+         # The record already exists, so display its current data in the input boxes.
+         record = log.get_record_by_index(index)
+         field_names = AVAILABLE_FIELD_NAMES_ORDERED
+         for i in range(0, len(field_names)):
+            data = record[field_names[i].lower()]
+            if(data is None):
+               data = ""
+            if(field_names[i] == "BAND"):
+               self.sources[field_names[i]].set_active(bands.index(data))
+            elif(field_names[i] == "MODE"):
+               self.sources[field_names[i]].set_active(modes.index(data))
+            elif(field_names[i] == "QSL_SENT" or field_names[i] == "QSL_RCVD"):
+               self.sources[field_names[i]].set_active(qsl_options.index(data))
+            elif(field_names[i] == "NOTES"):
+               # Remember to put the new line escape characters back in when displaying the data in a Gtk.TextView
+               text = data.replace("\\n", "\n") 
+               self.sources[field_names[i]].set_text(text)
+            else:
+               self.sources[field_names[i]].set_text(data)
+      else:
+         # Automatically fill in the current date and time
+         dt = datetime.now()
+         (year, month, day) = (dt.year, dt.month, dt.day)
+         (hour, minute) = (dt.hour, dt.minute)
+         # If necessary, add on leading zeros so the YYYYMMDD and HHMM format is followed.
+         if(month < 10):
+            month = "0" + str(month) # Note: Unlike the calendar widget, the months start from an index of 1 here.
+         if(day < 10):
+            day = "0" + str(day)
+         if(hour < 10):
+            hour = "0" + str(hour)
+         if(minute < 10):
+            minute = "0" + str(minute)
+         date = str(year) + str(month) + str(day)
+         time = str(hour) + str(minute)
+         self.sources["QSO_DATE"].set_text(date)
+         self.sources["TIME_ON"].set_text(time)
+
+         if(have_hamlib):
+            # If the Hamlib module is present, then use it to fill in the Frequency field if desired.
+            config = ConfigParser.ConfigParser()
+            have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
+            if(have_config):
+               autofill = (config.get("hamlib", "autofill") == "True")
+               rig_model = config.get("hamlib", "rig_model")
+               rig_pathname = config.get("hamlib", "rig_pathname")
+               if(autofill):
+                  # Use Hamlib (if available) to get the frequency
+                  try:
+                     Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE)
+                     rig = Hamlib.Rig(Hamlib.__dict__[rig_model]) # Look up the model's numerical index in Hamlib's symbol dictionary
+                     rig.set_conf("rig_pathname", rig_pathname)
+                     rig.open()
+                     frequency = "%.6f" % (rig.get_freq()/1.0e6) # Converting to MHz here
+                     self.sources["FREQ"].set_text(frequency)
+                     rig.close()
+                  except:
+                     logging.error("Could not obtain Frequency data via Hamlib!")
+
+      self.show_all()
+
+      logging.debug("Record dialog ready!")
+
+      return
+
+   def get_data(self, field_name):
+      """ Return the data for a specified field (with name 'field_name') from the Gtk.Entry/Gtk.ComboBoxText/etc boxes in the record dialog. """
+      logging.debug("Retrieving the data in field %s from the record dialog..." % field_name)
+      if(field_name == "BAND" or field_name == "MODE" or field_name == "QSL_SENT" or field_name == "QSL_RCVD"):
+         return self.sources[field_name].get_active_text()
+      elif(field_name == "NOTES"):
+         (start, end) = self.sources[field_name].get_bounds()
+         text = self.sources[field_name].get_text(start, end, True)
+         # Replace the escape characters with a slightly different new line marker.
+         # If we don't do this, the rows in the Gtk.TreeView expand based on the number of new lines.
+         text = text.replace("\n", "\\n")
+         return text
+      else:
+         return self.sources[field_name].get_text()
+
+   def lookup_callback(self, widget=None):
+      """ Get the callsign-related data from the qrz.com database and store it in the relevant Gtk.Entry boxes, but return None. """
+      callsign_lookup = CallsignLookup(parent = self)
+
+      config = ConfigParser.ConfigParser()
+      have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
+      if(have_config):
+         username = config.get("general", "qrz_username")
+         password = base64.b64decode(config.get("general", "qrz_password"))
+         if(username == "" or password == ""):
+            details_given = False
+         else:
+            details_given = True
+      else:
+         details_given = False
+      if(not details_given):
+         error(parent=self, message="To perform a callsign lookup, please specify your qrz.com username and password in the Preferences.")
+         return
+
+      connected = callsign_lookup.connect(username, password)
+      if(connected):
+         fields_and_data = callsign_lookup.lookup(self.sources["CALL"].get_text())
+         for field_name in fields_and_data.keys():
+            self.sources[field_name].set_text(fields_and_data[field_name])
+      return
+
+   def calendar_callback(self, widget):
+      """ Open up a calendar widget for easy QSO_DATE selection. Return None after the user destroys the dialog. """
+      calendar = CalendarDialog(parent = self)
+      response = calendar.run()
+      if(response == Gtk.ResponseType.OK):
+         date = calendar.get_date()
+         self.sources["QSO_DATE"].set_text(date)
+      calendar.destroy()
+      return
+
+class CalendarDialog(Gtk.Dialog):
+   """ A simple dialog containing a Gtk.Calendar widget. Using this ensures the date is in the correct YYYYMMDD format required by ADIF. """ 
+   
+   def __init__(self, parent):
+      logging.debug("Setting up a calendar dialog...")
+      Gtk.Dialog.__init__(self, title="Select Date", parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
+      self.calendar = Gtk.Calendar()
+      self.vbox.add(self.calendar)
+      self.show_all()
+      logging.debug("Calendar dialog ready!")
+      return
+
+   def get_date(self):
+      """ Return the date from the Gtk.Calendar widget in YYYYMMDD format. """      
+      logging.debug("Retrieving the date from the calendar widget...")
+      (year, month, day) = self.calendar.get_date()
+      # If necessary, add on leading zeros so the YYYYMMDD format is followed.
+      if(month + 1 < 10):
+         month = "0" + str(month + 1) # Note: the months start from an index of 0 when retrieved from the calendar widget.
+      else:
+         month = month + 1
+      if(day < 10):
+         day = "0" + str(day)
+      date = str(year) + str(month) + str(day)
+      return date
+
diff --git a/pyqso/telnet_connection_dialog.py b/pyqso/telnet_connection_dialog.py
new file mode 100644
index 0000000..d45c741
--- /dev/null
+++ b/pyqso/telnet_connection_dialog.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# File: telnet_connection_dialog.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+import re
+import calendar
+
+class TelnetConnectionDialog(Gtk.Dialog):
+   """ A simple dialog through which users can specify host and login information for a Telnet server. 
+   This can be used to connect to DX clusters. """
+   
+   def __init__(self, parent):
+      logging.debug("Setting up the Telnet connection dialog...")
+      
+      Gtk.Dialog.__init__(self, title="New Telnet Connection", parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
+
+      self.sources = {}
+
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label("Host: ", halign=Gtk.Align.START)
+      label.set_width_chars(12)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 6)
+      self.sources["HOST"] = Gtk.Entry()
+      hbox_temp.pack_start(self.sources["HOST"], True, True, 6)
+      self.vbox.pack_start(hbox_temp, False, False, 6)
+
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label("Port: ", halign=Gtk.Align.START)
+      label.set_width_chars(12)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 6)
+      self.sources["PORT"] = Gtk.Entry()
+      hbox_temp.pack_start(self.sources["PORT"], True, True, 6)
+      self.vbox.pack_start(hbox_temp, False, False, 6)
+
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label("Username: ", halign=Gtk.Align.START)
+      label.set_width_chars(12)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 6)
+      self.sources["USERNAME"] = Gtk.Entry()
+      hbox_temp.pack_start(self.sources["USERNAME"], True, True, 6)
+      self.vbox.pack_start(hbox_temp, False, False, 6)
+
+      hbox_temp = Gtk.HBox(spacing=0)
+      label = Gtk.Label("Password: ", halign=Gtk.Align.START)
+      label.set_width_chars(12)
+      label.set_alignment(0, 0.5)
+      hbox_temp.pack_start(label, False, False, 6)
+      self.sources["PASSWORD"] = Gtk.Entry()
+      self.sources["PASSWORD"].set_visibility(False) # Mask the password with the "*" character.
+      hbox_temp.pack_start(self.sources["PASSWORD"], True, True, 6)
+      self.vbox.pack_start(hbox_temp, False, False, 6)
+
+      logging.debug("Telnet connection dialog ready!") 
+
+      self.show_all()
+      return
+
+   def get_connection_info(self):
+      """ Return the host and login information stored in the Gtk.Entry boxes. """
+      logging.debug("Returning Telnet connection information...") 
+      return self.sources
+
+
diff --git a/pyqso/toolbar.py b/pyqso/toolbar.py
new file mode 100644
index 0000000..2c14661
--- /dev/null
+++ b/pyqso/toolbar.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+# File: toolbar.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+
+class Toolbar(Gtk.HBox):
+   
+   def __init__(self, parent):
+      logging.debug("Setting up the toolbar...")  
+ 
+      Gtk.HBox.__init__(self, spacing=2)
+
+      self.buttons = {}
+
+      # Create/open logbook
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
+      button = Gtk.Button()
+      button.add(icon)
+      button.set_tooltip_text('Open New or Existing Logbook')
+      button.connect("clicked", parent.logbook.open)
+      self.pack_start(button, False, False, 0)
+      self.buttons["OPEN_LOGBOOK"] = button
+
+      # Close logbook
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.BUTTON)
+      button = Gtk.Button()
+      button.add(icon)
+      button.set_tooltip_text('Close Logbook')
+      button.connect("clicked", parent.logbook.close)
+      self.pack_start(button, False, False, 0)
+      self.buttons["CLOSE_LOGBOOK"] = button
+
+      self.pack_start(Gtk.SeparatorToolItem(), False, False, 0)
+
+      # Add record
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON)
+      button = Gtk.Button()
+      button.add(icon)
+      button.set_tooltip_text('Add Record')
+      button.connect("clicked", parent.logbook.add_record_callback)
+      self.pack_start(button, False, False, 0)
+      self.buttons["ADD_RECORD"] = button
+
+      # Edit record
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_EDIT, Gtk.IconSize.BUTTON)
+      button = Gtk.Button()
+      button.add(icon)
+      button.set_tooltip_text('Edit Record')
+      button.connect("clicked", parent.logbook.edit_record_callback, None, None)
+      self.pack_start(button, False, False, 0)
+      self.buttons["EDIT_RECORD"] = button
+
+      # Delete record
+      icon = Gtk.Image()
+      icon.set_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.BUTTON)
+      button = Gtk.Button()
+      button.add(icon)
+      button.set_tooltip_text('Delete Record')
+      button.connect("clicked", parent.logbook.delete_record_callback)
+      self.pack_start(button, False, False, 0)
+      self.buttons["DELETE_RECORD"] = button
+
+      self.pack_start(Gtk.SeparatorToolItem(), False, False, 0)
+
+      # Filter log
+      label = Gtk.Label("Filter by callsign: ")
+      self.pack_start(label, False, False, 0)
+      self.filter_source = Gtk.Entry()
+      self.filter_source.set_width_chars(11)
+      self.filter_source.connect_after("changed", parent.logbook.filter_logs)
+      self.pack_start(self.filter_source, False, False, 0)
+
+      self.set_logbook_button_sensitive(True)
+      self.set_record_buttons_sensitive(False)
+
+      self.filter_source.set_sensitive(False)
+
+      logging.debug("Toolbar ready!") 
+
+      return
+
+   def set_logbook_button_sensitive(self, sensitive):
+      logging.debug("Setting the 'Create/Open Logbook' toolbar item's sensitivity to: %s..." % sensitive) 
+      self.buttons["OPEN_LOGBOOK"].set_sensitive(sensitive)
+      self.buttons["CLOSE_LOGBOOK"].set_sensitive(not sensitive)
+      logging.debug("Set the 'Create/Open Logbook' toolbar item's sensitivity to: %s." % sensitive) 
+      return
+
+   def set_record_buttons_sensitive(self, sensitive):
+      logging.debug("Setting record-related menu item sensitivity to: %s..." % sensitive) 
+      for button_name in ["ADD_RECORD", "EDIT_RECORD", "DELETE_RECORD"]:
+         self.buttons[button_name].set_sensitive(sensitive)
+      logging.debug("Set record-related menu item sensitivity to: %s." % sensitive) 
+      return
+
+
+
diff --git a/pyqso/toolbox.py b/pyqso/toolbox.py
new file mode 100644
index 0000000..ba492f6
--- /dev/null
+++ b/pyqso/toolbox.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# File: toolbox.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk, GObject
+import logging
+
+from pyqso.dx_cluster import *
+from pyqso.grey_line import *
+from pyqso.awards import *
+
+class Toolbox(Gtk.Frame):
+   """ Contains a Gtk.Notebook full of amateur radio-related tools. """   
+
+   def __init__(self, parent):
+      logging.debug("Setting up the toolbox...")
+         
+      Gtk.Frame.__init__(self)
+      self.set_label("Toolbox")
+      self.parent = parent
+
+      self.tools = Gtk.Notebook()
+
+      self.dx_cluster = DXCluster(self.parent)
+      self.tools.insert_page(self.dx_cluster, Gtk.Label("DX Cluster"), 0)
+      self.grey_line = GreyLine(self.parent)
+      self.tools.insert_page(self.grey_line, Gtk.Label("Grey Line"), 1)
+      self.awards = Awards(self.parent)
+      self.tools.insert_page(self.awards, Gtk.Label("Awards"), 2)
+
+      self.add(self.tools)
+      self.tools.connect_after("switch-page", self._on_switch_page)
+
+      logging.debug("Toolbox ready!")
+
+      return
+
+   def toggle_visible_callback(self, widget=None):
+      """ Show/hide the toolbox. """
+      self.set_visible(not self.get_visible())
+      return
+
+   def _on_switch_page(self, widget, label, new_page):
+      """ Re-draw the Grey Line if the user switches to the grey line tab. """
+      if(type(label) == GreyLine):
+         label.draw() # Note that 'label' is actually a GreyLine object.
+      return
+
diff --git a/pyqso/unittest_resources/test.db b/pyqso/unittest_resources/test.db
new file mode 100644
index 0000000..fedcb4b
Binary files /dev/null and b/pyqso/unittest_resources/test.db differ
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..eadb276
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# File: setup.py
+
+#    Copyright (C) 2013 Christian Jacobs.
+
+#    This file is part of PyQSO.
+
+#    PyQSO 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.
+#
+#    PyQSO 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 PyQSO.  If not, see <http://www.gnu.org/licenses/>.
+
+from distutils.core import setup
+
+setup(name='PyQSO',
+      version='0.1',
+      description='A contact logging tool for amateur radio operators.',
+      author='Christian Jacobs',
+      url='https://github.com/ctjacobs/pyqso',
+      packages=['pyqso'],
+      package_dir = {'pyqso': 'pyqso'},
+      scripts=["bin/pyqso"],
+      data_files=[("icons", ["icons/log_64x64.png"])]
+     )
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/pyqso.git



More information about the pkg-hamradio-commits mailing list