LCOV - code coverage report
Current view: top level - Accounts - application.cpp (source / functions) Hit Total Coverage
Test: Code Coverage Lines: 30 30 100.0 %
Date: 2013-04-26 Functions: 9 9 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 10 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* vi: set et sw=4 ts=4 cino=t0,(0: */
       2                 :            : /*
       3                 :            :  * This file is part of libaccounts-qt
       4                 :            :  *
       5                 :            :  * Copyright (C) 2012 Canonical Ltd.
       6                 :            :  *
       7                 :            :  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
       8                 :            :  *
       9                 :            :  * This library is free software; you can redistribute it and/or
      10                 :            :  * modify it under the terms of the GNU Lesser General Public License
      11                 :            :  * version 2.1 as published by the Free Software Foundation.
      12                 :            :  *
      13                 :            :  * This library is distributed in the hope that it will be useful, but
      14                 :            :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      15                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      16                 :            :  * Lesser General Public License for more details.
      17                 :            :  *
      18                 :            :  * You should have received a copy of the GNU Lesser General Public
      19                 :            :  * License along with this library; if not, write to the Free Software
      20                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
      21                 :            :  * 02110-1301 USA
      22                 :            :  */
      23                 :            : 
      24                 :            : #include "application.h"
      25                 :            : #include "service.h"
      26                 :            : 
      27                 :            : #undef signals
      28                 :            : #include <libaccounts-glib/ag-application.h>
      29                 :            : 
      30                 :            : using namespace Accounts;
      31                 :            : 
      32                 :            : namespace Accounts {
      33                 :            : /*!
      34                 :            :  * @class Application
      35                 :            :  * @headerfile application.h Accounts/Application
      36                 :            :  *
      37                 :            :  * @brief Information on the client applications of libaccounts.
      38                 :            :  *
      39                 :            :  * @details The Application structure holds information on the client
      40                 :            :  * applications registered with libaccounts.
      41                 :            :  * It is instantiated by Manager::application() and Manager::applicationList().
      42                 :            :  */
      43                 :            : }; // namespace
      44                 :            : 
      45                 :          3 : Application::Application(AgApplication *application):
      46                 :          3 :     m_application(application)
      47                 :            : {
      48                 :          3 : }
      49                 :            : 
      50                 :            : /*!
      51                 :            :  * Copy constructor. Copying an Application object is very cheap, because the
      52                 :            :  * data is shared among copies.
      53                 :            :  */
      54                 :          2 : Application::Application(const Application &other):
      55                 :          2 :     m_application(other.m_application)
      56                 :            : {
      57         [ +  - ]:          2 :     if (m_application != 0)
      58                 :          2 :         ag_application_ref(m_application);
      59                 :          2 : }
      60                 :            : 
      61                 :          1 : Application &Application::operator=(const Application &other)
      62                 :            : {
      63         [ +  - ]:          1 :     if (m_application == other.m_application) return *this;
      64         [ +  - ]:          1 :     if (m_application != 0)
      65                 :          1 :         ag_application_unref(m_application);
      66                 :          1 :     m_application = other.m_application;
      67         [ +  - ]:          1 :     if (m_application != 0)
      68                 :          1 :         ag_application_ref(m_application);
      69                 :            :     return *this;
      70                 :            : }
      71                 :            : 
      72                 :            : /*!
      73                 :            :  * Destructor.
      74                 :            :  */
      75                 :          5 : Application::~Application()
      76                 :            : {
      77         [ +  - ]:          5 :     if (m_application != 0) {
      78                 :          5 :         ag_application_unref(m_application);
      79                 :          5 :         m_application = 0;
      80                 :            :     }
      81                 :          5 : }
      82                 :            : 
      83                 :            : /*!
      84                 :            :  * Check whether this object represents an Application.
      85                 :            :  * @return true if the Application is a valid one.
      86                 :            :  */
      87                 :          1 : bool Application::isValid() const
      88                 :            : {
      89                 :          1 :     return m_application != 0;
      90                 :            : }
      91                 :            : 
      92                 :            : /*!
      93                 :            :  * Get the name of the application.
      94                 :            :  * @return The application name.
      95                 :            :  */
      96                 :          3 : QString Application::name() const
      97                 :            : {
      98                 :          3 :     return UTF8(ag_application_get_name(m_application));
      99                 :            : }
     100                 :            : 
     101                 :            : /*!
     102                 :            :  * Get the description of the application.
     103                 :            :  * @return The application description.
     104                 :            :  */
     105                 :          2 : QString Application::description() const
     106                 :            : {
     107                 :          2 :     return UTF8(ag_application_get_description(m_application));
     108                 :            : }
     109                 :            : 
     110                 :            : /*!
     111                 :            :  * Get the translation catalog for the texts returned by the methods of this
     112                 :            :  * class.
     113                 :            :  * @return The translation catalog name.
     114                 :            :  */
     115                 :          1 : QString Application::trCatalog() const
     116                 :            : {
     117                 :          1 :     return UTF8(ag_application_get_i18n_domain(m_application));
     118                 :            : }
     119                 :            : 
     120                 :            : /*!
     121                 :            :  * Get the description from the application XML file, for the specified
     122                 :            :  * service; if not found, get the service-type description instead.
     123                 :            :  * @return Usage description of the service.
     124                 :            :  */
     125                 :          2 : QString Application::serviceUsage(const Service &service) const
     126                 :            : {
     127                 :          2 :     return UTF8(ag_application_get_service_usage(m_application,
     128                 :            :                                                  service.service()));
     129                 :            : }

Generated by: LCOV version 1.9