File indexing completed on 2024-04-28 13:40:48
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 UPDATER_H 0022 #define UPDATER_H 0023 0024 #include <QWidget> 0025 #include <QModelIndex> 0026 0027 #include <KPixmapSequenceOverlayPainter> 0028 0029 #include <Transaction> 0030 0031 using namespace PackageKit; 0032 0033 namespace Ui { 0034 class Updater; 0035 } 0036 0037 class PackageModel; 0038 class ApplicationsDelegate; 0039 class CheckableHeader; 0040 class Updater : public QWidget 0041 { 0042 Q_OBJECT 0043 public: 0044 Updater(Transaction::Roles roles, QWidget *parent); 0045 ~Updater() override; 0046 0047 bool hasChanges() const; 0048 QStringList packagesToUpdate() const; 0049 0050 Q_SIGNALS: 0051 void installUpdates(); 0052 void changed(bool); 0053 void refreshCache(); 0054 void downloadSize(const QString &message); 0055 0056 public Q_SLOTS: 0057 void load(); 0058 0059 void getUpdates(); 0060 0061 private Q_SLOTS: 0062 void on_packageView_customContextMenuRequested(const QPoint &pos); 0063 0064 void distroUpgrade(PackageKit::Transaction::DistroUpgrade type, const QString &name, const QString &description); 0065 0066 void getUpdatesFinished(); 0067 0068 void on_packageView_clicked(const QModelIndex &index); 0069 0070 void checkEnableUpdateButton(); 0071 void errorCode(PackageKit::Transaction::Error error, const QString &details); 0072 0073 void showVersions(bool enabled); 0074 void showCurrentVersions(bool enabled); 0075 void showArchs(bool enabled); 0076 void showOrigins(bool enabled); 0077 void showSizes(bool enabled); 0078 void updatePallete(); 0079 0080 private: 0081 Ui::Updater *ui; 0082 Transaction::Roles m_roles; 0083 bool m_selected = true; 0084 PackageModel *m_updatesModel; 0085 ApplicationsDelegate *m_delegate; 0086 CheckableHeader *m_header; 0087 QAction *m_showPackageVersion; 0088 QAction *m_showPackageCurrentVersion; 0089 QAction *m_showPackageArch; 0090 QAction *m_showPackageOrigin; 0091 QAction *m_showPackageSize; 0092 Transaction *m_updatesT = nullptr; 0093 KPixmapSequenceOverlayPainter *m_busySeq; 0094 }; 0095 0096 #endif