1
/***************************************************************************
2
* Copyright (C) 2009-2011 by Daniel Nicoletti *
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. *
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. *
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
***************************************************************************/
21
#ifndef SESSION_TASK_H
22
#define SESSION_TASK_H
24
#include <Transaction>
25
#include <PkTransaction.h>
27
#include <QDBusMessage>
36
class PkTransactionWidget;
37
class SessionTask : public KDialog
42
SessionTask(uint xid, const QString &interaction, const QDBusMessage &message, QWidget *parent = 0);
54
ConfirmSearch = 0x001,
56
ConfirmInstall = 0x004,
62
Q_DECLARE_FLAGS(Interactions, Interaction)
65
Transaction::Info info;
70
bool showConfirmSearch() const;
71
bool showConfirmDeps() const;
72
bool showConfirmInstall() const;
73
bool showProgress() const;
74
bool showFinished() const;
75
bool showWarning() const;
77
virtual void slotButtonClicked(int button);
79
Interactions interactions() const;
82
QWidget* mainWidget();
83
uint parentWId() const;
86
void enableButtonOk(bool state);
87
void setMainWidget(QWidget *widget);
90
// Virtual methods to easy subclasses
91
virtual void search();
92
virtual void commit();
93
virtual void notFound();
94
virtual void searchFailed();
95
virtual void searchSuccess();
96
virtual void commitFailed();
97
virtual void commitSuccess(QWidget *widget = 0);
99
bool foundPackages() const;
100
int foundPackagesSize() const;
101
PackageModel* model() const;
102
void setTransaction(Transaction::Role role, PkTransaction *transaction = 0);
104
void sendErrorFinished(DBusError error, const QString &msg);
105
bool sendMessageFinished(const QDBusMessage &message);
109
void setTitle(const QString &title);
110
void setInfo(const QString &title, const QString &text, const QString &details = QString());
111
void setError(const QString &title, const QString &text, const QString &details = QString());
112
void setFinish(const QString &title, const QString &text, QWidget *widget = 0);
113
virtual void addPackage(PackageKit::Transaction::Info info, const QString &packageID, const QString &summary);
114
virtual void searchFinished(PkTransaction::ExitStatus status);
115
virtual void commitFinished(PkTransaction::ExitStatus status);
118
void updatePallete();
119
void setDialog(KDialog *dialog);
122
void removePackages();
123
void parseInteraction(const QString &interaction);
125
uint getPidSession();
126
QString getCmdLine(uint pid);
127
bool pathIsTrusted(const QString &exec);
128
void setExec(const QString &exec);
132
QDBusMessage m_message;
133
Interactions m_interactions;
135
PackageModel *m_model;
136
QStringList m_removePackages;
137
ReviewChanges *m_reviewChanges;
138
PkTransactionWidget *m_pkTransaction;
142
Q_DECLARE_OPERATORS_FOR_FLAGS(SessionTask::Interactions)