1 /* 2 * %kadu copyright begin% 3 * Copyright 2008, 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im) 4 * Copyright 2012, 2014 Bartosz Brachaczek (b.brachaczek@gmail.com) 5 * Copyright 2008 Dawid Stawiarski (neeo@kadu.net) 6 * Copyright 2007 Marcin Ślusarz (joi@kadu.net) 7 * Copyright 2008, 2009, 2010, 2011, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 8 * %kadu copyright end% 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License as 12 * published by the Free Software Foundation; either version 2 of 13 * the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 */ 23 24 #pragma once 25 26 #include "accounts/accounts-aware-object.h" 27 #include "protocols/protocol.h" 28 29 #include <QtCore/QDateTime> 30 #include <injeqt/injeqt.h> 31 32 class AccountManager; 33 class ConfigurationManager; 34 class Configuration; 35 class KaduWindowService; 36 class InjectedFactory; 37 class VersionService; 38 39 class QNetworkReply; 40 41 class Updates : public QObject, AccountsAwareObject 42 { 43 Q_OBJECT 44 45 public: 46 explicit Updates(QObject *parent = nullptr); 47 virtual ~Updates(); 48 49 protected: 50 virtual void accountRegistered(Account account); 51 virtual void accountUnregistered(Account account); 52 53 private: 54 QPointer<AccountManager> m_accountManager; 55 QPointer<ConfigurationManager> m_configurationManager; 56 QPointer<Configuration> m_configuration; 57 QPointer<InjectedFactory> m_injectedFactory; 58 QPointer<KaduWindowService> m_kaduWindowService; 59 QPointer<VersionService> m_versionService; 60 61 bool UpdateChecked; 62 QString Query; 63 64 void buildQuery(); 65 66 bool isNewerVersionThan(const QString &version); 67 QString stripVersion(const QString &version); 68 69 private slots: 70 INJEQT_SET void setAccountManager(AccountManager *accountManager); 71 INJEQT_SET void setConfigurationManager(ConfigurationManager *configurationManager); 72 INJEQT_SET void setConfiguration(Configuration *configuration); 73 INJEQT_SET void setInjectedFactory(InjectedFactory *injectedFactory); 74 INJEQT_SET void setMainWindowService(KaduWindowService *kaduWindowService); 75 INJEQT_SET void setVersionService(VersionService *versionService); 76 INJEQT_INIT void init(); 77 78 void gotUpdatesInfo(QNetworkReply *reply); 79 void run(); 80 81 }; 82