Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Jenirok
Summary Tracker SCM Files
authorJesse Hakanen <jessehakanen@gmail.com>
Thu, 15 Apr 2010 18:55:23 +0000 (19:55 +0100)
committerJesse Hakanen <jessehakanen@gmail.com>
Thu, 15 Apr 2010 18:55:23 +0000 (19:55 +0100)
60 files changed:
COPYING [new file with mode: 0644]
Makefile [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/postinst [new file with mode: 0644]
debian/postrm [new file with mode: 0644]
debian/preinst [new file with mode: 0644]
debian/prerm [new file with mode: 0644]
debian/rules [new file with mode: 0755]
jenirok.pro [new file with mode: 0644]
src/common/connectionmanager.cpp [new file with mode: 0644]
src/common/connectionmanager.h [new file with mode: 0644]
src/common/contactmanager.cpp [new file with mode: 0644]
src/common/contactmanager.h [new file with mode: 0644]
src/common/db.cpp [new file with mode: 0644]
src/common/db.h [new file with mode: 0644]
src/common/eniro.cpp [new file with mode: 0644]
src/common/eniro.h [new file with mode: 0644]
src/common/settings.cpp [new file with mode: 0644]
src/common/settings.h [new file with mode: 0644]
src/common/translations.grc [new file with mode: 0644]
src/common/translations/fi_FI.qm [new file with mode: 0644]
src/common/translations/fi_FI.ts [new file with mode: 0644]
src/daemon/Makefile [new file with mode: 0644]
src/daemon/calllistener.cpp [new file with mode: 0644]
src/daemon/calllistener.h [new file with mode: 0644]
src/daemon/daemon.pro [new file with mode: 0644]
src/daemon/data/jenirokd [new file with mode: 0755]
src/daemon/informationbox.cpp [new file with mode: 0644]
src/daemon/informationbox.h [new file with mode: 0644]
src/daemon/main.cpp [new file with mode: 0644]
src/gui/Makefile [new file with mode: 0644]
src/gui/buttonselector.cpp [new file with mode: 0644]
src/gui/buttonselector.h [new file with mode: 0644]
src/gui/daemon.cpp [new file with mode: 0644]
src/gui/daemon.h [new file with mode: 0644]
src/gui/data/26x26/jenirok.png [new file with mode: 0644]
src/gui/data/48x48/jenirok.png [new file with mode: 0644]
src/gui/data/64x64/jenirok.png [new file with mode: 0644]
src/gui/data/jenirok.desktop [new file with mode: 0644]
src/gui/data/maemo/jenirok.xpm [new file with mode: 0755]
src/gui/detailwindow.cpp [new file with mode: 0644]
src/gui/detailwindow.h [new file with mode: 0644]
src/gui/gui.pro [new file with mode: 0644]
src/gui/icons.grc [new file with mode: 0644]
src/gui/icons/start.png [new file with mode: 0755]
src/gui/icons/stop.png [new file with mode: 0755]
src/gui/main.cpp [new file with mode: 0644]
src/gui/mainwindow.cpp [new file with mode: 0644]
src/gui/mainwindow.h [new file with mode: 0644]
src/gui/resultwindow.cpp [new file with mode: 0644]
src/gui/resultwindow.h [new file with mode: 0644]
src/gui/searchdialog.cpp [new file with mode: 0644]
src/gui/searchdialog.h [new file with mode: 0644]
src/gui/settingsdialog.cpp [new file with mode: 0644]
src/gui/settingsdialog.h [new file with mode: 0644]
welcome [deleted file]

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
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 (file)
index 0000000..9281321
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,137 @@
+#############################################################################
+# Makefile for building: jenirok
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Wed Apr 14 21:02:29 2010
+# Project:  jenirok.pro
+# Template: subdirs
+# Command: /usr/bin/qmake -unix -o Makefile jenirok.pro
+#############################################################################
+
+first: make_default
+MAKEFILE      = Makefile
+QMAKE         = /usr/bin/qmake
+DEL_FILE      = rm -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+COPY          = cp -f
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+INSTALL_FILE  = install -m 644 -p
+INSTALL_PROGRAM = install -m 755 -p
+INSTALL_DIR   = $(COPY_DIR)
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+SUBTARGETS    =  \
+               sub-src-gui \
+               sub-src-daemon
+
+src/gui/$(MAKEFILE): 
+       @$(CHK_DIR_EXISTS) src/gui/ || $(MKDIR) src/gui/ 
+       cd src/gui/ && $(QMAKE) /home/maemo/workspace/jenirok/src/gui/gui.pro -unix -o $(MAKEFILE)
+sub-src-gui-qmake_all:  FORCE
+       @$(CHK_DIR_EXISTS) src/gui/ || $(MKDIR) src/gui/ 
+       cd src/gui/ && $(QMAKE) /home/maemo/workspace/jenirok/src/gui/gui.pro -unix -o $(MAKEFILE)
+sub-src-gui: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE)
+sub-src-gui-make_default: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE) 
+sub-src-gui-make_first: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE) first
+sub-src-gui-all: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE) all
+sub-src-gui-clean: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE) clean
+sub-src-gui-distclean: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE) distclean
+sub-src-gui-install_subtargets: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE) install
+sub-src-gui-uninstall_subtargets: src/gui/$(MAKEFILE) FORCE
+       cd src/gui/ && $(MAKE) -f $(MAKEFILE) uninstall
+src/daemon/$(MAKEFILE): 
+       @$(CHK_DIR_EXISTS) src/daemon/ || $(MKDIR) src/daemon/ 
+       cd src/daemon/ && $(QMAKE) /home/maemo/workspace/jenirok/src/daemon/daemon.pro -unix -o $(MAKEFILE)
+sub-src-daemon-qmake_all:  FORCE
+       @$(CHK_DIR_EXISTS) src/daemon/ || $(MKDIR) src/daemon/ 
+       cd src/daemon/ && $(QMAKE) /home/maemo/workspace/jenirok/src/daemon/daemon.pro -unix -o $(MAKEFILE)
+sub-src-daemon: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE)
+sub-src-daemon-make_default: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE) 
+sub-src-daemon-make_first: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE) first
+sub-src-daemon-all: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE) all
+sub-src-daemon-clean: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE) clean
+sub-src-daemon-distclean: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE) distclean
+sub-src-daemon-install_subtargets: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE) install
+sub-src-daemon-uninstall_subtargets: src/daemon/$(MAKEFILE) FORCE
+       cd src/daemon/ && $(MAKE) -f $(MAKEFILE) uninstall
+
+Makefile: jenirok.pro  /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++/qmake.conf /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf
+       $(QMAKE) -unix -o Makefile jenirok.pro
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+qmake: qmake_all FORCE
+       @$(QMAKE) -unix -o Makefile jenirok.pro
+
+qmake_all: sub-src-gui-qmake_all sub-src-daemon-qmake_all FORCE
+
+make_default: sub-src-gui-make_default sub-src-daemon-make_default FORCE
+make_first: sub-src-gui-make_first sub-src-daemon-make_first FORCE
+all: sub-src-gui-all sub-src-daemon-all FORCE
+clean: sub-src-gui-clean sub-src-daemon-clean FORCE
+distclean: sub-src-gui-distclean sub-src-daemon-distclean FORCE
+       -$(DEL_FILE) Makefile
+install_subtargets: sub-src-gui-install_subtargets sub-src-daemon-install_subtargets FORCE
+uninstall_subtargets: sub-src-gui-uninstall_subtargets sub-src-daemon-uninstall_subtargets FORCE
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+install: install_subtargets  FORCE
+
+uninstall:  uninstall_subtargets FORCE
+
+FORCE:
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..b5e58de
--- /dev/null
@@ -0,0 +1,6 @@
+jenirok (0.1.0-1) unstable; urgency=low
+
+  * Initial release
+
+ -- Jesse Hakanen <jessehakanen@gmail.com>  Wed, 14 Apr 2010 20:06:51 +0100
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..73fbc0b
--- /dev/null
@@ -0,0 +1,49 @@
+Source: jenirok
+Section: user/other
+Priority: optional
+Maintainer: Jesse Hakanen <jessehakanen@gmail.com>
+Build-Depends: debhelper (>= 5), libqt4-dev
+Standards-Version: 3.7.2
+
+Package: jenirok
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Searches unknown callers with Eniro's person search.
+ Jenirok finds unknown callers' details 
+ using Eniro person search. Person search
+ can also be done by using a gui application.
+XB-Maemo-Display-Name: Jenirok
+XB-Maemo-Icon26:
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0
+ d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAYBQTFRFcm5s8EdH/P38FAsK
+ 4ru73BQUmxgY+sXF29jaWlkVRUVE6uMbOHfU/f3cqqqb+9XVYhsb4SMj/+Pj
+ FVi6xsRX/f3k6uTjlpWWvdT3QXvSJmfJ4eHUxsfITIjivLq1+/hdozY25jIy
+ 5Nsm2d/n/PphMTExjokX6uEn6t3d8uko/fzKwrsn9vOp2+b3qqhHLkt3mJY6
+ DlO5ByxjGly/1E1NXpz5M2ez+fZZpaeqUIznRIHd58fH9vJU//9q0zw86hgY
+ 4+39//9lqZeX+PWz///vjoWD7/f9vbxZu7qf2tnL+faqm4mJUlJSVZDpx8K8
+ X19fpqVSNTQO/vtk81pa//xVM3HOtKuogYB9+fAh4+FUCRIg//9d5jw8+PWl
+ HSAeDkebNwwMYqT/G1Kl9O9Q1M/NrbrNH2HD+/dU/PmqYFhYmZuc9vRg9/So
+ ycAnM1J/IViqhoU4paI/8u1PxcrTc3EqmJiOsbG0oaCfsa9RCkahFU2g1dRa
+ 9/bh9O7oAAAA////ZgJY2QAAAIB0Uk5T////////////////////////////
+ ////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////
+ /////////////////////wA4BUtnAAADLUlEQVR42pTWi1fSUBzA8bkbNDBi
+ koDEI1IXwzJ6mKGmNoXKF4QvdNqNiizspWnaw/381/tdcOMyN099zwHOGfdz
+ 7t6bcPqfCfYFqcbiBTUS54ACF+Z3AHsvXdtzBH8mXXvuCHonl12a/OkMtOa/
+ mqbZgeYGBpe1SW350ycNfwa5XIGm/bnnq1Ba8e1vato/gF4f24M6wS9yuKkN
+ 3jjLDewBKNVS/MSIpwQK5J4ltpxBBciPk0IhHA4XCqJRBTjcuvG42dZdRwDK
+ XCEcYDEjliiKC4ESKQTOQhEW6xT2t56wnIBEyFzHeBQpoJsfGFhlIF/uSIGq
+ EWedmONRlGFv9R22uo+A2E5HKkkJ7CAetirEgX7nQO5rzuyrAsKzAUyqx8OB
+ oVaBsOiH24/bIPnmkdmbHByJT7HhROnjvNlsoAi3NrLZ7MatJogtWT2icPCM
+ gYPoi4+vzGaHroJvo7u7+zxY0kFCMNz3HsFns9mhFzYwZrZEGRjua4I7Zp1A
+ h9hY0mzpASREHN8xwx22SocbmfYM1vjkWA52xb4WmG/PEBBwozP9/dkWWEuO
+ myVHYTFylM/nj3ePr5qtp+oKUF+/BUbbYDymk6MUDuc6ziei7IjezrSADqPj
+ MavxHPjViUt8ExOqAmliAZwhdoVLh4VQ8DJXMCSAvNIBrnQCMsOLYKgIZKQF
+ MmdgjU/H1S2GTBIMBQUg6ZURBP0m+HadTwcZ76DrQTQh/MzgFSivMPAlm8k6
+ g/RIDS/T8sLMTLFBARYVXCMElUrFR5vg7fUdLgQrXemadbdexwtO7hoxL5sG
+ Azs20IVNpWVZTnthUTSMMi4iUI1iuxEEv3cecjGwvb3d1UqGY8Oo67UpApGz
+ JxCCh9faMbDdbopQNWIUQSYgWeD1NT4dvDe5vCAYqsoeSzy4z8VAT7ubNZKK
+ RNY7wX0b6OHz4sklqQ0e/LoQ9MgQVaUSgQELPOgIwTQ/ftpDaF1Sq1C0gD3v
+ tIdvGrdbrUsKae1XYdf26CZ24PHUyJFa8kPd+U1AOQdwCn+RgiC6Ao89ma1p
+ 5NQNkPMBdxzsoOzykkENF1AqOxdtbcLpXwEGAN04iD9YnhjMAAAAAElFTkSu
+ QmCC
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..8e8e2e4
--- /dev/null
@@ -0,0 +1,14 @@
+Copyright (c) 2010 Jesse Hakanen <jessehakanen@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..21eff11
--- /dev/null
@@ -0,0 +1,3 @@
+usr/bin
+usr/share/applications/hildon
+etc/init.d
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..3eb2f3c
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+
+gtk-update-icon-cache -f /usr/share/icons/hicolor
+
+# Make jenirok autostart on boot if this is a new install
+oldversion="$2"
+if [ -z "$oldversion" ]; then
+  update-rc.d jenirokd defaults 99 >/dev/null
+fi
+
+/etc/init.d/jenirokd start
+
+exit 0
diff --git a/debian/postrm b/debian/postrm
new file mode 100644 (file)
index 0000000..cca0a15
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+rm -f /home/user/.jenirok.db
+
+exit 0
+
diff --git a/debian/preinst b/debian/preinst
new file mode 100644 (file)
index 0000000..6d0f2ba
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+/etc/init.d/jenirokd stop
+
+exit 0
+
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..6d0f2ba
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+/etc/init.d/jenirokd stop
+
+exit 0
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..a9afddc
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/make -f
+APPNAME := jenirok
+builddir:
+       mkdir -p builddir
+
+builddir/Makefile: builddir
+       cd builddir && qmake-qt4 PREFIX=/usr ../$(APPNAME).pro
+
+build: build-stamp
+
+build-stamp: builddir/Makefile
+       dh_testdir
+       # Add here commands to compile the package.
+       cd builddir && $(MAKE)
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+       # Add here commands to clean up after the build process.
+       rm -rf builddir
+       dh_clean
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+# Add here commands to install the package into debian/your_appname
+       cd builddir && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/$(APPNAME) install
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installdocs
+       dh_installexamples
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=my-application-dbg
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/jenirok.pro b/jenirok.pro
new file mode 100644 (file)
index 0000000..2ebbf98
--- /dev/null
@@ -0,0 +1,8 @@
+QMAKEVERSION = $$[QMAKE_VERSION]
+ISQT4 = $$find(QMAKEVERSION, ^[2-9])
+isEmpty( ISQT4 ) {
+  error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4");
+}
+
+TEMPLATE = subdirs
+SUBDIRS  = src/gui src/daemon
diff --git a/src/common/connectionmanager.cpp b/src/common/connectionmanager.cpp
new file mode 100644 (file)
index 0000000..2793d83
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QDebug>
+#include <glib-object.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include "connectionmanager.h"
+
+ConnectionManager* ConnectionManager::instance_ = 0;
+
+ConnectionManager::ConnectionManager(): connection_(0), connected_(false)
+{
+       DBusError err;
+       DBusConnection* conn;
+       dbus_error_init(&err);
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+
+       if(conn)
+       {
+               dbus_connection_setup_with_g_main(conn, NULL);
+       }
+       else
+       {
+               qDebug() << "Unable to connect to DBUS: " << err.message;
+               dbus_error_free(&err);
+       }
+
+       connection_ = con_ic_connection_new();
+
+       g_signal_connect(G_OBJECT(connection_), "connection-event", G_CALLBACK(connectionHandler), NULL);
+
+
+}
+
+ConnectionManager& ConnectionManager::instance()
+{
+       if(!instance_)
+       {
+               instance_ = new ConnectionManager;
+       }
+
+       return *instance_;
+}
+
+bool ConnectionManager::connect()
+{
+       return con_ic_connection_connect(connection_, CON_IC_CONNECT_FLAG_NONE);
+}
+
+bool ConnectionManager::disconnect()
+{
+       return con_ic_connection_disconnect(connection_);
+}
+
+bool ConnectionManager::isConnected()
+{
+       return connected_;
+}
+void ConnectionManager::connectionHandler(ConIcConnection *connection,
+        ConIcConnectionEvent *event,
+        gpointer user_data)
+{
+       Q_UNUSED(connection);
+       Q_UNUSED(user_data);
+
+       ConIcConnectionStatus status = con_ic_connection_event_get_status(event);
+
+       switch(status)
+       {
+
+         case CON_IC_STATUS_CONNECTED:
+               qDebug() << "Connected";
+               instance_->emit connected();
+               instance_->connected_ = true;
+               break;
+
+         case CON_IC_STATUS_DISCONNECTING:
+         case CON_IC_STATUS_NETWORK_UP:
+               break;
+
+         case CON_IC_STATUS_DISCONNECTED:
+               ConIcConnectionError err = con_ic_connection_event_get_error(event);
+               switch(err)
+               {
+                 case CON_IC_CONNECTION_ERROR_NONE:
+                 case CON_IC_CONNECTION_ERROR_USER_CANCELED:
+                       qDebug() << "Disconnected";
+                       instance_->emit disconnected();
+                       instance_->connected_ = false;
+                       break;
+
+                 case CON_IC_CONNECTION_ERROR_INVALID_IAP:
+                       qDebug() << "Invalid IAP";
+                       instance_->emit error("Invalid IAP");
+                       break;
+
+                 case CON_IC_CONNECTION_ERROR_CONNECTION_FAILED:
+                       qDebug() << "Connection failed";
+                       instance_->emit error("Connection failed");
+                       break;
+
+                 default:
+                         break;
+               }
+               break;
+       }
+}
diff --git a/src/common/connectionmanager.h b/src/common/connectionmanager.h
new file mode 100644 (file)
index 0000000..fd31ab6
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CONNECTIONMANAGER_H
+#define CONNECTIONMANAGER_H
+
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <conic/conic.h>
+#include <glib-object.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+class ConnectionManager : public QObject
+{
+       Q_OBJECT
+
+public:
+       static ConnectionManager& instance();
+       bool connect();
+       bool disconnect();
+       bool isConnected();
+
+signals:
+       void connected();
+       void disconnected();
+       void error(QString const& error);
+
+
+private:
+       ConnectionManager();
+       static void connectionHandler(ConIcConnection *connection,
+                   ConIcConnectionEvent *event,
+                   gpointer user_data);
+       static ConnectionManager* instance_;
+       ConIcConnection* connection_;
+       bool connected_;
+};
+
+#endif
diff --git a/src/common/contactmanager.cpp b/src/common/contactmanager.cpp
new file mode 100644 (file)
index 0000000..3f8affe
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QDebug>
+#include "contactmanager.h"
+
+namespace
+{
+       const int COUNTRY_CODES[] = {358, 45, 46, 47};
+       const int NUM_OF_CODES = 4;
+}
+
+ContactManager::ContactManager(): book_(0)
+{
+}
+
+ContactManager::~ContactManager()
+{
+}
+
+bool ContactManager::numberExists(QString const& number)
+{
+       if(!load())
+       {
+               return false;
+       }
+
+       EBookQuery* query;
+       GList *g_contacts;
+
+       QString copy(number);
+       QString clean = removeCountryCode(copy);
+
+       query = e_book_query_any_field_contains(clean.toLatin1());
+
+       if (!e_book_get_contacts (book_, query, &g_contacts, NULL))
+       {
+               qDebug() << "Couldn't get query results.\n";
+               return false;
+       }
+
+       if (g_contacts == 0)
+       {
+               qDebug() << "no contacts";
+               return false;
+       }
+
+       return true;
+
+}
+
+bool ContactManager::addContact(Contact const& contact)
+{
+       if(!load())
+       {
+               return false;
+       }
+
+       EContact* newContact = e_contact_new();
+       GError* error = NULL;
+       //EContactAddress* addr = new EContactAddress;
+
+       if(!contact.name.isEmpty())
+       {
+               char* name = contact.name.toLatin1().data();
+               e_contact_set(newContact, E_CONTACT_FULL_NAME, (gpointer)name);
+       }
+
+       // Doesn't work for some reason
+       /*if(!contact.city.isEmpty() || !contact.street.isEmpty())
+       {
+               addr->street = contact.street.toLatin1().data();
+               addr->locality = contact.city.toLatin1().data();
+               e_contact_set(newContact, E_CONTACT_ADDRESS_HOME, (gpointer)addr);
+       }*/
+
+       if(!contact.number.isEmpty())
+       {
+               char* number = contact.number.toLatin1().data();
+               e_contact_set(newContact, E_CONTACT_PHONE_HOME, (gpointer)number);
+       }
+
+       if(!e_book_add_contact(book_, newContact, &error))
+       {
+               qDebug() << "Couldn't add contact: %s" <<  error->message;
+               g_error_free(error);
+               return false;
+       }
+
+       return true;
+}
+
+bool ContactManager::load()
+{
+       if(book_)
+       {
+               return true;
+       }
+
+       GError* error = NULL;
+       book_ = e_book_new_system_addressbook(&error);
+
+       if (!book_)
+       {
+               qDebug() << "Couldn't open addressbook: %s" <<  error->message;
+               g_error_free(error);
+               return false;
+       }
+
+       /* Open connection to the address book */
+       if (!e_book_open(book_, FALSE, &error))
+       {
+               qDebug() << "Couldn't open addressbook: %s" << error->message;
+               g_error_free(error);
+               return false;
+       }
+
+       return true;
+
+}
+
+QString& ContactManager::removeCountryCode(QString& number)
+{
+       if(number.isEmpty())
+       {
+               return number;
+       }
+
+       if(number.at(0) == '0')
+       {
+               return number.remove(0, 1);
+       }
+       else if(number.at(0) != '+')
+       {
+               return number;
+       }
+
+       static QRegExp countryCodeCleaner;
+       static bool countryCodeCleanerLoaded = false;
+
+       if(!countryCodeCleanerLoaded)
+       {
+               QString match = "";
+
+               for(int i = 0; i < NUM_OF_CODES; i++)
+               {
+                       if(i > 0)
+                       {
+                               match += "|";
+                       }
+
+                       match += "\\+" + QString::number(COUNTRY_CODES[i]);
+               }
+
+               countryCodeCleaner = QRegExp("^(" + match + ")");
+               countryCodeCleanerLoaded = true;
+       }
+
+       return number.replace(countryCodeCleaner, "");
+}
+
diff --git a/src/common/contactmanager.h b/src/common/contactmanager.h
new file mode 100644 (file)
index 0000000..904e103
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CONTACTMANAGER_H
+#define CONTACTMANAGER_H
+
+#include <QtCore/QLibrary>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+#include <libebook/e-book.h>
+
+class ContactManager
+{
+public:
+       struct Contact
+       {
+               QString name;
+               QString number;
+               QString street;
+               QString city;
+       };
+
+       ContactManager();
+       ~ContactManager();
+       bool addContact(Contact const& contact);
+       bool numberExists(QString const& number);
+       static QString& removeCountryCode(QString& number);
+
+private:
+       bool load();
+       EBook* book_;
+};
+
+#endif
diff --git a/src/common/db.cpp b/src/common/db.cpp
new file mode 100644 (file)
index 0000000..e5ce316
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtCore/QDir>
+#include <QtSql/QSqlQuery>
+#include <QtSql/QSqlError>
+#include "db.h"
+#include <QDebug>
+
+namespace
+{
+       const QString SQL_DRIVER = "QSQLITE";
+       const QString SQL_DATABASE = ".jenirok.db";
+}
+
+bool DB::initialized_ = false;
+QSqlDatabase DB::db_;
+
+bool DB::connect()
+{
+       if(!initialized_)
+       {
+               db_ = QSqlDatabase::addDatabase(SQL_DRIVER);
+               QString path = QDir::home().path() + QDir::separator() + SQL_DATABASE;
+               db_.setDatabaseName(QDir::toNativeSeparators(path));
+       }
+
+       bool ret = db_.open();
+
+       if(!ret)
+       {
+               QSqlError error = db_.lastError();
+               qDebug() << error.text();
+       }
+
+       if(ret && !initialized_)
+       {
+               QSqlQuery query("SELECT value FROM settings WHERE name = 'initialized'");
+
+               if(!query.next())
+               {
+                       ret = createTables();
+               }
+       }
+
+       if(!initialized_)
+       {
+               initialized_ = true;
+       }
+
+       return ret;
+}
+
+void DB::disconnect()
+{
+       db_.close();
+}
+
+void DB::removeDatabase()
+{
+       db_.close();
+       db_ = QSqlDatabase();
+       QSqlDatabase::removeDatabase(QSqlDatabase::defaultConnection);
+       initialized_ = false;
+}
+
+bool DB::connected()
+{
+       return db_.isOpen();
+}
+
+QSqlDatabase& DB::instance()
+{
+       return db_;
+}
+
+bool DB::createTables()
+{
+       QSqlQuery query;
+
+       bool ret = true;
+
+       ret = ret && query.exec("CREATE TABLE cache (id INTEGER PRIMARY KEY, number VARCHAR(32) NOT NULL UNIQUE, name VARCHAR(255) NOT NULL, street VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL)");
+       ret = ret && query.exec("CREATE TABLE settings (name VARCHAR(255) NOT NULL PRIMARY KEY, value VARCHAR(255) NOT NULL)");
+       ret = ret && query.exec("INSERT INTO settings(name, value) VALUES('initialized', '1')");
+
+       return ret;
+}
diff --git a/src/common/db.h b/src/common/db.h
new file mode 100644 (file)
index 0000000..20eeae2
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DB_H
+#define DB_H
+
+#include <QtCore/QString>
+#include <QtSql/QSqlDatabase>
+
+class DB
+{
+
+public:
+       static bool connect();
+       static bool connected();
+       static void disconnect();
+       static void removeDatabase();
+       QSqlDatabase& instance();
+
+private:
+       DB();
+       static bool createTables();
+       static QSqlDatabase db_;
+       static bool initialized_;
+};
+
+#endif // DB_H
+
diff --git a/src/common/eniro.cpp b/src/common/eniro.cpp
new file mode 100644 (file)
index 0000000..56f27fe
--- /dev/null
@@ -0,0 +1,592 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtCore/QDebug>
+#include "eniro.h"
+
+namespace
+{
+    static const QString SITE_URLS[] =
+    {
+        "http://wap.eniro.fi/",
+        "http://wap.eniro.se/",
+        "http://wap.eniro.dk/"
+    };
+
+    const QString INVALID_LOGIN_STRING = "Invalid login details";
+    const QString PERSON_REGEXP = "<td class=\"hTd2\">(.*)<b>(.*)</td>";
+    const QString YELLOW_REGEXP = "<td class=\"hTd2\">(.*)<span class=\"gray\"\\}>(.*)</td>";
+    const QString NUMBER_REGEXP = "<div class=\"callRow\">(.*)</div>";
+    const QString LOGIN_CHECK = "<input class=\"inpTxt\" id=\"loginformUsername\"";
+}
+
+// Regexp used to remove numbers from string
+QRegExp Eniro::numberCleaner_ = QRegExp("([^0-9]+)");
+
+// Removes html tags from string
+QRegExp Eniro::tagStripper_ = QRegExp("<([^>]+)>");
+
+Eniro::Eniro(Site site, QObject *parent): QObject(parent), site_(site),
+username_(""), password_(""), loggedIn_(false), error_(NO_ERROR),
+errorString_(""), maxResults_(10), findNumber_(true),
+pendingSearches_(), pendingNumberRequests_()
+{
+    connect(&http_, SIGNAL(requestFinished(int, bool)), this, SLOT(httpReady(int, bool)));
+}
+
+Eniro::~Eniro()
+{
+    abort();
+}
+
+void Eniro::abort()
+{
+    http_.abort();
+
+    for(searchMap::iterator sit = pendingSearches_.begin();
+        sit != pendingSearches_.end(); sit++)
+    {
+        if(sit.value() != 0)
+        {
+            delete sit.value();
+            sit.value() = 0;
+        }
+    }
+
+    pendingSearches_.clear();
+
+    for(numberMap::iterator nit = pendingNumberRequests_.begin();
+        nit != pendingNumberRequests_.end(); nit++)
+    {
+        if(nit.value() != 0)
+        {
+            delete nit.value();
+            nit.value() = 0;
+        }
+    }
+
+    pendingNumberRequests_.clear();
+    pendingLoginRequests_.clear();
+}
+
+void Eniro::setMaxResults(unsigned int value)
+{
+    maxResults_ = value;
+}
+
+void Eniro::setFindNumber(bool value)
+{
+       findNumber_ = value;
+}
+
+void Eniro::setSite(Eniro::Site site)
+{
+    site_ = site;
+}
+
+void Eniro::login(QString const& username,
+                  QString const& password)
+{
+    username_ = username;
+    password_ = password;
+    loggedIn_ = true;
+}
+
+void Eniro::logout()
+{
+    username_ = "";
+    password_ = "";
+    loggedIn_ = false;
+}
+
+void Eniro::testLogin()
+{
+    QUrl url = createUrl("", "");
+
+    url.addQueryItem("what", "mobwp");
+    http_.setHost(url.host(), url.port(80));
+    int id = http_.get(url.encodedPath() + '?' + url.encodedQuery());
+
+    pendingLoginRequests_.insert(id);
+}
+
+bool Eniro::search(SearchDetails const& details)
+{
+    SearchType type = details.type;
+
+    // Only logged in users can use other than person search
+    if(!loggedIn_)
+    {
+        type = PERSONS;
+    }
+
+    QUrl url = createUrl(details.query, details.location);
+    QString what;
+
+    if(loggedIn_)
+    {
+        switch(type)
+        {
+        case YELLOW_PAGES:
+            what = "mobcs";
+            break;
+
+        case PERSONS:
+            what = "mobwp";
+            break;
+
+        default:
+            what = "moball";
+        }
+
+    }
+    else
+    {
+        what = "moball";
+    }
+
+    url.addQueryItem("what", what);
+
+    http_.setHost(url.host(), url.port(80));
+    int id = http_.get(url.encodedPath() + '?' + url.encodedQuery());
+
+    QVector <Result> results;
+
+    // Store search data for later identification
+    SearchData* newData = new SearchData;
+    newData->details = details;
+    newData->results = results;
+    newData->foundNumbers = 0;
+    newData->numbersTotal = 0;
+
+    // Store request id so that it can be identified later
+    pendingSearches_[id] = newData;
+
+    return true;
+}
+
+Eniro::Error Eniro::error() const
+{
+    return error_;
+}
+
+const QString& Eniro::errorString() const
+{
+    return errorString_;
+}
+
+void Eniro::httpReady(int id, bool error)
+{
+    if(error)
+    {
+        qDebug() << "Error: " << http_.errorString();
+    }
+
+    searchMap::const_iterator searchIt;
+    numberMap::const_iterator numberIt;
+
+    // Check if request is pending search request
+    if((searchIt = pendingSearches_.find(id)) !=
+       pendingSearches_.end())
+    {
+        if(error)
+        {
+            error_ = CONNECTION_FAILURE;
+            errorString_ = http_.errorString();
+            emitRequestFinished(id, searchIt.value(), true);
+            return;
+        }
+
+        QString result(http_.readAll());
+
+        // Load results from html data
+        loadResults(id, result);
+    }
+
+    // Check if request is pending number requests
+    else if((numberIt = pendingNumberRequests_.find(id)) !=
+            pendingNumberRequests_.end())
+    {
+        if(error)
+        {
+            error_ = CONNECTION_FAILURE;
+            errorString_ = http_.errorString();
+            delete pendingNumberRequests_[id];
+            pendingNumberRequests_.remove(id);
+            return;
+        }
+
+        QString result(http_.readAll());
+
+        // Load number from html data
+        loadNumber(id, result);
+    }
+
+    // Check for login request
+    else if(pendingLoginRequests_.find(id) !=
+            pendingLoginRequests_.end())
+    {
+       bool success = true;
+
+       if(!error)
+       {
+               QString result(http_.readAll());
+
+               // If html source contains LOGIN_CHECK, login failed
+               if(result.indexOf(LOGIN_CHECK) != -1)
+               {
+                       success = false;
+               }
+       }
+       else
+       {
+               success = false;
+       }
+
+        emit loginStatus(success);
+    }
+
+}
+
+// Loads results from html source code
+void Eniro::loadResults(int id, QString const& httpData)
+{
+    searchMap::iterator it = pendingSearches_.find(id);
+    QString expr;
+
+    switch(it.value()->details.type)
+    {
+      case YELLOW_PAGES:
+        expr = YELLOW_REGEXP;
+        break;
+      case PERSONS:
+        expr = PERSON_REGEXP;
+        break;
+      default:
+        return;
+    }
+
+    QRegExp rx(expr);
+    rx.setMinimal(true);
+
+    bool requestsPending = false;
+    int pos = 0;
+    QString data;
+
+    // Find all matches
+    while((pos = rx.indexIn(httpData, pos)) != -1)
+    {
+       pos += rx.matchedLength();
+
+       data = rx.cap(2);
+       data = stripTags(data);
+       QStringList rows = data.split('\n');
+
+       for(int i = 0; i < rows.size(); i++)
+       {
+           // Remove white spaces
+            QString trimmed = rows.at(i).trimmed().toLower();
+
+            // Remove empty strings
+            if(trimmed.isEmpty())
+            {
+                rows.removeAt(i);
+                i--;
+            }
+            else
+            {
+               // Convert words to uppercase
+                rows[i] = ucFirst(trimmed);
+            }
+       }
+
+       Result result;
+
+       int size = rows.size();
+
+       switch(size)
+       {
+         case 1:
+           result.name = rows[0];
+           break;
+
+         case 2:
+           result.name = rows[0];
+           result.city = rows[1];
+           break;
+
+         case 3:
+           result.name = rows[0];
+           result.street = rows[1];
+           result.city = rows[2];
+           break;
+
+         case 4:
+           result.name = rows[0];
+           // Remove slashes and spaces from number
+           result.number = cleanUpNumber(rows[1]);
+           result.street = rows[2];
+           result.city = rows[3];
+           break;
+
+         default:
+           continue;
+
+       }
+
+       it.value()->results.push_back(result);
+
+       unsigned int foundResults = ++(it.value()->numbersTotal);
+
+       // If phone number searh is enabled, we have to make another
+       // request to find it out
+       if(findNumber_ && size < 4 && loggedIn_ &&
+          it.value()->details.type != YELLOW_PAGES)
+       {
+            requestsPending = true;
+            getNumberForResult(id, it.value()->results.size() - 1, it.value()->details);
+       }
+       // Otherwise result is ready
+       else
+       {
+            emit resultAvailable(result, it.value()->details);
+       }
+
+       // Stop searching if max results is reached
+       if(maxResults_ && (foundResults >= maxResults_))
+       {
+           break;
+       }
+    }
+
+    // If number there were no results or no phone numbers needed to
+    // be fetched, the whole request is ready
+    if(it.value()->numbersTotal == 0 || !requestsPending)
+    {
+        bool error = false;
+
+        if(httpData.indexOf(LOGIN_CHECK) != -1)
+        {
+            error_ = INVALID_LOGIN;
+            errorString_ = INVALID_LOGIN_STRING;
+            error = true;
+        }
+
+        emitRequestFinished(it.key(), it.value(), error);
+    }
+}
+
+// Loads phone number from html source
+void Eniro::loadNumber(int id, QString const& result)
+{
+    numberMap::iterator numberIt = pendingNumberRequests_.find(id);
+
+    // Make sure that id exists in pending number requests
+    if(numberIt == pendingNumberRequests_.end() || numberIt.value() == 0)
+    {
+        return;
+    }
+
+    searchMap::iterator searchIt = pendingSearches_.find(numberIt.value()->searchId);
+
+    if(searchIt == pendingSearches_.end() || searchIt.value() == 0)
+    {
+        return;
+    }
+
+    QRegExp rx(NUMBER_REGEXP);
+    rx.setMinimal(true);
+
+    int pos = 0;
+    bool error = true;
+
+    if((pos = rx.indexIn(result, pos)) != -1)
+    {
+        QString data = rx.cap(1);
+        data = stripTags(data);
+
+        QString trimmed = data.trimmed();
+
+        if(!trimmed.isEmpty())
+        {
+               // Remove whitespaces from number
+            searchIt.value()->results[numberIt.value()->index].number = cleanUpNumber(trimmed);
+
+            emit resultAvailable(searchIt.value()->results[numberIt.value()->index], searchIt.value()->details);
+
+            unsigned int found = ++searchIt.value()->foundNumbers;
+
+            // Check if all numbers have been found
+            if(found >= searchIt.value()->numbersTotal)
+            {
+               emitRequestFinished(searchIt.key(), searchIt.value(), false);
+            }
+
+            // If number was found, there was no error
+            error = false;
+        }
+    }
+
+    if(error)
+    {
+        error_ = INVALID_LOGIN;
+        errorString_ = INVALID_LOGIN;
+        emitRequestFinished(searchIt.key(), searchIt.value(), true);
+    }
+
+    // Remove number request
+    int key = numberIt.key();
+
+    delete pendingNumberRequests_[key];
+    pendingNumberRequests_[key] = 0;
+    pendingNumberRequests_.remove(key);
+
+}
+
+QUrl Eniro::createUrl(QString const& query, QString const& location)
+{
+    QUrl url(SITE_URLS[site_] + "query");
+
+    if(!query.isEmpty())
+    {
+        url.addQueryItem("search_word", query);
+    }
+
+    if(!location.isEmpty())
+    {
+        url.addQueryItem("geo_area", location);
+    }
+
+    if(maxResults_)
+    {
+        url.addQueryItem("hpp", QString::number(maxResults_));
+    }
+    if(loggedIn_)
+    {
+        url.addQueryItem("login_name", username_);
+        url.addQueryItem("login_password", password_);
+    }
+
+    QByteArray path = url.encodedQuery().replace('+', "%2B");
+    url.setEncodedQuery(path);
+
+    return url;
+}
+
+// Creates a new request for phone number retrieval
+void Eniro::getNumberForResult(int id, int index, SearchDetails const& details)
+{
+    QUrl url = createUrl(details.query, details.location);
+    url.addQueryItem("what", "mobwpinfo");
+    url.addQueryItem("search_number", QString::number(index + 1));
+
+    http_.setHost(url.host(), url.port(80));
+    int requestId = http_.get(url.encodedPath() + '?' + url.encodedQuery());
+    NumberData* number = new NumberData;
+    number->searchId = id;
+    number->index = index;
+    pendingNumberRequests_[requestId] = number;
+
+}
+
+void Eniro::emitRequestFinished(int key, SearchData* data, bool error)
+{
+
+       // Do not emit "Request aborted" error
+       if(!(error && (http_.error() == QHttp::Aborted)))
+       {
+               emit requestFinished(data->results, data->details, error);
+       }
+
+    delete pendingSearches_[key];
+    pendingSearches_[key] = 0;
+    pendingSearches_.remove(key);
+}
+
+QString Eniro::ucFirst(QString& str)
+{
+       if (str.size() < 1) {
+               return "";
+       }
+
+       QStringList tokens = str.split(" ");
+       QList<QString>::iterator tokItr;
+
+       for (tokItr = tokens.begin(); tokItr != tokens.end(); ++tokItr)
+       {
+               (*tokItr) = (*tokItr).at(0).toUpper() + (*tokItr).mid(1);
+       }
+
+       return tokens.join(" ");
+}
+
+QString& Eniro::cleanUpNumber(QString& number)
+{
+    return number.replace(numberCleaner_, "");
+}
+
+QString& Eniro::stripTags(QString& string)
+{
+    return string.replace(tagStripper_, "");
+}
+
+QMap <Eniro::Site, Eniro::SiteDetails> Eniro::getSites()
+{
+       QMap <Site, SiteDetails> sites;
+       SiteDetails details;
+       details.name = tr("Finnish");
+       details.id = "fi";
+       sites[FI] = details;
+
+       details.name = tr("Swedish");
+       details.id = "se";
+       sites[SE] = details;
+
+       details.name = tr("Danish");
+       details.id = "dk";
+       sites[DK] = details;
+
+       return sites;
+}
+
+Eniro::Site Eniro::stringToSite(QString const& str)
+{
+       Site site = FI;
+
+       QString lower = str.toLower();
+
+       if(lower == "se" || lower == "swedish")
+       {
+               site = SE;
+       }
+       else if(lower == "dk" || lower == "danish")
+       {
+               site = DK;
+       }
+
+       return site;
+}
+
+Eniro::SearchDetails::SearchDetails(QString const& q,
+                                    QString const& loc,
+                                    SearchType t)
+{
+    query = q;
+    location = loc;
+    type = t;
+}
diff --git a/src/common/eniro.h b/src/common/eniro.h
new file mode 100644 (file)
index 0000000..af3d3b1
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ENIRO_H
+#define ENIRO_H
+
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <QtCore/QVector>
+#include <QtCore/QSet>
+#include <QtCore/QRegExp>
+#include <QtCore/QUrl>
+#include <QtNetwork/QHttp>
+
+class Eniro: public QObject
+{
+    Q_OBJECT
+
+public:
+
+    enum Site {FI, SE, DK};
+
+    enum SearchType {YELLOW_PAGES, PERSONS};
+
+    enum Error {NO_ERROR, CONNECTION_FAILURE, INVALID_LOGIN};
+
+    struct Result
+    {
+        QString name;
+        QString street;
+        QString city;
+        QString number;
+    };
+
+    struct SearchDetails
+    {
+        QString query;
+        QString location;
+        SearchType type;
+        SearchDetails(QString const& query = "",
+                      QString const& location = "",
+                      SearchType type = PERSONS);
+    };
+
+    struct SiteDetails
+    {
+       QString name;
+       QString id;
+    };
+
+    Eniro(Site site, QObject *parent = 0);
+
+    ~Eniro();
+
+    void login(QString const& username, QString const& password);
+    void logout();
+    void testLogin();
+    void setSite(Site);
+    void setMaxResults(unsigned int value);
+    void setFindNumber(bool value);
+    bool search(SearchDetails const& details);
+    void abort();
+    Error error() const;
+    const QString& errorString() const;
+    static QMap<Site, SiteDetails> getSites();
+    static Site stringToSite(QString const& str);
+
+signals:
+    void resultAvailable(Eniro::Result const& result, Eniro::SearchDetails const& details);
+    void requestFinished(QVector <Eniro::Result> const& results, Eniro::SearchDetails const& details, bool error);
+    void loginStatus(bool success);
+
+private slots:
+    void httpReady(int id, bool error);
+
+private:
+
+       Q_DISABLE_COPY(Eniro);
+
+    struct NumberData
+    {
+        int searchId;
+        int index;
+    };
+
+    struct SearchData
+    {
+        SearchDetails details;
+        QVector <Result> results;
+        unsigned int foundNumbers;
+        unsigned int numbersTotal;
+    };
+
+    QUrl createUrl(QString const& query, QString const& location);
+    void loadResults(int id, QString const& data);
+    void loadNumber(int id, QString const& data);
+    void getNumberForResult(int id, int index, SearchDetails const& details);
+    void emitRequestFinished(int key, SearchData* data, bool error);
+    QString ucFirst(QString& string);
+    QString& cleanUpNumber(QString& number);
+    QString& stripTags(QString& string);
+
+    QHttp http_;
+    Site site_;
+    QString username_;
+    QString password_;
+    bool loggedIn_;
+    Error error_;
+    QString errorString_;
+    unsigned int maxResults_;
+    bool findNumber_;
+    typedef QMap <int, SearchData*> searchMap;
+    typedef QMap <int, NumberData*> numberMap;
+
+    searchMap pendingSearches_;
+    numberMap pendingNumberRequests_;
+    QSet <int> pendingLoginRequests_;
+
+    static QRegExp numberCleaner_;
+    static QRegExp tagStripper_;
+
+};
+
+#endif // ENIRO_H
+
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
new file mode 100644 (file)
index 0000000..25fc13b
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtSql/QSqlQuery>
+#include <QtCore/QVariant>
+#include "settings.h"
+#include "db.h"
+
+Settings* Settings::instance_ = 0;
+
+Settings* Settings::instance()
+{
+       if(!instance_)
+       {
+               instance_ = new Settings;
+       }
+
+       return instance_;
+}
+
+bool Settings::set(QString const& name, QString const& value)
+{
+       bool connected = DB::connected();
+
+       if(!connected)
+       {
+               if(!DB::connect())
+               {
+                       return false;
+               }
+       }
+
+       QSqlQuery deleteQuery;
+       deleteQuery.prepare("DELETE FROM settings WHERE name = :name");
+       deleteQuery.bindValue(":name", QVariant(name));
+       deleteQuery.exec();
+
+       QSqlQuery query;
+       query.prepare("INSERT INTO settings(name, value) VALUES(:name, :value)");
+       query.bindValue(":name", QVariant(name));
+       query.bindValue(":value", QVariant(value));
+
+       bool returnValue = query.exec();
+
+       if(!connected)
+       {
+               DB::disconnect();
+       }
+
+       return returnValue;
+}
+
+QString Settings::get(QString const& name)
+{
+       QString result = "";
+
+       bool connected = DB::connected();
+
+       if(!connected)
+       {
+               if(!DB::connect())
+               {
+                       return result;
+               }
+       }
+
+       QSqlQuery query;
+
+       query.prepare("SELECT value FROM settings WHERE name = :name");
+       query.bindValue(":name", name);
+
+       if(query.exec() && query.next())
+       {
+               result = query.value(0).toString();
+       }
+       else
+       {
+               result = getDefaultValue(name);
+       }
+
+       if(!connected)
+       {
+               DB::disconnect();
+       }
+
+       return result;
+
+}
+
+QString Settings::getDefaultValue(QString const& name)
+{
+       static bool defaultValuesLoaded = false;
+       static QMap <QString, QString> defaultValues;
+
+       if(!defaultValuesLoaded)
+       {
+               defaultValues["autostart"] = "1";
+               defaultValues["eniro_site"] = tr("fi");
+               defaultValues["cache_size"] = "200";
+               defaultValuesLoaded = true;
+       }
+
+       QMap<QString, QString>::const_iterator it = defaultValues.find(name);
+
+       if(it != defaultValues.end())
+       {
+               return it.value();
+       }
+
+       return "";
+
+}
+
+bool Settings::reset()
+{
+       bool connected = DB::connected();
+
+       if(!connected)
+       {
+               if(!DB::connect())
+               {
+                       return false;
+               }
+       }
+
+       QSqlQuery query;
+
+       bool ret = query.exec("DELETE FROM settings");
+
+       if(!connected)
+       {
+               DB::disconnect();
+       }
+
+       return ret;
+}
+
+Settings::Settings()
+{
+}
diff --git a/src/common/settings.h b/src/common/settings.h
new file mode 100644 (file)
index 0000000..51bdf6c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SETTINGS_H
+#define SETTINGS_H
+
+#include <QtCore/QString>
+#include <QCoreApplication>
+
+class Settings;
+
+class Settings
+{
+       Q_DECLARE_TR_FUNCTIONS(Settings)
+
+public:
+       static Settings* instance();
+       bool set(QString const& name, QString const& value);
+       QString get(QString const& name);
+       QString getDefaultValue(QString const& name);
+       bool reset();
+
+private:
+       Settings();
+       static Settings* instance_;
+
+};
+
+#endif
+
diff --git a/src/common/translations.grc b/src/common/translations.grc
new file mode 100644 (file)
index 0000000..7dd5380
--- /dev/null
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+   <file>translations/fi_FI.qm</file>
+</qresource>
+</RCC>
diff --git a/src/common/translations/fi_FI.qm b/src/common/translations/fi_FI.qm
new file mode 100644 (file)
index 0000000..88980f0
Binary files /dev/null and b/src/common/translations/fi_FI.qm differ
diff --git a/src/common/translations/fi_FI.ts b/src/common/translations/fi_FI.ts
new file mode 100644 (file)
index 0000000..91dcfb8
--- /dev/null
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fi_FI">
+<context>
+    <name>CallListener</name>
+    <message>
+        <source>Searching...</source>
+        <translation>Haetaan...</translation>
+    </message>
+    <message>
+        <source>Search failed:</source>
+        <translation>Haku epäonnistui:</translation>
+    </message>
+    <message>
+        <source>Phone number was not found</source>
+        <translation>Numeroa ei löytynyt</translation>
+    </message>
+</context>
+<context>
+    <name>DetailWindow</name>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="39"/>
+        <location filename="../../gui/detailwindow.cpp" line="106"/>
+        <source>Add to contacts</source>
+        <translation>Lisää yhteistietoihin</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="40"/>
+        <source>Copy number to clipboard</source>
+        <translation>Kopioi numero leikepöydälle</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="45"/>
+        <location filename="../../gui/detailwindow.cpp" line="109"/>
+        <source>Name</source>
+        <translation>Nimi</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="46"/>
+        <source>Street</source>
+        <translation>Katu</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="47"/>
+        <source>City</source>
+        <translation>Kaupunki</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="48"/>
+        <source>Phone number</source>
+        <translation>Puhelinnumero</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="110"/>
+        <source>Add</source>
+        <translation>Lisää</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="133"/>
+        <source>Contact was successfully added to contacts.</source>
+        <translation>Yhteystieto lisättiin onnistuneesti.</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="137"/>
+        <source>Error</source>
+        <translation>Virhe</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="137"/>
+        <source>Unable to add contact.</source>
+        <translation>Yhteystiedon lisääminen epäonnistui,</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="145"/>
+        <source>Number was successfully copied to clipboard.</source>
+        <translation>Numero kopioitiin onnistuneesti leikepöydälle.</translation>
+    </message>
+</context>
+<context>
+    <name>Eniro</name>
+    <message>
+        <location filename="../eniro.cpp" line="552"/>
+        <source>Finnish</source>
+        <translation>Suomi</translation>
+    </message>
+    <message>
+        <location filename="../eniro.cpp" line="556"/>
+        <source>Swedish</source>
+        <translation>Ruotsi</translation>
+    </message>
+    <message>
+        <location filename="../eniro.cpp" line="560"/>
+        <source>Danish</source>
+        <translation>Tanska</translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="44"/>
+        <source>Jenirok</source>
+        <translation>Jenirok</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="50"/>
+        <location filename="../../gui/mainwindow.cpp" line="114"/>
+        <source>Stop daemon</source>
+        <translation>Pysäytä</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="56"/>
+        <location filename="../../gui/mainwindow.cpp" line="107"/>
+        <source>Start daemon</source>
+        <translation>Käynnistä</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="61"/>
+        <source>Search</source>
+        <translation>Hae</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="78"/>
+        <source>Settings</source>
+        <translation>Asetukset</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="105"/>
+        <source>Daemon was successfully stopped.</source>
+        <translation>Palvelu pysäytettiin onnistuneesti.</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="106"/>
+        <source>Unable to stop daemon.</source>
+        <translation>Palvelun pysäyttäminen ei onnistunut.</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="112"/>
+        <source>Daemon was successfully started.</source>
+        <translation>Palvelu käynnistettiin onnistuneesti.</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="113"/>
+        <source>Unable to start daemon.</source>
+        <translation>Palvelun käynnistäminen ei onnistunut.</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="120"/>
+        <source>Error</source>
+        <translation>Virhe</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="143"/>
+        <source>Info</source>
+        <translation>Info</translation>
+    </message>
+    <message>
+        <location filename="../../gui/mainwindow.cpp" line="143"/>
+        <source>You need to set Eniro login details in settings before using this feature.</source>
+        <translation>Sinun täytyy asettaa Eniro-tunnus ja -salasana asetuksista ennen kuin voit käyttää tätä ominaisuutta.</translation>
+    </message>
+</context>
+<context>
+    <name>ResultWindow</name>
+    <message>
+        <location filename="../../gui/resultwindow.cpp" line="32"/>
+        <source>Search results</source>
+        <translation>Hakutulokset</translation>
+    </message>
+    <message>
+        <location filename="../../gui/resultwindow.cpp" line="138"/>
+        <source>Error</source>
+        <translation>Virhe</translation>
+    </message>
+    <message>
+        <location filename="../../gui/resultwindow.cpp" line="143"/>
+        <source>No results found</source>
+        <translation>Ei hakutuloksia</translation>
+    </message>
+</context>
+<context>
+    <name>SearchDialog</name>
+    <message>
+        <location filename="../../gui/searchdialog.cpp" line="30"/>
+        <location filename="../../gui/searchdialog.cpp" line="54"/>
+        <source>Search</source>
+        <translation>Haku</translation>
+    </message>
+    <message>
+        <location filename="../../gui/searchdialog.cpp" line="33"/>
+        <source>Name/number</source>
+        <translation>Numero/nimi</translation>
+    </message>
+    <message>
+        <location filename="../../gui/searchdialog.cpp" line="39"/>
+        <source>Location</source>
+        <translation>Sijainti</translation>
+    </message>
+    <message>
+        <location filename="../../gui/searchdialog.cpp" line="44"/>
+        <source>Type</source>
+        <translation>Tyyppi</translation>
+    </message>
+    <message>
+        <location filename="../../gui/searchdialog.cpp" line="45"/>
+        <source>Persons</source>
+        <translation>Henkilöt</translation>
+    </message>
+    <message>
+        <location filename="../../gui/searchdialog.cpp" line="46"/>
+        <source>Yellow pages</source>
+        <translation>Keltaiset sivut</translation>
+    </message>
+</context>
+<context>
+    <name>Settings</name>
+    <message>
+        <location filename="../settings.cpp" line="113"/>
+        <source>fi</source>
+        <translation>fi</translation>
+    </message>
+</context>
+<context>
+    <name>SettingsDialog</name>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="37"/>
+        <source>Settings</source>
+        <translation>Asetukset</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="47"/>
+        <source>Eniro username</source>
+        <translation>Eniro-tunnus</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="50"/>
+        <source>Eniro password</source>
+        <translation>Eniro-salasana</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="53"/>
+        <source>Cache size (numbers)</source>
+        <translation>Välimuistin koko (numeroa)</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="57"/>
+        <source>Eniro site</source>
+        <translation>Eniro-sivusto</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="73"/>
+        <source>Autostart</source>
+        <translation>Käynnistä automaattisesti</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="75"/>
+        <source>Enabled</source>
+        <translation>Kyllä</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="76"/>
+        <source>Disabled</source>
+        <translation>Ei</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="79"/>
+        <source>Save</source>
+        <translation>Tallenna</translation>
+    </message>
+    <message>
+        <location filename="../../gui/settingsdialog.cpp" line="120"/>
+        <source>Restarting daemon...</source>
+        <translation>Käynnistetään palvelu uudelleen...</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/daemon/Makefile b/src/daemon/Makefile
new file mode 100644 (file)
index 0000000..7cf83fb
--- /dev/null
@@ -0,0 +1,333 @@
+#############################################################################
+# Makefile for building: jenirokd
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Wed Apr 14 21:02:47 2010
+# Project:  daemon.pro
+# Template: app
+# Command: /usr/bin/qmake -unix -o Makefile daemon.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC            = gcc
+CXX           = g++
+DEFINES       = -DDATADIR=\"/usr/share\" -DPKGDATADIR=\"\" -DQT_NO_DEBUG -DQT_MAEMO5_LIB -DQT_SQL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -pipe -O2 -I/usr/include/evolution-data-server-1.4 -I/usr/include/dbus-1.0 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gconf/2 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/conic -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS      = -pipe -O2 -I/usr/include/evolution-data-server-1.4 -I/usr/include/dbus-1.0 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gconf/2 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/conic -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH       = -I/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++ -I. -I/targets/FREMANTLE_X86/usr/include/QtCore -I/targets/FREMANTLE_X86/usr/include/QtNetwork -I/targets/FREMANTLE_X86/usr/include/QtGui -I/targets/FREMANTLE_X86/usr/include/QtSql -I/targets/FREMANTLE_X86/usr/include/QtMaemo5 -I/targets/FREMANTLE_X86/usr/include -I/targets/FREMANTLE_X86/usr/include/QtDBus -I../common -I.
+LINK          = g++
+LFLAGS        = -Wl,-O1 -Wl,-rpath,/usr/lib
+LIBS          = $(SUBLIBS)  -L/usr/lib -lebook-1.2 -ledataserver-1.2 -lxml2 -lgconf-2 -ldbus-glib-1 -lconic -ldbus-1 -lgobject-2.0 -lglib-2.0 -L/usr/lib -lQtMaemo5 -L/usr/X11R6/lib -lQtSql -lQtGui -lQtNetwork -lQtDBus -lQtXml -lQtCore -lpthread 
+AR            = ar cqs
+RANLIB        = 
+QMAKE         = /usr/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+STRIP         = strip
+INSTALL_FILE  = install -m 644 -p
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR   = ./
+
+####### Files
+
+SOURCES       = main.cpp \
+               calllistener.cpp \
+               informationbox.cpp \
+               ../common/eniro.cpp \
+               ../common/contactmanager.cpp \
+               ../common/db.cpp \
+               ../common/settings.cpp \
+               ../common/connectionmanager.cpp moc_calllistener.cpp \
+               moc_informationbox.cpp \
+               moc_eniro.cpp \
+               moc_connectionmanager.cpp \
+               qrc_translations.cpp
+OBJECTS       = main.o \
+               calllistener.o \
+               informationbox.o \
+               eniro.o \
+               contactmanager.o \
+               db.o \
+               settings.o \
+               connectionmanager.o \
+               moc_calllistener.o \
+               moc_informationbox.o \
+               moc_eniro.o \
+               moc_connectionmanager.o \
+               qrc_translations.o
+DIST          = /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qdbus.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/dbusinterfaces.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/dbusadaptors.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               daemon.pro
+QMAKE_TARGET  = jenirokd
+DESTDIR       = 
+TARGET        = jenirokd
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+       $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET):  $(OBJECTS)  
+       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: daemon.pro  /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++/qmake.conf /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qdbus.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/dbusinterfaces.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/dbusadaptors.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               /usr/lib/libQtDBus.prl \
+               /usr/lib/libQtXml.prl \
+               /usr/lib/libQtCore.prl \
+               /usr/lib/libQtMaemo5.prl \
+               /usr/lib/libQtGui.prl \
+               /usr/lib/libQtSql.prl \
+               /usr/lib/libQtNetwork.prl
+       $(QMAKE) -unix -o Makefile daemon.pro
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/link_pkgconfig.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qdbus.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/dbusinterfaces.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/dbusadaptors.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+/usr/lib/libQtDBus.prl:
+/usr/lib/libQtXml.prl:
+/usr/lib/libQtCore.prl:
+/usr/lib/libQtMaemo5.prl:
+/usr/lib/libQtGui.prl:
+/usr/lib/libQtSql.prl:
+/usr/lib/libQtNetwork.prl:
+qmake:  FORCE
+       @$(QMAKE) -unix -o Makefile daemon.pro
+
+dist: 
+       @$(CHK_DIR_EXISTS) .tmp/jenirokd1.0.0 || $(MKDIR) .tmp/jenirokd1.0.0 
+       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/jenirokd1.0.0/ && $(COPY_FILE) --parents calllistener.h informationbox.h ../common/eniro.h ../common/contactmanager.h ../common/db.h ../common/settings.h ../common/connectionmanager.h .tmp/jenirokd1.0.0/ && $(COPY_FILE) --parents ../common/translations.grc .tmp/jenirokd1.0.0/ && $(COPY_FILE) --parents main.cpp calllistener.cpp informationbox.cpp ../common/eniro.cpp ../common/contactmanager.cpp ../common/db.cpp ../common/settings.cpp ../common/connectionmanager.cpp .tmp/jenirokd1.0.0/ && $(COPY_FILE) --parents ../common/translations/fi_FI.ts .tmp/jenirokd1.0.0/ && (cd `dirname .tmp/jenirokd1.0.0` && $(TAR) jenirokd1.0.0.tar jenirokd1.0.0 && $(COMPRESS) jenirokd1.0.0.tar) && $(MOVE) `dirname .tmp/jenirokd1.0.0`/jenirokd1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/jenirokd1.0.0
+
+
+clean:compiler_clean 
+       -$(DEL_FILE) $(OBJECTS)
+       -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+       -$(DEL_FILE) $(TARGET) 
+       -$(DEL_FILE) Makefile
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_calllistener.cpp moc_informationbox.cpp moc_eniro.cpp moc_connectionmanager.cpp
+compiler_moc_header_clean:
+       -$(DEL_FILE) moc_calllistener.cpp moc_informationbox.cpp moc_eniro.cpp moc_connectionmanager.cpp
+moc_calllistener.cpp: informationbox.h \
+               calllistener.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) calllistener.h -o moc_calllistener.cpp
+
+moc_informationbox.cpp: informationbox.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) informationbox.h -o moc_informationbox.cpp
+
+moc_eniro.cpp: ../common/eniro.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) ../common/eniro.h -o moc_eniro.cpp
+
+moc_connectionmanager.cpp: ../common/connectionmanager.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) ../common/connectionmanager.h -o moc_connectionmanager.cpp
+
+compiler_dbus_interface_source_make_all:
+compiler_dbus_interface_source_clean:
+compiler_dbus_adaptor_source_make_all:
+compiler_dbus_adaptor_source_clean:
+compiler_rcc_make_all: qrc_translations.cpp
+compiler_rcc_clean:
+       -$(DEL_FILE) qrc_translations.cpp
+qrc_translations.cpp: ../common/translations.grc \
+               ../common/translations/fi_FI.qm
+       /usr/bin/rcc -name translations ../common/translations.grc -o qrc_translations.cpp
+
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+       -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_dbus_interface_header_make_all:
+compiler_dbus_interface_header_clean:
+compiler_dbus_interface_moc_make_all:
+compiler_dbus_interface_moc_clean:
+compiler_dbus_adaptor_header_make_all:
+compiler_dbus_adaptor_header_clean:
+compiler_dbus_adaptor_moc_make_all:
+compiler_dbus_adaptor_moc_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean compiler_rcc_clean 
+
+####### Compile
+
+main.o: main.cpp calllistener.h \
+               informationbox.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+calllistener.o: calllistener.cpp calllistener.h \
+               informationbox.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o calllistener.o calllistener.cpp
+
+informationbox.o: informationbox.cpp informationbox.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o informationbox.o informationbox.cpp
+
+eniro.o: ../common/eniro.cpp ../common/eniro.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o eniro.o ../common/eniro.cpp
+
+contactmanager.o: ../common/contactmanager.cpp ../common/contactmanager.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o contactmanager.o ../common/contactmanager.cpp
+
+db.o: ../common/db.cpp ../common/db.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o db.o ../common/db.cpp
+
+settings.o: ../common/settings.cpp ../common/settings.h \
+               ../common/db.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o settings.o ../common/settings.cpp
+
+connectionmanager.o: ../common/connectionmanager.cpp ../common/connectionmanager.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o connectionmanager.o ../common/connectionmanager.cpp
+
+moc_calllistener.o: moc_calllistener.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_calllistener.o moc_calllistener.cpp
+
+moc_informationbox.o: moc_informationbox.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_informationbox.o moc_informationbox.cpp
+
+moc_eniro.o: moc_eniro.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_eniro.o moc_eniro.cpp
+
+moc_connectionmanager.o: moc_connectionmanager.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_connectionmanager.o moc_connectionmanager.cpp
+
+qrc_translations.o: qrc_translations.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_translations.o qrc_translations.cpp
+
+####### Install
+
+install_target: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/bin/ || $(MKDIR) $(INSTALL_ROOT)/usr/bin/ 
+       -$(INSTALL_PROGRAM) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
+       -$(STRIP) "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
+
+uninstall_target:  FORCE
+       -$(DEL_FILE) "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/bin/ 
+
+
+install_init: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/etc/init.d/ || $(MKDIR) $(INSTALL_ROOT)/etc/init.d/ 
+       -$(INSTALL_PROGRAM) /home/maemo/workspace/jenirok/src/daemon/data/jenirokd $(INSTALL_ROOT)/etc/init.d/
+       -strip $(INSTALL_ROOT)/etc/init.d/jenirokd
+
+
+uninstall_init:  FORCE
+       -$(DEL_FILE) -r $(INSTALL_ROOT)/etc/init.d/jenirokd
+       -$(DEL_DIR) $(INSTALL_ROOT)/etc/init.d/ 
+
+
+install:  install_target install_init  FORCE
+
+uninstall: uninstall_target uninstall_init   FORCE
+
+FORCE:
+
diff --git a/src/daemon/calllistener.cpp b/src/daemon/calllistener.cpp
new file mode 100644 (file)
index 0000000..93fb100
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtCore/QDebug>
+#include <QtSql/QSqlQuery>
+#include "calllistener.h"
+#include "settings.h"
+#include "db.h"
+
+namespace
+{
+       const QString CALL_SERVICE_NAME = "com.nokia.csd";
+       const QString CALL_SERVICE_PATH = "/com/nokia/csd/call";
+       const QString CALL_SERVICE_INTERFACE = "com.nokia.csd.Call";
+       const QString CALL_SERVICE_INSTANCE_NAME = "com.nokia.csd.Call.Instance";
+       const QString CALL_SIGNAL_INCOMING = "Coming";
+       const QString CALL_SIGNAL_RELEASE = "Release";
+       const QString CALL_SIGNAL_TERMINATED = "Terminated";
+}
+
+QDBusConnection CallListener::systemBus_ = QDBusConnection::systemBus();
+
+CallListener::CallListener(): eniro_(0), contactManager_(0), box_(0), label_(0)
+{
+}
+
+CallListener::~CallListener()
+{
+       end();
+}
+
+void CallListener::begin()
+{
+       systemBus_.connect(CALL_SERVICE_NAME,
+                                  CALL_SERVICE_PATH,
+                                  CALL_SERVICE_INTERFACE,
+                                  CALL_SIGNAL_INCOMING,
+                                  this,
+                                  SLOT(incomingCall(QDBusObjectPath, QString)));
+
+       systemBus_.connect(CALL_SERVICE_NAME,
+                                      CALL_SERVICE_PATH,
+                                      CALL_SERVICE_INTERFACE,
+                                      CALL_SIGNAL_RELEASE,
+                                      this,
+                                      SLOT(callTerminate()));
+
+       contactManager_ = new ContactManager;
+
+       eniro_ = new Eniro(Eniro::stringToSite(Settings::instance()->get("site")));
+
+       eniro_->setMaxResults(1);
+       eniro_->setFindNumber(false);
+
+       connect(eniro_, SIGNAL(requestFinished(QVector <Eniro::Result> const&,
+                       Eniro::SearchDetails const&, bool)),
+                       this, SLOT(requestFinished(QVector <Eniro::Result> const&,
+                       Eniro::SearchDetails const&, bool)));
+
+       box_ = new InformationBox();
+       label_ = new QLabel("", box_);
+       label_->setMargin(10);
+       box_->setWidget(label_);
+
+}
+
+void CallListener::end()
+{
+       systemBus_.disconnect(CALL_SERVICE_NAME,
+                                          CALL_SERVICE_PATH,
+                                          CALL_SERVICE_INTERFACE,
+                                          CALL_SIGNAL_INCOMING,
+                                          this,
+                                          SLOT(incomingCall(QDBusObjectPath, QString)));
+
+       systemBus_.disconnect(CALL_SERVICE_NAME,
+                                              CALL_SERVICE_PATH,
+                                              CALL_SERVICE_INTERFACE,
+                                              CALL_SIGNAL_RELEASE,
+                                              this,
+                                              SLOT(callTerminate()));
+
+       delete eniro_;
+       eniro_ = 0;
+       delete box_;
+       box_ = 0;
+       delete label_;
+       label_ = 0;
+}
+
+void CallListener::search(Eniro::SearchDetails const& details)
+{
+       label_->setText(tr("Searching..."));
+       box_->show();
+
+       DB::connect();
+
+       QSqlQuery query;
+       query.prepare("SELECT name, street, city FROM cache WHERE number = :number");
+       query.bindValue(":number", details.query);
+
+       if(query.exec() && query.next())
+       {
+               showResult(createResult(query.value(0).toString(),
+                               query.value(1).toString(),
+                               query.value(2).toString()));
+
+       }
+       else
+       {
+               eniro_->search(details);
+       }
+
+       DB::disconnect();
+
+}
+
+void CallListener::requestFinished(QVector <Eniro::Result> const& results,
+                                          Eniro::SearchDetails const& details,
+                                          bool error)
+{
+    qDebug() << "Found: " << results.size();
+
+    // If box is not visible, the call must have been terminated already
+    if(!box_->isVisible())
+    {
+       return;
+    }
+
+    QString message;
+
+    if(error)
+    {
+        qDebug() << "Error: " << eniro_->errorString();
+        message = tr("Search failed:") + " " + eniro_->errorString();
+    }
+    else if(results.size() == 0)
+    {
+       message = tr("Phone number was not found");
+    }
+    else
+    {
+       message = createResult(results.at(0).name, results.at(0).street, results.at(0).city);
+       QSqlQuery query;
+
+       DB::connect();
+
+       query.prepare("INSERT INTO cache(number, name, street, city) VALUES(:number, :name, :street, :city)");
+       query.bindValue(":number", details.query);
+       query.bindValue(":name", results.at(0).name);
+       query.bindValue(":street", results.at(0).street);
+       query.bindValue(":city", results.at(0).city);
+
+       if(!query.exec())
+       {
+               qDebug() << "Unable to save cache";
+       }
+
+       QString cacheSize = Settings::instance()->get("cache_size");
+
+       // Delete old entries from cache
+       if(cacheSize.toInt() > 0)
+       {
+               if(!query.exec("DELETE c1 FROM cache AS c1 LEFT JOIN (SELECT id FROM cache ORDER BY id DESC LIMIT " + cacheSize + ") AS c2 ON c1.id = c2.id WHERE c2.id IS NULL"))
+               {
+                       qDebug() << "Unable to delete old cache entries";
+               }
+       }
+
+       DB::disconnect();
+    }
+
+    showResult(message);
+
+}
+
+QString CallListener::createResult(QString const& name, QString const& street, QString const& city)
+{
+       QString result = "<b>" + name + "</b>";
+
+       if(!street.isEmpty() || !city.isEmpty())
+       {
+               result += "<br>";
+
+               if(!street.isEmpty())
+               {
+                       result += street + ", ";
+               }
+
+               result += city;
+       }
+
+       return result;
+}
+
+void CallListener::showResult(QString const& text)
+{
+       label_->setText(text);
+       box_->hide();
+       box_->show();
+}
+
+void CallListener::incomingCall(QDBusObjectPath path, QString number)
+{
+       qDebug() << number;
+
+       if(!contactManager_->numberExists(number))
+       {
+
+               systemBus_.connect(CALL_SERVICE_NAME,
+                                  path.path(),
+                                  CALL_SERVICE_INSTANCE_NAME,
+                                  CALL_SIGNAL_TERMINATED,
+                                  this,
+                                  SLOT(callTerminate()));
+
+               search(Eniro::SearchDetails(number));
+       }
+}
+
+void CallListener::callTerminate()
+{
+       box_->hide();
+}
diff --git a/src/daemon/calllistener.h b/src/daemon/calllistener.h
new file mode 100644 (file)
index 0000000..7e47306
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CALLLISTENER_H
+#define CALLLISTENER_H
+
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <QtGui/QLabel>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusObjectPath>
+#include "informationbox.h"
+#include "eniro.h"
+#include "contactmanager.h"
+
+class CallListener: public QObject
+{
+
+    Q_OBJECT
+
+public:
+    CallListener();
+    ~CallListener();
+    void begin();
+    void end();
+
+private slots:
+    void requestFinished(QVector <Eniro::Result> const& results, Eniro::SearchDetails const& details, bool error);
+    void incomingCall(QDBusObjectPath path, QString numbe);
+    void callTerminate();
+
+private:
+       Q_DISABLE_COPY(CallListener);
+
+       void search(Eniro::SearchDetails const& details);
+       void showResult(QString const& text);
+       QString createResult(QString const& name, QString const& street, QString const& city);
+    Eniro* eniro_;
+    ContactManager* contactManager_;
+    InformationBox* box_;
+    QLabel* label_;
+    static QDBusConnection systemBus_;
+};
+
+#endif // CALLLISTENER_H
diff --git a/src/daemon/daemon.pro b/src/daemon/daemon.pro
new file mode 100644 (file)
index 0000000..3a8b219
--- /dev/null
@@ -0,0 +1,32 @@
+QT += network sql maemo5
+TARGET = jenirokd
+CONFIG += qdbus
+TEMPLATE = app
+SOURCES += main.cpp calllistener.cpp informationbox.cpp ../common/eniro.cpp ../common/contactmanager.cpp ../common/db.cpp ../common/settings.cpp ../common/connectionmanager.cpp
+HEADERS += calllistener.h informationbox.h ../common/eniro.h ../common/contactmanager.h ../common/db.h ../common/settings.h ../common/connectionmanager.h
+TRANSLATIONS = ../common/translations/fi_FI.ts
+RESOURCES = ../common/translations.grc
+INCLUDEPATH += ../common
+CONFIG += link_pkgconfig
+PKGCONFIG += libebook-1.2 glib-2.0 conic
+
+unix {
+  #VARIABLES
+  isEmpty(PREFIX) {
+    PREFIX = /usr
+  }
+
+  BINDIR = $$PREFIX/bin
+  DATADIR =$$PREFIX/share
+
+  DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
+
+  #MAKE INSTALL
+
+  INSTALLS += target init
+
+  target.path =$$BINDIR
+
+  init.path = /etc/init.d
+  init.files += data/jenirokd
+}
diff --git a/src/daemon/data/jenirokd b/src/daemon/data/jenirokd
new file mode 100755 (executable)
index 0000000..4be7cda
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+NAME=jenirokd
+DAEMON=/usr/bin/jenirokd
+
+export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
+
+case "$1" in
+  start)
+        echo -n "Starting daemon: "$NAME
+       start-stop-daemon --start --background --exec $DAEMON
+        echo "."
+       ;;
+  stop)
+        echo -n "Stopping daemon: "$NAME
+       start-stop-daemon --stop --oknodo --name $NAME
+        echo "."
+       ;;
+  restart)
+        echo -n "Restarting daemon: "$NAME
+       start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
+       start-stop-daemon --start --quiet --background --exec $DAEMON
+       echo "."
+       ;;
+
+  *)
+       echo "Usage: "$0" {start|stop|restart}"
+       exit 1
+esac
+
+exit 0
+
diff --git a/src/daemon/informationbox.cpp b/src/daemon/informationbox.cpp
new file mode 100644 (file)
index 0000000..e0795a3
--- /dev/null
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include <QtGui/QDesktopWidget>
+#include <QtGui/QLabel>
+#include <QtGui/QLayout>
+#include <QtGui/QMaemo5Style>
+#include <QtGui/QStyleOption>
+#include <QtGui/QDesktopWidget>
+#include <QtGui/QMouseEvent>
+#include <QtGui/QPainter>
+
+#include <QtGui/QX11Info>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#include "informationbox.h"
+
+class InformationBoxPrivate
+{
+    Q_DECLARE_PUBLIC(InformationBox)
+
+public:
+    InformationBoxPrivate()
+        : m_timeout(InformationBox::DefaultTimeout),
+          m_timer_id(0), m_layout(0), m_widget(0), q_ptr(0)
+    { }
+
+    void enforceInformationType();
+
+    int m_timeout;
+    int m_timer_id;
+    QBoxLayout *m_layout;
+    QWidget *m_widget;
+    InformationBox *q_ptr;
+};
+
+/*!
+    Constructs an information box with no text, a default timeout
+    (\c DefaultTimeout) and the given \a parent widget.
+*/
+InformationBox::InformationBox(QWidget *parent)
+    : QDialog(parent, Qt::CustomizeWindowHint), d_ptr(new InformationBoxPrivate())
+{
+    Q_D(InformationBox);
+    d_ptr->q_ptr = this;
+
+    setAttribute(Qt::WA_X11NetWmWindowTypeNotification);
+    setAttribute(Qt::WA_ShowWithoutActivating);
+    setFocusPolicy(Qt::NoFocus);
+    d->m_layout = new QHBoxLayout(this);
+    d->m_layout->setContentsMargins(8, 0, 8, 0); // 8 == HILDON_MARGIN_DEFAULT
+    setFixedWidth(QApplication::desktop()->screenGeometry().width());
+    //move(0, 56 /*HILDON_WINDOW_TITLEBAR_HEIGHT*/);
+}
+
+/*!
+    Destroys the information box.
+*/
+InformationBox::~InformationBox()
+{ }
+
+/*! \internal
+ */
+void InformationBoxPrivate::enforceInformationType()
+{
+    Q_Q(InformationBox);
+
+    const char *type = "_HILDON_NOTIFICATION_TYPE_BANNER";
+
+    Atom atom = XInternAtom(QX11Info::display(), "_HILDON_NOTIFICATION_TYPE", False);
+
+    XChangeProperty(QX11Info::display(), q->winId(), atom, XA_STRING, 8,
+                    PropModeReplace, (unsigned char *) type, qstrlen(type));
+}
+
+/*!
+  \property InformationBox::timeout
+  \brief the timeout after which the informaton box should automatically be
+  hidden.
+
+  Setting this value while the box is already visible will reset its timer.
+
+  The timeout value can be specified as an arbitrary millisecond value,
+  although it is recommended to use the predefined values \c NoTimeout (for
+  Hildon Notes) and \c DefaultTimeout (for style guide compliant Banners).
+
+  The default value of this property is \c DefaultTimeout (3 seconds).
+*/
+
+int InformationBox::timeout() const
+{
+    Q_D(const InformationBox);
+    return d->m_timeout;
+}
+
+void InformationBox::setTimeout(unsigned int ms)
+{
+    Q_D(InformationBox);
+    d->m_timeout = ms;
+
+    // restart the timer
+    if (d->m_timeout != InformationBox::NoTimeout
+            && d->m_timer_id) {
+        killTimer(d->m_timer_id);
+        d->m_timer_id = startTimer(d->m_timeout);
+    }
+}
+
+/*!
+    Returns the central widget of the information box.
+*/
+QWidget *InformationBox::widget() const
+{
+    Q_D(const InformationBox);
+    return d->m_widget;
+}
+
+/*!
+    Sets the central widget of the information box to \a widget.
+
+    InformationBox will take ownership of \a widget by reparenting
+    it.  Any previously set widget() will be destroyed.
+*/
+void InformationBox::setWidget(QWidget *widget)
+{
+    Q_D(InformationBox);
+    delete d->m_widget;
+    d->m_widget = widget;
+    if (widget) {
+        d->m_layout->addWidget(widget);
+        widget->show();
+    }
+}
+
+/*! \reimp
+*/
+void InformationBox::showEvent(QShowEvent *)
+{
+    Q_D(InformationBox);
+
+    d->enforceInformationType();
+    if (d->m_timeout != InformationBox::NoTimeout)
+        d->m_timer_id = startTimer(d->m_timeout);
+}
+
+/*! \reimp
+*/
+void InformationBox::timerEvent(QTimerEvent *te)
+{
+    Q_D(InformationBox);
+
+    if (te->timerId() == d->m_timer_id) {
+        killTimer(d->m_timer_id);
+        hide();
+    }
+}
+
+/*! \reimp
+*/
+void InformationBox::mousePressEvent(QMouseEvent *me)
+{
+    if (me->button() == Qt::LeftButton) {
+        hide();
+        emit clicked();
+    }
+}
+
+/*! \reimp
+*/
+void InformationBox::paintEvent(QPaintEvent *)
+{
+    if (qobject_cast<QMaemo5Style*>(style())) {
+        QPainter painter(this);
+        QStyleOption option;
+        option.initFrom(this);
+        style()->drawPrimitive(static_cast<QStyle::PrimitiveElement>(QMaemo5Style::PE_Maemo5InformationBox),
+                               &option, &painter, this);
+    }
+}
+
diff --git a/src/daemon/informationbox.h b/src/daemon/informationbox.h
new file mode 100644 (file)
index 0000000..df3c7fc
--- /dev/null
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* Modifications done for Jenirok:
+ *  All boxes changed to notifications
+ *  Default timeout changed to 0
+ *  Box hides itself on click instead of closing
+ */
+
+#ifndef InformationBox_H
+#define InformationBox_H
+
+#include <QtGui/QDialog>
+
+class InformationBoxPrivate;
+
+class InformationBox: public QDialog
+{
+    Q_OBJECT
+    Q_PROPERTY(int timeout READ timeout WRITE setTimeout)
+
+public:
+    explicit InformationBox(QWidget *parent = 0);
+    ~InformationBox();
+
+    void setWidget(QWidget *widget);
+    QWidget *widget() const;
+
+    enum { NoTimeout = 0, DefaultTimeout = 0 };
+
+    void setTimeout(unsigned int ms);
+    int timeout() const;
+
+signals:
+    void clicked();
+
+protected:
+    void showEvent(QShowEvent *se);
+    void timerEvent(QTimerEvent *te);
+    void mousePressEvent(QMouseEvent *me);
+    void paintEvent(QPaintEvent *pe);
+
+protected:
+    QScopedPointer<InformationBoxPrivate> d_ptr;
+
+private:
+    Q_DISABLE_COPY(InformationBox)
+    Q_DECLARE_PRIVATE(InformationBox)
+};
+
+#endif // InformationBox_H
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
new file mode 100644 (file)
index 0000000..e069e26
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QTranslator>
+#include <QtCore/QLocale>
+#include <QtGui/QApplication>
+#include "calllistener.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+
+    QTranslator translator;
+    translator.load(":/translations/" + QLocale::system().name());
+    app.installTranslator(&translator);
+
+    CallListener listener;
+
+    listener.begin();
+
+    return app.exec();
+
+}
diff --git a/src/gui/Makefile b/src/gui/Makefile
new file mode 100644 (file)
index 0000000..7d03770
--- /dev/null
@@ -0,0 +1,433 @@
+#############################################################################
+# Makefile for building: jenirok
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Wed Apr 14 21:02:34 2010
+# Project:  gui.pro
+# Template: app
+# Command: /usr/bin/qmake -unix -o Makefile gui.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC            = gcc
+CXX           = g++
+DEFINES       = -DDATADIR=\"/usr/share\" -DPKGDATADIR=\"\" -DQT_NO_DEBUG -DQT_MAEMO5_LIB -DQT_SQL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -pipe -O2 -I/usr/include/evolution-data-server-1.4 -I/usr/include/dbus-1.0 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gconf/2 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/conic -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS      = -pipe -O2 -I/usr/include/evolution-data-server-1.4 -I/usr/include/dbus-1.0 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gconf/2 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/conic -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH       = -I/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++ -I. -I/targets/FREMANTLE_X86/usr/include/QtCore -I/targets/FREMANTLE_X86/usr/include/QtNetwork -I/targets/FREMANTLE_X86/usr/include/QtGui -I/targets/FREMANTLE_X86/usr/include/QtSql -I/targets/FREMANTLE_X86/usr/include/QtMaemo5 -I/targets/FREMANTLE_X86/usr/include -I../common -I.
+LINK          = g++
+LFLAGS        = -Wl,-O1 -Wl,-rpath,/usr/lib
+LIBS          = $(SUBLIBS)  -L/usr/lib -lebook-1.2 -ledataserver-1.2 -lxml2 -lgconf-2 -ldbus-glib-1 -lconic -ldbus-1 -lgobject-2.0 -lglib-2.0 -lQtMaemo5 -L/usr/lib -L/usr/X11R6/lib -lQtSql -lQtGui -lQtNetwork -lQtDBus -lQtXml -lQtCore -lpthread 
+AR            = ar cqs
+RANLIB        = 
+QMAKE         = /usr/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+STRIP         = strip
+INSTALL_FILE  = install -m 644 -p
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR   = ./
+
+####### Files
+
+SOURCES       = main.cpp \
+               mainwindow.cpp \
+               searchdialog.cpp \
+               resultwindow.cpp \
+               detailwindow.cpp \
+               settingsdialog.cpp \
+               buttonselector.cpp \
+               daemon.cpp \
+               ../common/eniro.cpp \
+               ../common/contactmanager.cpp \
+               ../common/db.cpp \
+               ../common/settings.cpp \
+               ../common/connectionmanager.cpp moc_mainwindow.cpp \
+               moc_searchdialog.cpp \
+               moc_resultwindow.cpp \
+               moc_detailwindow.cpp \
+               moc_settingsdialog.cpp \
+               moc_eniro.cpp \
+               moc_connectionmanager.cpp \
+               qrc_icons.cpp \
+               qrc_translations.cpp
+OBJECTS       = main.o \
+               mainwindow.o \
+               searchdialog.o \
+               resultwindow.o \
+               detailwindow.o \
+               settingsdialog.o \
+               buttonselector.o \
+               daemon.o \
+               eniro.o \
+               contactmanager.o \
+               db.o \
+               settings.o \
+               connectionmanager.o \
+               moc_mainwindow.o \
+               moc_searchdialog.o \
+               moc_resultwindow.o \
+               moc_detailwindow.o \
+               moc_settingsdialog.o \
+               moc_eniro.o \
+               moc_connectionmanager.o \
+               qrc_icons.o \
+               qrc_translations.o
+DIST          = /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               gui.pro
+QMAKE_TARGET  = jenirok
+DESTDIR       = 
+TARGET        = jenirok
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+       $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET):  $(OBJECTS)  
+       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: gui.pro  /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++/qmake.conf /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf \
+               /usr/lib/libQtMaemo5.prl \
+               /usr/lib/libQtDBus.prl \
+               /usr/lib/libQtXml.prl \
+               /usr/lib/libQtCore.prl \
+               /usr/lib/libQtGui.prl \
+               /usr/lib/libQtSql.prl \
+               /usr/lib/libQtNetwork.prl
+       $(QMAKE) -unix -o Makefile gui.pro
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/release.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/link_pkgconfig.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+/usr/lib/libQtMaemo5.prl:
+/usr/lib/libQtDBus.prl:
+/usr/lib/libQtXml.prl:
+/usr/lib/libQtCore.prl:
+/usr/lib/libQtGui.prl:
+/usr/lib/libQtSql.prl:
+/usr/lib/libQtNetwork.prl:
+qmake:  FORCE
+       @$(QMAKE) -unix -o Makefile gui.pro
+
+dist: 
+       @$(CHK_DIR_EXISTS) .tmp/jenirok1.0.0 || $(MKDIR) .tmp/jenirok1.0.0 
+       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/jenirok1.0.0/ && $(COPY_FILE) --parents mainwindow.h searchdialog.h resultwindow.h detailwindow.h settingsdialog.h buttonselector.h daemon.h ../common/eniro.h ../common/contactmanager.h ../common/db.h ../common/settings.h ../common/connectionmanager.h .tmp/jenirok1.0.0/ && $(COPY_FILE) --parents icons.grc ../common/translations.grc .tmp/jenirok1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp searchdialog.cpp resultwindow.cpp detailwindow.cpp settingsdialog.cpp buttonselector.cpp daemon.cpp ../common/eniro.cpp ../common/contactmanager.cpp ../common/db.cpp ../common/settings.cpp ../common/connectionmanager.cpp .tmp/jenirok1.0.0/ && $(COPY_FILE) --parents ../common/translations/fi_FI.ts .tmp/jenirok1.0.0/ && (cd `dirname .tmp/jenirok1.0.0` && $(TAR) jenirok1.0.0.tar jenirok1.0.0 && $(COMPRESS) jenirok1.0.0.tar) && $(MOVE) `dirname .tmp/jenirok1.0.0`/jenirok1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/jenirok1.0.0
+
+
+clean:compiler_clean 
+       -$(DEL_FILE) $(OBJECTS)
+       -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+       -$(DEL_FILE) $(TARGET) 
+       -$(DEL_FILE) Makefile
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_mainwindow.cpp moc_searchdialog.cpp moc_resultwindow.cpp moc_detailwindow.cpp moc_settingsdialog.cpp moc_eniro.cpp moc_connectionmanager.cpp
+compiler_moc_header_clean:
+       -$(DEL_FILE) moc_mainwindow.cpp moc_searchdialog.cpp moc_resultwindow.cpp moc_detailwindow.cpp moc_settingsdialog.cpp moc_eniro.cpp moc_connectionmanager.cpp
+moc_mainwindow.cpp: searchdialog.h \
+               buttonselector.h \
+               settingsdialog.h \
+               mainwindow.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
+
+moc_searchdialog.cpp: buttonselector.h \
+               searchdialog.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) searchdialog.h -o moc_searchdialog.cpp
+
+moc_resultwindow.cpp: searchdialog.h \
+               buttonselector.h \
+               resultwindow.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) resultwindow.h -o moc_resultwindow.cpp
+
+moc_detailwindow.cpp: searchdialog.h \
+               buttonselector.h \
+               detailwindow.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) detailwindow.h -o moc_detailwindow.cpp
+
+moc_settingsdialog.cpp: buttonselector.h \
+               settingsdialog.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) settingsdialog.h -o moc_settingsdialog.cpp
+
+moc_eniro.cpp: ../common/eniro.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) ../common/eniro.h -o moc_eniro.cpp
+
+moc_connectionmanager.cpp: ../common/connectionmanager.h
+       /usr/bin/moc $(DEFINES) $(INCPATH) ../common/connectionmanager.h -o moc_connectionmanager.cpp
+
+compiler_rcc_make_all: qrc_icons.cpp qrc_translations.cpp
+compiler_rcc_clean:
+       -$(DEL_FILE) qrc_icons.cpp qrc_translations.cpp
+qrc_icons.cpp: icons.grc \
+               icons/stop.png \
+               icons/start.png
+       /usr/bin/rcc -name icons icons.grc -o qrc_icons.cpp
+
+qrc_translations.cpp: ../common/translations.grc \
+               ../common/translations/fi_FI.qm
+       /usr/bin/rcc -name translations ../common/translations.grc -o qrc_translations.cpp
+
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+       -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean compiler_rcc_clean 
+
+####### Compile
+
+main.o: main.cpp mainwindow.h \
+               searchdialog.h \
+               buttonselector.h \
+               settingsdialog.h \
+               resultwindow.h \
+               detailwindow.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+mainwindow.o: mainwindow.cpp mainwindow.h \
+               searchdialog.h \
+               buttonselector.h \
+               settingsdialog.h \
+               daemon.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
+
+searchdialog.o: searchdialog.cpp searchdialog.h \
+               buttonselector.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o searchdialog.o searchdialog.cpp
+
+resultwindow.o: resultwindow.cpp resultwindow.h \
+               searchdialog.h \
+               buttonselector.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o resultwindow.o resultwindow.cpp
+
+detailwindow.o: detailwindow.cpp detailwindow.h \
+               searchdialog.h \
+               buttonselector.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o detailwindow.o detailwindow.cpp
+
+settingsdialog.o: settingsdialog.cpp settingsdialog.h \
+               buttonselector.h \
+               daemon.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o settingsdialog.o settingsdialog.cpp
+
+buttonselector.o: buttonselector.cpp buttonselector.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o buttonselector.o buttonselector.cpp
+
+daemon.o: daemon.cpp daemon.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o daemon.o daemon.cpp
+
+eniro.o: ../common/eniro.cpp ../common/eniro.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o eniro.o ../common/eniro.cpp
+
+contactmanager.o: ../common/contactmanager.cpp ../common/contactmanager.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o contactmanager.o ../common/contactmanager.cpp
+
+db.o: ../common/db.cpp ../common/db.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o db.o ../common/db.cpp
+
+settings.o: ../common/settings.cpp ../common/settings.h \
+               ../common/db.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o settings.o ../common/settings.cpp
+
+connectionmanager.o: ../common/connectionmanager.cpp ../common/connectionmanager.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o connectionmanager.o ../common/connectionmanager.cpp
+
+moc_mainwindow.o: moc_mainwindow.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
+
+moc_searchdialog.o: moc_searchdialog.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_searchdialog.o moc_searchdialog.cpp
+
+moc_resultwindow.o: moc_resultwindow.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_resultwindow.o moc_resultwindow.cpp
+
+moc_detailwindow.o: moc_detailwindow.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_detailwindow.o moc_detailwindow.cpp
+
+moc_settingsdialog.o: moc_settingsdialog.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_settingsdialog.o moc_settingsdialog.cpp
+
+moc_eniro.o: moc_eniro.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_eniro.o moc_eniro.cpp
+
+moc_connectionmanager.o: moc_connectionmanager.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_connectionmanager.o moc_connectionmanager.cpp
+
+qrc_icons.o: qrc_icons.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_icons.o qrc_icons.cpp
+
+qrc_translations.o: qrc_translations.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_translations.o qrc_translations.cpp
+
+####### Install
+
+install_target: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/bin/ || $(MKDIR) $(INSTALL_ROOT)/usr/bin/ 
+       -$(INSTALL_PROGRAM) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
+       -$(STRIP) "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
+
+uninstall_target:  FORCE
+       -$(DEL_FILE) "$(INSTALL_ROOT)/usr/bin/$(QMAKE_TARGET)"
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/bin/ 
+
+
+install_desktop: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/applications/hildon/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/applications/hildon/ 
+       -$(INSTALL_FILE) /home/maemo/workspace/jenirok/src/gui/data/jenirok.desktop $(INSTALL_ROOT)/usr/share/applications/hildon/
+
+
+uninstall_desktop:  FORCE
+       -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/applications/hildon/jenirok.desktop
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/applications/hildon/ 
+
+
+install_iconxpm: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/pixmap/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/pixmap/ 
+       -$(INSTALL_PROGRAM) /home/maemo/workspace/jenirok/src/gui/data/maemo/jenirok.xpm $(INSTALL_ROOT)/usr/share/pixmap/
+       -strip $(INSTALL_ROOT)/usr/share/pixmap/jenirok.xpm
+
+
+uninstall_iconxpm:  FORCE
+       -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/pixmap/jenirok.xpm
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/pixmap/ 
+
+
+install_icon26: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/icons/hicolor/26x26/apps/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/26x26/apps/ 
+       -$(INSTALL_FILE) /home/maemo/workspace/jenirok/src/gui/data/26x26/jenirok.png $(INSTALL_ROOT)/usr/share/icons/hicolor/26x26/apps/
+
+
+uninstall_icon26:  FORCE
+       -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/icons/hicolor/26x26/apps/jenirok.png
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/26x26/apps/ 
+
+
+install_icon48: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/icons/hicolor/48x48/apps/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/48x48/apps/ 
+       -$(INSTALL_FILE) /home/maemo/workspace/jenirok/src/gui/data/48x48/jenirok.png $(INSTALL_ROOT)/usr/share/icons/hicolor/48x48/apps/
+
+
+uninstall_icon48:  FORCE
+       -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/icons/hicolor/48x48/apps/jenirok.png
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/48x48/apps/ 
+
+
+install_icon64: first FORCE
+       @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ 
+       -$(INSTALL_FILE) /home/maemo/workspace/jenirok/src/gui/data/64x64/jenirok.png $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/
+
+
+uninstall_icon64:  FORCE
+       -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/jenirok.png
+       -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/icons/hicolor/64x64/apps/ 
+
+
+install:  install_target install_desktop install_iconxpm install_icon26 install_icon48 install_icon64  FORCE
+
+uninstall: uninstall_target uninstall_desktop uninstall_iconxpm uninstall_icon26 uninstall_icon48 uninstall_icon64   FORCE
+
+FORCE:
+
diff --git a/src/gui/buttonselector.cpp b/src/gui/buttonselector.cpp
new file mode 100644 (file)
index 0000000..67ef3db
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtGui/QStandardItem>
+#include "buttonselector.h"
+
+ButtonSelector::ButtonSelector(QString const& text, QWidget* parent): QMaemo5ValueButton(text, parent),
+selector_(0), model_(0)
+{
+       setValueLayout(QMaemo5ValueButton::ValueBesideText);
+       selector_ = new QMaemo5ListPickSelector(this);
+       model_ = new QStandardItemModel(0, 1);
+       selector_->setModel(model_);
+       setPickSelector(selector_);
+}
+
+void ButtonSelector::addItem(QString const& text)
+{
+       addItem(text, QVariant(text));
+}
+
+void ButtonSelector::addItem(QString const& text, QVariant const& value)
+{
+       QStandardItem* item = new QStandardItem(text);
+       item->setData(value, Qt::UserRole);
+       item->setTextAlignment(Qt::AlignCenter);
+       item->setEditable(false);
+       model_->appendRow(item);
+
+       if(selector_->currentIndex() < 0)
+       {
+               selector_->setCurrentIndex(0);
+       }
+}
+
+void ButtonSelector::clear()
+{
+       model_->clear();
+}
+
+void ButtonSelector::setCurrentIndex(int index)
+{
+       selector_->setCurrentIndex(index);
+}
+
+int ButtonSelector::currentIndex() const
+{
+       return selector_->currentIndex();
+}
+
+QString ButtonSelector::text() const
+{
+       return selector_->currentValueText();
+}
+
+QVariant ButtonSelector::value() const
+{
+       int currentIndex = selector_->currentIndex();
+
+       if(currentIndex < 0)
+       {
+               return QVariant("");
+       }
+
+       QStandardItem* item = model_->item(currentIndex);
+
+       return item->data(Qt::UserRole);
+}
diff --git a/src/gui/buttonselector.h b/src/gui/buttonselector.h
new file mode 100644 (file)
index 0000000..74f878e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef BUTTONSELECTOR_H
+#define BUTTONSELECTOR_H
+
+#include <QtCore/QVariant>
+#include <QtCore/QString>
+#include <QtGui/QStandardItemModel>
+#include <QMaemo5ValueButton>
+#include <QMaemo5ListPickSelector>
+
+class ButtonSelector : public QMaemo5ValueButton
+{
+public:
+       ButtonSelector(QString const& text, QWidget* parent = 0);
+       void addItem(QString const& text);
+       void addItem(QString const& text, QVariant const& value);
+       void clear();
+       void setCurrentIndex(int index);
+       int currentIndex() const;
+       QString text() const;
+       QVariant value() const;
+
+private:
+       QMaemo5ListPickSelector* selector_;
+       QStandardItemModel* model_;
+
+};
+
+#endif
diff --git a/src/gui/daemon.cpp b/src/gui/daemon.cpp
new file mode 100644 (file)
index 0000000..32a3f1a
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtCore/QProcess>
+#include <QDebug>
+#include "daemon.h"
+
+namespace
+{
+       const QString DAEMON_NAME = "jenirokd";
+       const QString INIT_DIR = "/etc/init.d";
+       const QString AUTOSTART_ENABLE = "update-rc.d jenirokd defaults 99";
+       const QString AUTOSTART_DISABLE = "update-rc.d -f jenirokd remove";
+}
+
+bool Daemon::start()
+{
+       QProcess proc;
+       proc.start(INIT_DIR + "/" + DAEMON_NAME, QStringList() << "start");
+
+    proc.waitForStarted();
+    proc.waitForFinished();
+
+       if(proc.exitCode() != 0)
+       {
+               return false;
+       }
+
+       return true;
+}
+
+bool Daemon::stop()
+{
+       QProcess proc;
+       proc.start(INIT_DIR + "/" + DAEMON_NAME, QStringList() << "stop");
+
+       proc.waitForStarted();
+       proc.waitForFinished();
+
+       if(proc.exitCode() != 0)
+       {
+               return false;
+       }
+
+       return true;
+}
+
+bool Daemon::restart()
+{
+       stop();
+       return start();
+}
+
+bool Daemon::isRunning()
+{
+       QProcess proc;
+
+       proc.start("pgrep", QStringList() << "-n" << DAEMON_NAME);
+
+       if(!proc.waitForStarted())
+       {
+               return false;
+       }
+
+       if(!proc.waitForFinished())
+       {
+               return false;
+       }
+
+       QString result = proc.readAll();
+
+       return !result.isEmpty();
+}
+
+bool Daemon::setAutostart(bool enabled)
+{
+       QProcess proc;
+
+       if(enabled)
+       {
+               proc.start(AUTOSTART_ENABLE);
+       }
+       else
+       {
+               proc.start(AUTOSTART_DISABLE);
+       }
+
+       proc.waitForStarted();
+       proc.waitForFinished();
+
+       if(proc.exitCode() != 0)
+       {
+               return false;
+       }
+
+       return true;
+
+}
+
+Daemon::Daemon()
+{
+}
diff --git a/src/gui/daemon.h b/src/gui/daemon.h
new file mode 100644 (file)
index 0000000..b6c65ab
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DAEMON_H
+#define DAEMON_H
+
+class Daemon
+{
+public:
+
+       static bool start();
+       static bool stop();
+       static bool restart();
+       static bool isRunning();
+       static bool setAutostart(bool enabled);
+
+private:
+       Daemon();
+};
+
+
+#endif
diff --git a/src/gui/data/26x26/jenirok.png b/src/gui/data/26x26/jenirok.png
new file mode 100644 (file)
index 0000000..09e7eef
Binary files /dev/null and b/src/gui/data/26x26/jenirok.png differ
diff --git a/src/gui/data/48x48/jenirok.png b/src/gui/data/48x48/jenirok.png
new file mode 100644 (file)
index 0000000..15378ef
Binary files /dev/null and b/src/gui/data/48x48/jenirok.png differ
diff --git a/src/gui/data/64x64/jenirok.png b/src/gui/data/64x64/jenirok.png
new file mode 100644 (file)
index 0000000..4f40c0c
Binary files /dev/null and b/src/gui/data/64x64/jenirok.png differ
diff --git a/src/gui/data/jenirok.desktop b/src/gui/data/jenirok.desktop
new file mode 100644 (file)
index 0000000..514e7d7
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=0.1.0
+Type=Application
+Name=Jenirok
+Exec=/usr/bin/jenirok
+Icon=jenirok
+X-Window-Icon=jenirok
+X-Window-Icon-Dimmed=jenirok
diff --git a/src/gui/data/maemo/jenirok.xpm b/src/gui/data/maemo/jenirok.xpm
new file mode 100755 (executable)
index 0000000..b959baf
--- /dev/null
@@ -0,0 +1,326 @@
+/* XPM */
+static char *jenirok[] = {
+/* columns rows colors chars-per-pixel */
+"64 64 256 2",
+"   c #000000",
+".  c #0C0B0C",
+"X  c #080607",
+"o  c #1F0202",
+"O  c #130A0A",
+"+  c #1B0B0B",
+"@  c #120505",
+"#  c #13120A",
+"$  c #0E0E11",
+"%  c #010A18",
+"&  c #060B13",
+"*  c #121213",
+"=  c #1B1A1A",
+"-  c #191915",
+";  c #210303",
+":  c #281818",
+">  c #3B1414",
+",  c #2E2D09",
+"<  c #252508",
+"1  c #3A3808",
+"2  c #373615",
+"3  c #302E09",
+"4  c #020F22",
+"5  c #051124",
+"6  c #0E192B",
+"7  c #0A1423",
+"8  c #111D2E",
+"9  c #111823",
+"0  c #141F30",
+"q  c #152132",
+"w  c #242322",
+"e  c #2B2A29",
+"r  c #312D2D",
+"t  c #3E3A3A",
+"y  c #353432",
+"u  c #461515",
+"i  c #4C1212",
+"p  c #671717",
+"a  c #6F1414",
+"s  c #463333",
+"d  c #7B2525",
+"f  c #682020",
+"g  c #555314",
+"h  c #6C6A27",
+"j  c #74742C",
+"k  c #5E5C2A",
+"l  c #1B2E4B",
+"z  c #193053",
+"x  c #072E67",
+"c  c #0D326B",
+"v  c #153A72",
+"b  c #11366F",
+"n  c #1D4177",
+"m  c #21457D",
+"M  c #4A4A48",
+"N  c #5B5C56",
+"B  c #565549",
+"V  c #645F5F",
+"C  c #6E6E4D",
+"Z  c #696666",
+"A  c #757171",
+"S  c #860C0C",
+"D  c #871515",
+"F  c #981313",
+"G  c #BB1818",
+"H  c #8C2828",
+"J  c #953838",
+"K  c #912F2F",
+"L  c #BB3636",
+"P  c #DA0F0F",
+"I  c #DD1414",
+"U  c #DE1B1B",
+"Y  c #D51717",
+"T  c #E81717",
+"R  c #CF3838",
+"E  c #E02222",
+"W  c #ED2323",
+"Q  c #E22929",
+"!  c #ED2B2B",
+"~  c #E33434",
+"^  c #E53C3C",
+"/  c #E83535",
+"(  c #F23B3B",
+")  c #F02D2D",
+"_  c #817B19",
+"`  c #A26060",
+"'  c #D84848",
+"]  c #DA5656",
+"[  c #C64E4E",
+"{  c #E64444",
+"}  c #EC4545",
+"|  c #E94B4B",
+" . c #F34545",
+".. c #F54C4C",
+"X. c #F84B4B",
+"o. c #EC5454",
+"O. c #EE5A5A",
+"+. c #FB5959",
+"@. c #F36262",
+"#. c #B9B21B",
+"$. c #BBB517",
+"%. c #B4AE1D",
+"&. c #908F36",
+"*. c #A39B20",
+"=. c #B4AD21",
+"-. c #ADA933",
+";. c #8C8615",
+":. c #C4BF29",
+">. c #E7DF1D",
+",. c #EAE21D",
+"<. c #ECE516",
+"1. c #F4ED1B",
+"2. c #E5DD23",
+"3. c #E1D72A",
+"4. c #E3DA29",
+"5. c #E9DF2A",
+"6. c #EEE524",
+"7. c #EBE12C",
+"8. c #EFE82D",
+"9. c #F2E825",
+"0. c #FAF22B",
+"q. c #F4E830",
+"w. c #89894D",
+"e. c #B6B458",
+"r. c #B3B149",
+"t. c #84847D",
+"y. c #C2BE46",
+"u. c #D1CD4E",
+"i. c #D7D557",
+"p. c #CBC94D",
+"a. c #F3EE4F",
+"s. c #E8E65A",
+"d. c #F4EF51",
+"f. c #F2EF5D",
+"g. c #F6F254",
+"h. c #FEFA55",
+"j. c #F9F65A",
+"k. c #FCFA5D",
+"l. c #FAF552",
+"z. c #DEDD62",
+"x. c #C2C261",
+"c. c #E0DF66",
+"v. c #FDFC63",
+"b. c #FFFF6C",
+"n. c #EEED6C",
+"m. c #E1DC49",
+"M. c #0A4CAF",
+"N. c #0D50B5",
+"B. c #0D52BB",
+"V. c #1052B6",
+"C. c #1355B9",
+"Z. c #1658BB",
+"A. c #1A5BBE",
+"S. c #0A4CB0",
+"D. c #2F5A9C",
+"F. c #4067A1",
+"G. c #426AA6",
+"H. c #1D5FC1",
+"J. c #145AC4",
+"K. c #0D55C0",
+"L. c #1D61C8",
+"P. c #2263C5",
+"I. c #2566C9",
+"U. c #2869CA",
+"Y. c #3170CF",
+"T. c #3C73C5",
+"R. c #3675D2",
+"E. c #3B78D5",
+"W. c #3E7BD9",
+"Q. c #3477DC",
+"!. c #286DD5",
+"~. c #3C7EE0",
+"^. c #417EDA",
+"/. c #487CC9",
+"(. c #4482DD",
+"). c #4C81D3",
+"_. c #4985E0",
+"`. c #4D89E3",
+"'. c #4685E5",
+"]. c #528EE6",
+"[. c #538FE9",
+"{. c #5691EA",
+"}. c #5895EE",
+"|. c #5D9CF8",
+" X c #60A0FF",
+".X c #8C8685",
+"XX c #938888",
+"oX c #97989A",
+"OX c #9A9A9B",
+"+X c #999494",
+"@X c #8D8F90",
+"#X c #A49999",
+"$X c #ACAC9E",
+"%X c #A5A599",
+"&X c #9F9FA1",
+"*X c #9EA0A4",
+"=X c #A4A2A3",
+"-X c #A8A8A8",
+";X c #B7A9A9",
+":X c #B3B2A6",
+">X c #B8B7B5",
+",X c #A7ACB2",
+"<X c #C9B9B9",
+"1X c #CECDB8",
+"2X c #F7F4A6",
+"3X c #F8F5A5",
+"4X c #F6F3A9",
+"5X c #F9F6AC",
+"6X c #F8F6B3",
+"7X c #FAF8BD",
+"8X c #F8F6B9",
+"9X c #BEBFC1",
+"0X c #BFC0C2",
+"qX c #BAD2F4",
+"wX c #CBCBCC",
+"eX c #CCC6C4",
+"rX c #D6CCCB",
+"tX c #D4D3D3",
+"yX c #DDD2D2",
+"uX c #DADAD7",
+"iX c #CFCFD0",
+"pX c #F5C2C2",
+"aX c #F9C4C4",
+"sX c #F9CBCB",
+"dX c #F5CBCB",
+"fX c #E2D6D6",
+"gX c #E5DADA",
+"hX c #E9DEDE",
+"jX c #EDD0D0",
+"kX c #FCD3D3",
+"lX c #FDDBDB",
+"zX c #F3D9D9",
+"xX c #FBF9C3",
+"cX c #FCFACD",
+"vX c #E6E6D7",
+"bX c #FEFED3",
+"nX c #FDFDDD",
+"mX c #C8DBF6",
+"MX c #DADDE1",
+"NX c #DCE3EE",
+"BX c #D6E4F9",
+"VX c #EBE3E3",
+"CX c #F1E5E5",
+"ZX c #FFE3E3",
+"AX c #FEEAEA",
+"SX c #F4EAEA",
+"DX c #FDFDE3",
+"FX c #FDFDEA",
+"GX c #F5F5E9",
+"HX c #E3EDFC",
+"JX c #E9EEF6",
+"KX c #EAF2FC",
+"LX c #FFFFF3",
+"PX c #FDFFFD",
+"IX c #FCF5F6",
+"UX c None",
+/* pixels */
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX                                                                                UX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX                                                                                  UX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX                                                                                    ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    C w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.C .     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    x.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.n.*     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.c.*     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.c.*     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.z.$     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.v.v.v.v.v.v.v.v.v.v.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.z.$     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.v.v.v.v.v.b.b.v.s.u.p.p.i.s.v.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.z.$     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.v.v.v.v.f.r.h 2 #         # 2 j y.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.z.$     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.v.v.s.&.<                         2 &.j.v.k.k.k.k.k.k.k.k.k.k.k.k.k.k.i.$     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    e.v.-.<       w N XX%X:X:X%Xt.M -       2 r.v.k.k.k.k.k.k.k.k.k.k.k.k.k.i.$     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    r.h       M :XGXLXLXLXLXLXLXLXLXvXOXy       &.k.k.j.j.j.j.j.j.j.j.j.j.k.i.$     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX  X -     w :XFXLXDXDXDXDXDXDXDXDXFXFXPXGX@X$     h k.k.j.j.j.j.j.j.j.j.j.k.i..     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX        M vXLXDXnXnXnXnXnXnXnXDXDXDXDXFXFXPXwXe     j k.j.j.j.j.j.j.j.j.j.k.i..     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX      N GXFXnXnXnXnXnXnXnXnXnXnXDXDXDXDXFXFXPXvXy     &.k.g.g.g.g.g.g.g.g.h.i..     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    M GXFXnXnXnXnXnXnXnXnXnXnXnXDXDXDXDXDXFXFXPXvXw   O u.h.g.g.g.g.g.g.g.h.i..     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    = vXFXDXnXnXnXnXnXnXnXnXnXDXDXDXDXDXDXDXDXFXFXPX1XX   g h.g.g.g.g.g.g.g.h.u..     ",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX      @XGXvXvXvXvXvXvXvXnXnXnXDXDXDXDXDXDXDXDXDXDXFXFXPXA     y.h.g.g.g.g.g.g.l.u..     ",
+"                                            y VXuXwXwXwXwXwXwXwXuXDXDXDXDXDXDXDXDXDXDXDXDXDXFXLXvX*   k h.d.d.d.d.d.d.l.u..     ",
+"                                            @XVXtXwXwXwXwXwXtXiXtXDXDXDXDXDXDXDXDXDXDXDXDXDXFXFXPXZ   # m.l.a.a.a.a.a.l.u..     ",
+"    9 G.F.F.F.F.F.F.F.F.F.F.F.F.F.F.G.l   * MXJXNXNXNXNXNXNXtXtXuXDXnXbXcXxXxXxX7X7X7XxXxXcXnXDXLX>X    -.h.d.d.d.d.d.l.u..     ",
+"    q |.|.|.|.|.|.|.|.|.|.|.|.|.|.|. Xl   M PXKXHXHXHXHXHXHXuXwXeX8X5X5X5X5X5X5X5X5X5X5X5X5X6X7XbXvX=   h 0.8.8.8.8.8.0.:.      ",
+"    q }.{.{.{.{.{.{.{.{.{.{.{.{.{.}.].7   Z PXHXHXHXHXHXHXHX9X&X%X3X3X3X3X3X3X3X3X3X3X3X3X3X5X6X7XbXy   g 1.<.<.<.<.<.1.$.      ",
+"    q }.{.{.{.{.{.{.{.{.{.{.{.{.{.}.).&   .XPXHXHXHXHXHXBXmX*XoX$X2X3X2X2X2X2X2X2X2X2X2X2X2X4X6X7XbXB   3 ,.,.,.,.,.,.1.$.      ",
+"    q {.{.].].].].].].].].].].].].{./.X   @XPXHXHXHXHXBXqXqX=XoX$X2X2X2X2X2X2X2X2X2X2X2X2X2X4X6X7XbXN   , >.,.,.,.,.,.1.$.      ",
+"    0 [.].].].].].].].].].].].].].{./.&   @XPXKXHXHXmXqXqXqX=XoX$X4X4X4X4X4X4X4X4X4X4X4X4X4X4X6X7XbXN   , >.,.,.,.,.,.1.$.      ",
+"    8 ].`.`.`.`.`.`.`.`.`.`.`.`.`.].).&   A PXKXHXBXqXqXqXqX=XoX$X4X4X4X4X4X4X4X4X4X4X4X4X4X4X6X7XbXM   1 6.,.,.,.,.,.9.#.      ",
+"    8 `.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.6   N PXKXBXqXqXqXqXqX=XoX$X4X4X4X4X4X4X4X4X4X4X4X4X4X5X8XxXcXe   g 9.2.2.2.2.2.9.#.      ",
+"    8 `._._._._._._._._._._._._._._.[.z   e KXKXmXqXqXqXqXqX=XoX$X4X4X4X4X4X4X4X4X4X4X4X4X4X6X8XcX1X.   ;.0.6.2.2.2.2.6.#.      ",
+"    8 _.(.(.(.(.(.(.(.(.(.(.(.(.(.(.'.D.  X 0XMX>X,X,X-X-X-XOXOXOX$X$X$X$X$X$X$X$X$X$X$X:X:X:X>XuXt.    < 1 %.6.2.2.2.6.#.      ",
+"    8 _.(.(.(.(.(.(.(.(.(.(.(.(.(.(.'.T.X   Z uX>X-XOXOXOXoXOXOXOXoXoXoXoXoXoXoXoXoXoXoXOX&X-X>XwXy         1 6.2.2.2.6.#.      ",
+"    8 (.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.'.z   . >XeX>X-X-X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X-X;X>XtX+X    . X   , 5.2.2.2.6.%.      ",
+"    6 W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.'.F.    M CXkXdXdXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXpXdXdXlXzXr   + [ +   , 5.4.4.4.7.%.      ",
+"    6 W.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.~.z     +XAXkXsXsXaXaXaXaXaXaXaXaXaXaXaXaXaXaXsXsXkXAXZ     J @.O   , 5.4.4.4.7.=.      ",
+"    6 E.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.~.m     . ;XAXkXsXsXaXaXpXpXpXpXpXpXpXpXaXaXsXsXkXAX.X    > @.] O   , 5.4.3.3.7.=.      ",
+"    6 R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.Q.n       * ;XAXkXsXsXaXaXaXpXpXpXpXaXaXaXsXsXlXAX.X    + ] @.] O   , 4.3.3.3.5.=.      ",
+"    6 R.R.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Q.n         X .XZXZXkXsXsXsXsXsXsXsXsXsXsXkXZXzXZ     + [ +.O.] O   , 4.3.3.3.5.=.      ",
+"    7 U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.!.v     u @     s ;XZXZXlXkXkXkXkXkXkXlXZXzX#Xw       J +.o.O.] O   3 8.7.7.7.q.#.      ",
+"    5 I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.!.v     J [ :       t XX<XzXlXlXlXlXjX<X` e       .   > o.o.o.] O   < *.*.*.*.*._       ",
+"    5 I.I.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.!.v     J +.| d O       X = r s t r -         : +X<X.   K ..o.' O                       ",
+"    5 P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.I.b     K ..| ..' H > X                   - @XgXIXIXA   + ' ..' O                       ",
+"    5 L.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.H.I.b     K ..{ { } ..{ R K f i u u i d d   . eXIXCXSXhXw   p X.' O                   UXUX",
+"    5 H.H.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.L.b     K  .{ { { { { }  . .} } }  .X. .u   t SXCXVXAX#X    L { @     UXUXUXUXUXUXUXUXUX",
+"    5 H.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.L.c     H  .^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ } R X   +XIXVXVXSXM   > R @     UXUXUXUXUXUXUXUXUX",
+"    5 Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.J.c     H ( ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( f   = yXCXhXCX<X.   d +     UXUXUXUXUXUXUXUXUX",
+"    5 Z.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.J.c     H ( ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ / ~ ;   Z SXhXgXSXA   @ X     UXUXUXUXUXUXUXUXUX",
+"    5 C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.J.c     D ) Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q ) F   X >XCXgXhXyXw         UXUXUXUXUXUXUXUXUX",
+"    5 V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.K.x     D ! Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q ! i   t hXgXfXVX+X        UXUXUXUXUXUXUXUXUX",
+"    4 N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.B.x     D W E E E E E E E E E E E E E E E E W G X   XXCXfXfXgXM       UXUXUXUXUXUXUXUXUX",
+"    4 B.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.K.x     D W E E E E E E E E E E E E E E E E E W a   - rXgXyXgX>X.     UXUXUXUXUXUXUXUXUX",
+"    4 S.S.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.B.x     D W U U U U U U U U U U U U U U U U U T Y ;   V hXyXyXgXZ     UXUXUXUXUXUXUXUXUX",
+"      % % % % % % % % % % % % % % % % % % X     D T U U U U U U U U U U U U U U U U U U T F   X ;XgXrXyXeXw     UXUXUXUXUXUXUXUX",
+"                                                S T U U U U U U U U U U U U U U U U U U U T i   t yXrXrXfX+XX   UXUXUXUXUXUXUXUX",
+"UX                                              S T I I I I I I I I I I I I I I I I I I I T G X   .XfXyXfX=X*   UXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    S T I I I I I I I I I I I I I I I I I I I I T a   = eXeXV X     UXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    S T I I I I I I I I I I I I I I I I I I I I T P ;   t w       UXUXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    S T P P P P P P P P P P P P P P P P P P P P P T F             UXUXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX    @ ; o o o o o o o o o o o o o o o o o o o o o ; ;             UXUXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX                                                                  UXUXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX                                                                UXUXUXUXUXUXUXUXUXUX",
+"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX"
+};
diff --git a/src/gui/detailwindow.cpp b/src/gui/detailwindow.cpp
new file mode 100644 (file)
index 0000000..09b4380
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QMaemo5ValueButton>
+#include <QMaemo5InformationBox>
+#include <QApplication>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusMessage>
+#include <QtGui/QMessageBox>
+#include <QtGui/QLabel>
+#include <QtGui/QClipboard>
+#include <QDebug>
+#include "detailwindow.h"
+#include "contactmanager.h"
+
+DetailWindow::DetailWindow(QWidget* parent): QMainWindow(parent), addDialog_(0)
+{
+       setAttribute(Qt::WA_Maemo5StackedWindow);
+       area_ = new QScrollArea(this);
+       layout_ = new QVBoxLayout;
+       QHBoxLayout* top = new QHBoxLayout;
+       QHBoxLayout* bottom = new QHBoxLayout;
+
+       QPushButton* addButton = new QPushButton(QIcon::fromTheme("general_contacts"), tr("Add to contacts"));
+       QPushButton* copyButton = new QPushButton(tr("Copy number to clipboard"));
+
+       connect(addButton, SIGNAL(pressed()), this, SLOT(showAddToContactsDialog()));
+       connect(copyButton, SIGNAL(pressed()), this, SLOT(copyToClipboard()));
+
+       nameButton_ = new QMaemo5ValueButton(QIcon::fromTheme("general_default_avatar"), tr("Name"), this);
+       streetButton_ = new QMaemo5ValueButton(tr("Street"), this);
+       cityButton_ = new QMaemo5ValueButton(tr("City"), this);
+       numberButton_ = new QMaemo5ValueButton(QIcon::fromTheme("general_call"), tr("Phone number"), this);
+
+       connect(numberButton_, SIGNAL(pressed()), this, SLOT(makeCall()));
+
+       top->addWidget(nameButton_);
+       bottom->addWidget(streetButton_);
+       top->addWidget(numberButton_);
+       bottom->addWidget(cityButton_);
+       layout_->addLayout(top);
+       layout_->addLayout(bottom);
+       layout_->addWidget(addButton);
+       layout_->addWidget(copyButton);
+       area_->setLayout(layout_);
+       setCentralWidget(area_);
+}
+
+void DetailWindow::loadData(Eniro::Result const& details)
+{
+       setWindowTitle(details.name);
+       nameButton_->setValueText(details.name);
+       streetButton_->setValueText(details.street);
+       cityButton_->setValueText(details.city);
+       numberButton_->setValueText(details.number);
+       layout_->update();
+       show();
+}
+
+void DetailWindow::makeCall()
+{
+       QString number = numberButton_->valueText();
+
+       qDebug() << number;
+
+       if(number.isEmpty())
+       {
+               return;
+       }
+
+       QDBusMessage msg = QDBusMessage::createMethodCall("com.nokia.csd",
+                                                                 "/com/nokia/csd/call",
+                                                                 "com.nokia.csd.Call",
+                                                                 "CreateWith");
+       QList<QVariant> arguments;
+
+       arguments.append(QVariant(number));
+       arguments.append(QVariant(0));
+
+       msg.setArguments(arguments);
+
+       QDBusConnection::systemBus().send(msg);
+
+}
+
+void DetailWindow::showAddToContactsDialog()
+{
+       if(!addDialog_)
+       {
+               addDialog_ = new QDialog(this);
+               addDialog_->setWindowTitle(tr("Add to contacts"));
+               addContactInput_ = new QLineEdit();
+               QHBoxLayout* layout = new QHBoxLayout();
+               QLabel* name = new QLabel(tr("Name"));
+               QPushButton* button = new QPushButton(tr("Add"));
+               connect(button, SIGNAL(pressed()), this, SLOT(addToContacts()));
+               layout->addWidget(name);
+               layout->addWidget(addContactInput_);
+               layout->addWidget(button);
+               addDialog_->setLayout(layout);
+       }
+
+       addContactInput_->setText(nameButton_->valueText());
+       addDialog_->show();
+}
+
+void DetailWindow::addToContacts()
+{
+       ContactManager cm;
+       ContactManager::Contact contact;
+       contact.name = addContactInput_->text();
+       contact.number = numberButton_->valueText();
+
+       addDialog_->hide();
+
+       if(cm.addContact(contact))
+       {
+               QMaemo5InformationBox::information(this, tr("Contact was successfully added to contacts."));
+       }
+       else
+       {
+               QMessageBox::critical(this, tr("Error"), tr("Unable to add contact."));
+       }
+
+}
+
+void DetailWindow::copyToClipboard()
+{
+       QApplication::clipboard()->setText(numberButton_->valueText());
+       QMaemo5InformationBox::information(this, tr("Number was successfully copied to clipboard."));
+}
diff --git a/src/gui/detailwindow.h b/src/gui/detailwindow.h
new file mode 100644 (file)
index 0000000..19a6660
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DETAILWINDOW_H
+#define DETAILWINDOW_H
+
+#include <QtGui/QMainWindow>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QScrollArea>
+#include <QtGui/QDialog>
+#include <QtGui/QLineEdit>
+#include <QMaemo5ValueButton>
+#include "searchdialog.h"
+#include "eniro.h"
+
+class DetailWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    DetailWindow(QWidget* parent = 0);
+
+public slots:
+       void loadData(Eniro::Result const& details);
+
+private slots:
+       void makeCall();
+       void showAddToContactsDialog();
+       void addToContacts();
+       void copyToClipboard();
+
+private:
+       QScrollArea* area_;
+       QVBoxLayout* layout_;
+       QMaemo5ValueButton* nameButton_;
+       QMaemo5ValueButton* streetButton_;
+       QMaemo5ValueButton* cityButton_;
+       QMaemo5ValueButton* numberButton_;
+       QDialog* addDialog_;
+       QLineEdit* addContactInput_;
+
+
+};
+
+#endif
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
new file mode 100644 (file)
index 0000000..cddf745
--- /dev/null
@@ -0,0 +1,43 @@
+QT += network sql maemo5
+TARGET = jenirok
+TEMPLATE = app
+SOURCES += main.cpp mainwindow.cpp searchdialog.cpp resultwindow.cpp detailwindow.cpp settingsdialog.cpp buttonselector.cpp daemon.cpp ../common/eniro.cpp ../common/contactmanager.cpp ../common/db.cpp ../common/settings.cpp ../common/connectionmanager.cpp
+HEADERS += mainwindow.h searchdialog.h resultwindow.h detailwindow.h settingsdialog.h buttonselector.h daemon.h ../common/eniro.h ../common/contactmanager.h ../common/db.h ../common/settings.h ../common/connectionmanager.h
+TRANSLATIONS = ../common/translations/fi_FI.ts
+RESOURCES = icons.grc ../common/translations.grc
+INCLUDEPATH += ../common
+CONFIG += link_pkgconfig
+PKGCONFIG += libebook-1.2 glib-2.0 conic
+
+unix {
+  #VARIABLES
+  isEmpty(PREFIX) {
+    PREFIX = /usr
+  }
+
+  BINDIR = $$PREFIX/bin
+  DATADIR =$$PREFIX/share
+
+  DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
+
+  #MAKE INSTALL
+
+  INSTALLS += target desktop iconxpm icon26 icon48 icon64
+
+  target.path =$$BINDIR
+
+  desktop.path = $$DATADIR/applications/hildon
+  desktop.files += data/$${TARGET}.desktop
+
+  iconxpm.path = $$DATADIR/pixmap
+  iconxpm.files += data/maemo/$${TARGET}.xpm
+
+  icon26.path = $$DATADIR/icons/hicolor/26x26/apps
+  icon26.files += data/26x26/$${TARGET}.png
+
+  icon48.path = $$DATADIR/icons/hicolor/48x48/apps
+  icon48.files += data/48x48/$${TARGET}.png
+
+  icon64.path = $$DATADIR/icons/hicolor/64x64/apps
+  icon64.files += data/64x64/$${TARGET}.png
+}
diff --git a/src/gui/icons.grc b/src/gui/icons.grc
new file mode 100644 (file)
index 0000000..4ac0e8f
--- /dev/null
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>icons/start.png</file>
+    <file>icons/stop.png</file>
+</qresource>
+</RCC>
diff --git a/src/gui/icons/start.png b/src/gui/icons/start.png
new file mode 100755 (executable)
index 0000000..fcc4966
Binary files /dev/null and b/src/gui/icons/start.png differ
diff --git a/src/gui/icons/stop.png b/src/gui/icons/stop.png
new file mode 100755 (executable)
index 0000000..b63c37f
Binary files /dev/null and b/src/gui/icons/stop.png differ
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
new file mode 100644 (file)
index 0000000..14ad287
--- /dev/null
@@ -0,0 +1,52 @@
+/*\r
+ * This file is part of Jenirok.\r
+ *\r
+ * Jenirok is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Jenirok is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Jenirok.  If not, see <http://www.gnu.org/licenses/>.\r
+ *\r
+ */\r
+\r
+#include <QtCore/QTranslator>\r
+#include <QtCore/QLocale>\r
+#include <QtGui/QApplication>\r
+#include <QtCore/QObject>\r
+#include "mainwindow.h"\r
+#include "searchdialog.h"\r
+#include "resultwindow.h"\r
+#include "detailwindow.h"\r
+#include "eniro.h"\r
+\r
+#include "contactmanager.h"\r
+\r
+int main(int argc, char *argv[])\r
+{\r
+    QApplication app(argc, argv);\r
+\r
+    QTranslator translator;\r
+    translator.load(":/translations/" + QLocale::system().name());\r
+    app.installTranslator(&translator);\r
+\r
+    MainWindow window;\r
+    ResultWindow results(&window);\r
+    DetailWindow details(&results);\r
+\r
+    window.show();\r
+\r
+    QObject::connect(&window, SIGNAL(search(SearchDialog::SearchDetails&)),\r
+                        &results, SLOT(search(SearchDialog::SearchDetails&)));\r
+\r
+    QObject::connect(&results, SIGNAL(itemSelected(Eniro::Result const&)),\r
+                        &details, SLOT(loadData(Eniro::Result const&)));\r
+\r
+    return app.exec();\r
+}\r
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
new file mode 100644 (file)
index 0000000..d340fa1
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtGui/QMenuBar>
+#include <QtGui/QLabel>
+#include <QtGui/QPushButton>
+#include <QtGui/QWidget>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QMessageBox>
+#include <QMaemo5InformationBox>
+#include <QDebug>
+#include "mainwindow.h"
+#include "settingsdialog.h"
+#include "searchdialog.h"
+#include "daemon.h"
+#include "settings.h"
+#include "db.h"
+
+namespace
+{
+       const QString START_ICON = ":/icons/start.png";
+       const QString CLOSE_ICON = ":/icons/stop.png";
+}
+
+MainWindow::MainWindow(QWidget* parent): QMainWindow(parent),
+searchResults_(0), settingsDialog_(0), running_(false),
+toggleButton_(0), searchDialog_(0)
+{
+       setWindowTitle(tr("Jenirok"));
+       setAttribute(Qt::WA_Maemo5StackedWindow);
+       QWidget* mainWidget = new QWidget(this);
+
+       if(Daemon::isRunning())
+       {
+               toggleButton_ = createButton(tr("Stop daemon"));
+               toggleButton_->setIcon(QIcon(CLOSE_ICON));
+               running_ = true;
+       }
+       else
+       {
+               toggleButton_ = createButton(tr("Start daemon"));
+               toggleButton_->setIcon(QIcon(START_ICON));
+               running_ = false;
+       }
+
+       QToolButton* searchButton = createButton(tr("Search"));
+       searchButton->setIcon(QIcon::fromTheme("general_search"));
+
+       QSize size(64, 64);
+       searchButton->setIconSize(size);
+       toggleButton_->setIconSize(size);
+
+       QHBoxLayout *buttonLayout = new QHBoxLayout;
+       buttonLayout->addWidget(toggleButton_, Qt::AlignLeft);
+       buttonLayout->addWidget(searchButton, Qt::AlignRight);
+
+       mainWidget->setLayout(buttonLayout);
+
+       connect(toggleButton_, SIGNAL(pressed()), this, SLOT(toggleDaemon()));
+       connect(searchButton, SIGNAL(pressed()), this, SLOT(openSearch()));
+
+       setCentralWidget(mainWidget);
+       menuBar()->addAction(tr("Settings"), this, SLOT(showSettings()));
+}
+
+MainWindow::~MainWindow()
+{
+       DB::removeDatabase();
+}
+
+void MainWindow::showSettings()
+{
+       if(!settingsDialog_)
+       {
+               settingsDialog_ = new SettingsDialog(this);
+       }
+
+       settingsDialog_->show();
+}
+
+void MainWindow::toggleDaemon()
+{
+    QString readyText;
+    QString failText;
+    QString buttonText;
+    bool ret = false;
+
+    if(running_)
+    {
+               readyText = tr("Daemon was successfully stopped.");
+               failText = tr("Unable to stop daemon.");
+               buttonText = tr("Start daemon");
+               ret = Daemon::stop();
+    }
+    else
+    {
+       readyText = tr("Daemon was successfully started.");
+       failText = tr("Unable to start daemon.");
+       buttonText = tr("Stop daemon");
+       ret = Daemon::start();
+    }
+
+    if(!ret)
+    {
+       QMessageBox::critical(this, tr("Error"), failText);
+    }
+    else
+    {
+       QMaemo5InformationBox::information(this, readyText);
+       toggleButton_->setText(buttonText);
+       toggleButton_->setIcon(QIcon(running_ ? START_ICON : CLOSE_ICON));
+       running_ = !running_;
+    }
+
+}
+
+void MainWindow::openSearch()
+{
+       DB::connect();
+
+       QString username = Settings::instance()->get("eniro_username");
+       QString password = Settings::instance()->get("eniro_password");
+
+       DB::disconnect();
+
+       if(username.isEmpty() || password.isEmpty())
+       {
+               QMessageBox::information(this, tr("Info"), tr("You need to set Eniro login details in settings before using this feature."));
+               return;
+       }
+
+       if(!searchDialog_)
+       {
+               searchDialog_ = new SearchDialog(this);
+               connect(searchDialog_, SIGNAL(search(SearchDialog::SearchDetails&)), this, SLOT(handleSearch(SearchDialog::SearchDetails&)));
+       }
+
+       searchDialog_->show();
+}
+
+QToolButton* MainWindow::createButton(QString const& text)
+{
+       QToolButton* button = new QToolButton();
+       button->setText(text);
+       button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+       return button;
+}
+
+void MainWindow::handleSearch(SearchDialog::SearchDetails& details)
+{
+       emit search(details);
+}
diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h
new file mode 100644 (file)
index 0000000..429b92d
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QtCore/QString>
+#include <QtGui/QMainWindow>
+#include <QtGui/QToolButton>
+#include <QtGui/QListWidget>
+#include "searchdialog.h"
+#include "settingsdialog.h"
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget* parent = 0);
+    ~MainWindow();
+
+signals:
+       void search(SearchDialog::SearchDetails& details);
+
+public slots:
+    void showSettings();
+    void toggleDaemon();
+    void openSearch();
+    void handleSearch(SearchDialog::SearchDetails& details);
+
+private:
+       QToolButton* createButton(QString const& text);
+       QListWidget* searchResults_;
+       SettingsDialog* settingsDialog_;
+       bool running_;
+       QToolButton* toggleButton_;
+       SearchDialog* searchDialog_;
+
+};
+
+#endif
diff --git a/src/gui/resultwindow.cpp b/src/gui/resultwindow.cpp
new file mode 100644 (file)
index 0000000..0a5fe23
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QDebug>
+#include <QtCore/QVariant>
+#include <QtCore/QString>
+#include <QtGui/QLabel>
+#include <QtGui/QListWidgetItem>
+#include <QtGui/QMessageBox>
+#include "resultwindow.h"
+#include "settings.h"
+#include "db.h"
+
+ResultWindow::ResultWindow(QWidget* parent): QMainWindow(parent), eniro_(0), list_(0)
+{
+       setAttribute(Qt::WA_Maemo5StackedWindow);
+       setWindowTitle(tr("Search results"));
+}
+
+void ResultWindow::search(SearchDialog::SearchDetails& details)
+{
+       if(!list_)
+       {
+               list_ = new QListWidget(this);
+               setCentralWidget(list_);
+               connect(list_, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(itemClicked(QListWidgetItem*)));
+       }
+       else
+       {
+               list_->clear();
+       }
+
+       DB::connect();
+
+       Eniro::Site selectedSite = Eniro::stringToSite(Settings::instance()->get("site"));
+
+       if(!eniro_)
+       {
+               eniro_ = new Eniro(selectedSite, this);
+
+               connect(eniro_, SIGNAL(resultAvailable(Eniro::Result const&,
+                               Eniro::SearchDetails const&)),
+                               this, SLOT(resultAvailable(Eniro::Result const&,
+                               Eniro::SearchDetails const&)));
+
+               connect(eniro_, SIGNAL(requestFinished(QVector <Eniro::Result> const&,
+                               Eniro::SearchDetails const&, bool)),
+                               this, SLOT(requestFinished(QVector <Eniro::Result> const&,
+                               Eniro::SearchDetails const&, bool)));
+       }
+
+       QString username = Settings::instance()->get("eniro_username");
+       QString password = Settings::instance()->get("eniro_password");
+
+       if(!username.isEmpty() && !password.isEmpty())
+       {
+               eniro_->login(username, password);
+       }
+
+       eniro_->setSite(selectedSite);
+
+       DB::disconnect();
+
+       Eniro::SearchType type;
+
+       switch(details.type)
+       {
+       case 0:
+               type = Eniro::PERSONS;
+               break;
+       case 1:
+               type = Eniro::YELLOW_PAGES;
+               break;
+       default:
+               return;
+       }
+
+       show();
+       setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
+
+       eniro_->abort();
+       eniro_->search(Eniro::SearchDetails(details.name, details.location, type));
+
+}
+
+void ResultWindow::resultAvailable(Eniro::Result const& result,
+                                          Eniro::SearchDetails const& details)
+{
+       Q_UNUSED(details);
+
+       QString row = result.name;
+
+       if(!result.street.isEmpty())
+       {
+               row += ", " + result.street;
+       }
+
+       if(!result.city.isEmpty())
+       {
+               row += ", " + result.city;
+       }
+
+       QListWidgetItem* item = new QListWidgetItem(row, list_);
+       QMap <QString, QVariant> data;
+       data["name"] = QVariant(result.name);
+       data["street"] = QVariant(result.street);
+       data["city"] = QVariant(result.city);
+       data["number"] = QVariant(result.number);
+
+       item->setData(Qt::UserRole, QVariant(data));
+
+       list_->addItem(item);
+}
+
+void ResultWindow::requestFinished(QVector <Eniro::Result> const& results,
+                                          Eniro::SearchDetails const& details,
+                                          bool error)
+{
+       Q_UNUSED(details);
+
+       if(error)
+       {
+               QMessageBox::critical(this, tr("Error"), eniro_->errorString());
+       }
+
+       if(results.size() == 0)
+       {
+               QLabel* info = new QLabel(tr("No results found"));
+               info->setAlignment(Qt::AlignCenter);
+               setCentralWidget(info);
+               list_ = 0;
+       }
+
+       setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
+
+}
+
+void ResultWindow::itemClicked(QListWidgetItem* item)
+{
+       QMap <QString, QVariant> data = item->data(Qt::UserRole).toMap();
+       Eniro::Result details;
+       details.name = data["name"].toString();
+       details.street = data["street"].toString();
+       details.city = data["city"].toString();
+       details.number = data["number"].toString();
+
+       emit itemSelected(details);
+}
+
+
diff --git a/src/gui/resultwindow.h b/src/gui/resultwindow.h
new file mode 100644 (file)
index 0000000..88dc9ca
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef RESULTWINDOW_H
+#define RESULTWINDOW_H
+
+#include <QtCore/QVector>
+#include <QtGui/QMainWindow>
+#include <QtGui/QListWidget>
+#include <QtGui/QListWidgetItem>
+#include "searchdialog.h"
+#include "eniro.h"
+
+class ResultWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    ResultWindow(QWidget* parent = 0);
+
+signals:
+       void itemSelected(Eniro::Result const& result);
+
+public slots:
+       void search(SearchDialog::SearchDetails& details);
+
+private slots:
+       void resultAvailable(Eniro::Result const& result, Eniro::SearchDetails const& details);
+       void requestFinished(QVector <Eniro::Result> const& results, Eniro::SearchDetails const& details, bool error);
+       void itemClicked(QListWidgetItem* item);
+
+private:
+       Eniro* eniro_;
+       QListWidget* list_;
+
+};
+
+#endif
diff --git a/src/gui/searchdialog.cpp b/src/gui/searchdialog.cpp
new file mode 100644 (file)
index 0000000..17fb292
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QLabel>
+#include <QtGui/QDialogButtonBox>
+#include <QMaemo5ValueButton>
+#include <QDebug>
+#include "searchdialog.h"
+
+SearchDialog::SearchDialog(QWidget* parent): QDialog(parent),
+numberInput_(0), locationInput_(0), selector_(0)
+{
+       setWindowTitle(tr("Search"));
+
+       QHBoxLayout* numberLayout = new QHBoxLayout;
+       QLabel* numberLabel = new QLabel(tr("Name/number"));
+       numberInput_ = new QLineEdit;
+       numberLayout->addWidget(numberLabel);
+       numberLayout->addWidget(numberInput_);
+
+       QHBoxLayout* locationLayout = new QHBoxLayout;
+       QLabel* locationLabel = new QLabel(tr("Location"));
+       locationInput_ = new QLineEdit;
+       locationLayout->addWidget(locationLabel);
+       locationLayout->addWidget(locationInput_);
+
+       selector_ = new ButtonSelector(tr("Type"), this);
+       selector_->addItem(tr("Persons"));
+       selector_->addItem(tr("Yellow pages"));
+
+       QVBoxLayout* leftLayout = new QVBoxLayout;
+       leftLayout->addLayout(numberLayout);
+       leftLayout->addLayout(locationLayout);
+       leftLayout->addWidget(selector_);
+
+       QDialogButtonBox* buttons = new QDialogButtonBox;
+       QPushButton* submitButton = new QPushButton(tr("Search"));
+       buttons->addButton(submitButton, QDialogButtonBox::AcceptRole);
+       connect(submitButton, SIGNAL(pressed()), this, SLOT(searchPressed()));
+
+       QHBoxLayout* mainLayout = new QHBoxLayout;
+       mainLayout->addLayout(leftLayout, Qt::AlignLeft);
+       mainLayout->addWidget(buttons);
+
+       setLayout(mainLayout);
+}
+
+void SearchDialog::searchPressed()
+{
+       SearchDetails details;
+       details.name = numberInput_->text();
+
+       if(details.name.isEmpty())
+       {
+               numberInput_->setFocus();
+               return;
+       }
+
+       details.location = locationInput_->text();
+       details.type = selector_->currentIndex();
+       emit search(details);
+       hide();
+}
diff --git a/src/gui/searchdialog.h b/src/gui/searchdialog.h
new file mode 100644 (file)
index 0000000..09d13ed
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SEARCHDIALOG_H
+#define SEARCHDIALOG_H
+
+#include <QtCore/QString>
+#include <QtGui/QDialog>
+#include <QtGui/QWidget>
+#include <QtGui/QLineEdit>
+#include <QMaemo5ListPickSelector>
+#include "buttonselector.h"
+
+class SearchDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+
+       struct SearchDetails
+       {
+               QString name;
+               QString location;
+               int type;
+       };
+
+    SearchDialog(QWidget* parent = 0);
+
+signals:
+       void search(SearchDialog::SearchDetails& details);
+
+private slots:
+       void searchPressed();
+
+private:
+       QLineEdit* numberInput_;
+       QLineEdit* locationInput_;
+       ButtonSelector* selector_;
+
+};
+
+#endif
diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp
new file mode 100644 (file)
index 0000000..25ba29d
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtGui/QLabel>
+#include <QtGui/QPushButton>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QIntValidator>
+#include <QMaemo5ValueButton>
+#include <QMaemo5InformationBox>
+#include <QDebug>
+#include "settingsdialog.h"
+#include "settings.h"
+#include "db.h"
+#include "daemon.h"
+
+QMap <Eniro::Site, Eniro::SiteDetails> SettingsDialog::sites_ = Eniro::getSites();
+
+SettingsDialog::SettingsDialog(QWidget* parent): QDialog(parent),
+usernameInput_(0), passwordInput_(0), cacheInput_(0), siteSelector_(0), autostartSelector_(0)
+{
+       setWindowTitle(tr("Settings"));
+
+       DB::connect();
+
+       QVBoxLayout* left = new QVBoxLayout;
+       QHBoxLayout* mainLayout = new QHBoxLayout;
+       QHBoxLayout* username = new QHBoxLayout;
+       QHBoxLayout* password = new QHBoxLayout;
+       QHBoxLayout* cache = new QHBoxLayout;
+
+       QLabel* usernameLabel = new QLabel(tr("Eniro username"));
+       usernameInput_ = new QLineEdit(Settings::instance()->get("eniro_username"));
+
+       QLabel* passwordLabel = new QLabel(tr("Eniro password"));
+       passwordInput_ = new QLineEdit(Settings::instance()->get("eniro_password"));
+
+       QLabel* cacheLabel = new QLabel(tr("Cache size (numbers)"));
+       cacheInput_ = new QLineEdit(Settings::instance()->get("cache_size"));
+       cacheInput_->setValidator(new QIntValidator(0, 10000, this));
+
+       siteSelector_ = new ButtonSelector(tr("Eniro site"), this);
+       QString site = Settings::instance()->get("eniro_site");
+       int i = 0;
+       QMap <Eniro::Site, Eniro::SiteDetails>::const_iterator it;
+       for(it = sites_.begin(); it != sites_.end(); it++)
+       {
+               siteSelector_->addItem(it.value().name, it.value().id);
+
+               if(it.value().id == site)
+               {
+                       siteSelector_->setCurrentIndex(i);
+               }
+
+               i++;
+       }
+
+       autostartSelector_ = new ButtonSelector(tr("Autostart"), this);
+       QString autostart = Settings::instance()->get("autostart");
+       autostartSelector_->addItem(tr("Enabled"), "1");
+       autostartSelector_->addItem(tr("Disabled"), "0");
+       autostartSelector_->setCurrentIndex(autostart == "1" ? 0 : 1);
+
+       QPushButton* submitButton = new QPushButton(tr("Save"));
+       connect(submitButton, SIGNAL(pressed()), this, SLOT(saveSettings()));
+
+       username->addWidget(usernameLabel);
+       username->addWidget(usernameInput_);
+       password->addWidget(passwordLabel);
+       password->addWidget(passwordInput_);
+       cache->addWidget(cacheLabel);
+       cache->addWidget(cacheInput_);
+       left->addLayout(username);
+       left->addLayout(password);
+       left->addLayout(cache);
+       left->addWidget(siteSelector_);
+       left->addWidget(autostartSelector_);
+
+       mainLayout->addLayout(left);
+       mainLayout->addWidget(submitButton);
+
+       setLayout(mainLayout);
+
+       DB::disconnect();
+}
+
+void SettingsDialog::saveSettings()
+{
+       DB::connect();
+
+       Settings::instance()->set("eniro_username", usernameInput_->text());
+       Settings::instance()->set("eniro_password", passwordInput_->text());
+       Settings::instance()->set("cache_size", cacheInput_->text());
+       QString site = siteSelector_->value().toString();
+       Settings::instance()->set("site", site);
+       QString autostart = autostartSelector_->value().toString();
+       Settings::instance()->set("autostart", autostart);
+
+       DB::disconnect();
+
+       hide();
+
+       if(site != currentSite_ && Daemon::isRunning())
+       {
+               QMaemo5InformationBox::information(this, tr("Restarting daemon..."));
+               Daemon::restart();
+               currentSite_ = site;
+       }
+
+       if(autostart != currentAutostart_)
+       {
+               bool value = false;
+
+               if(autostart == "1")
+               {
+                       value = true;
+               }
+
+               Daemon::setAutostart(value);
+       }
+
+}
+
+void SettingsDialog::setVisible(bool visible)
+{
+       QDialog::setVisible(visible);
+
+       if(visible)
+       {
+               currentSite_ = siteSelector_->value().toString();
+               currentAutostart_ = autostartSelector_->value().toString();
+       }
+
+}
diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h
new file mode 100644 (file)
index 0000000..52e9774
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok 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.
+ *
+ * Jenirok 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 Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtGui/QDialog>
+#include <QtGui/QWidget>
+#include <QtGui/QLineEdit>
+#include <QMaemo5ListPickSelector>
+#include "eniro.h"
+#include "buttonselector.h"
+
+class SettingsDialog : public QDialog
+{
+       Q_OBJECT
+
+public:
+       SettingsDialog(QWidget* parent = 0);
+
+public slots:
+       void saveSettings();
+       void setVisible(bool visible);
+
+private:
+       static QMap <Eniro::Site, Eniro::SiteDetails> sites_;
+       QLineEdit* usernameInput_;
+       QLineEdit* passwordInput_;
+       QLineEdit* cacheInput_;
+       ButtonSelector* siteSelector_;
+       ButtonSelector* autostartSelector_;
+       QString currentSite_;
+       QString currentAutostart_;
+};
+
+#endif
diff --git a/welcome b/welcome
deleted file mode 100644 (file)
index e69de29..0000000

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment