File indexing completed on 2024-04-21 05:45:08

0001 /***************************************************************************
0002  *   Copyright (C) 2008-2011 by Daniel Nicoletti                           *
0003  *   dantti12@gmail.com                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; see the file COPYING. If not, write to       *
0017  *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
0018  *   Boston, MA 02110-1301, USA.                                           *
0019  ***************************************************************************/
0020 
0021 #ifndef PK_TRANSACTION_WIDGET_H
0022 #define PK_TRANSACTION_WIDGET_H
0023 
0024 #include <QWidget>
0025 #include <QDialog>
0026 //#include <kdemacros.h>
0027 
0028 #include <Transaction>
0029 
0030 using namespace PackageKit;
0031 
0032 namespace Ui {
0033     class PkTransactionWidget;
0034 }
0035 
0036 class PkTransaction;
0037 class PkTransactionWidgetPrivate;
0038 class Q_DECL_EXPORT PkTransactionWidget : public QWidget
0039 {
0040     Q_OBJECT
0041 public:
0042     explicit PkTransactionWidget(QWidget *parent = nullptr);
0043     ~PkTransactionWidget() override;
0044 
0045     void setTransaction(PkTransaction *trans, Transaction::Role role);
0046     void hideCancelButton();
0047 
0048     Transaction::Role role() const;
0049     PkTransaction* transaction() const;
0050 
0051     bool isFinished() const;
0052     bool isCancelVisible() const;
0053 
0054 Q_SIGNALS:
0055     void allowCancel(bool enable);
0056     void titleChanged(const QString &title);
0057     void titleChangedProgress(const QString &title);
0058     void dialog(QDialog *widget);
0059     void sorry(const QString &title, const QString &text, const QString &details);
0060     void error(const QString &title, const QString &text, const QString &details);
0061 
0062 public Q_SLOTS:
0063     void cancel();
0064 
0065 private Q_SLOTS:
0066     void updateUi();
0067 
0068     void reject();
0069     void followBottom(int value);
0070     void rangeChanged(int min, int max);
0071 
0072 private:
0073     void unsetTransaction();
0074 
0075     PkTransaction *m_trans;
0076     bool m_keepScrollBarAtBottom;
0077     bool m_handlingActionRequired;
0078     bool m_showingError; //This might replace the above
0079     Transaction::Status m_status;
0080     Ui::PkTransactionWidget *ui;
0081     PkTransactionWidgetPrivate *d;
0082 };
0083 
0084 #endif