~dantti/apper/master

« back to all changes in this revision

Viewing changes to Sentinel/AbstractIsRunning.cpp

  • Committer: Daniel Nicoletti
  • Date: 2012-12-16 13:51:04 UTC
  • Revision ID: git-v1:4e1499a55d1ec8a637f03979cde84aaa4a4440ba
Renaming ApperSentinel to ApperPkSession since that's all it will do now

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2009-2011 by Daniel Nicoletti                           *
3
 
 *   dantti12@gmail.com                                                    *
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 
 *   (at your option) any later version.                                   *
9
 
 *                                                                         *
10
 
 *   This program is distributed in the hope that it will be useful,       *
11
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 
 *   GNU General Public License for more details.                          *
14
 
 *                                                                         *
15
 
 *   You should have received a copy of the GNU General Public License     *
16
 
 *   along with this program; see the file COPYING. If not, write to       *
17
 
 *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
18
 
 *   Boston, MA 02110-1301, USA.                                           *
19
 
 ***************************************************************************/
20
 
 
21
 
#include "AbstractIsRunning.h"
22
 
 
23
 
#include <Daemon>
24
 
 
25
 
#include <KDebug>
26
 
 
27
 
using namespace PackageKit;
28
 
 
29
 
AbstractIsRunning::AbstractIsRunning(QObject *parent) :
30
 
    QObject(parent),
31
 
    m_running(0)
32
 
{
33
 
}
34
 
 
35
 
AbstractIsRunning::~AbstractIsRunning()
36
 
{
37
 
}
38
 
 
39
 
void AbstractIsRunning::increaseRunning()
40
 
{
41
 
    m_running++;
42
 
    kDebug();
43
 
}
44
 
 
45
 
void AbstractIsRunning::decreaseRunning()
46
 
{
47
 
    m_running--;
48
 
    kDebug();
49
 
    if (!isRunning()) {
50
 
        kDebug() << "Is not Running anymore";
51
 
        emit close();
52
 
    }
53
 
}
54
 
 
55
 
bool AbstractIsRunning::isRunning() const
56
 
{
57
 
    return m_running > 0;
58
 
}