summaryrefslogtreecommitdiff
path: root/lib/Daemon.h
blob: 6a1ad4956a357082296556ef7dd1ae8922b309c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright (C) 2007 Adrien Bustany <madcat@mymadcat.com>
*
* Licensed under the GNU General Public License Version 2
*
* 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 2 See MA 02111-1307, USA.
*
*/

#ifndef DAEMON_H
#define DAEMON_H

#include <QtCore>

#include "CentralProxy.h"

#include "Transaction.h"
#include "Role.h"

namespace PackageKit {

class PolkitClient;

class Daemon : public QObject {

	friend class Transaction;

	Q_OBJECT

public:
	Daemon(QObject *parent = 0);
	~Daemon();

	// PackageKit functions
	unsigned int getActions();
	void getBackendDetails(QString &name, QString &author);
	QStringList getFilters();
	QStringList getGroups();
	QStringList getTransactionList();

	uint getTimeSinceAction(Role::Value role);

	bool getNetworkState();
	void setProxy(const QString &http_proxy, const QString &ftp_proxy);
	void suggestQuit();
	void stateHasChanged(const QString &reason);

	Transaction* newTransaction();

protected:
	QString getTid();
	void sendAuthRefused(const QString &message);

private:
	CentralProxy *proxy;
	PolkitClient *polkit;

private slots:
	void NetworkStateChanged_cb(const QString &status);

signals:
	void NetworkStateChanged(bool status);
	void Locked(bool locked);
	void TransactionListChanged(const QStringList &tids);
	void RepoListChanged();
	void RestartSchedule();
	void AuthRefused(const QString &message); // Called when PolicyKit auth fails

};

} // End namespace PackageKit

#endif