File indexing completed on 2024-05-12 05:12:42
0001 /* 0002 Copyright (C) 2013 Jonathan Marten <jjm@keelhaul.me.uk> 0003 0004 This program is free software; you can redistribute it and/or modify 0005 it under the terms of the GNU General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or 0007 (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 GNU General Public License for more details. 0013 0014 You should have received a copy of the GNU General Public License along 0015 with this program; if not, write to the Free Software Foundation, Inc., 0016 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 0017 */ 0018 0019 #ifndef INFOCOMMAND_H 0020 #define INFOCOMMAND_H 0021 0022 #include "abstractcommand.h" 0023 0024 namespace Akonadi 0025 { 0026 class Collection; 0027 class Item; 0028 class CollectionStatistics; 0029 }; 0030 0031 class KJob; 0032 0033 class InfoCommand : public AbstractCommand 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 explicit InfoCommand(QObject *parent = nullptr); 0039 virtual ~InfoCommand(); 0040 0041 QString name() const override; 0042 0043 public Q_SLOTS: 0044 void start() override; 0045 0046 protected: 0047 void setupCommandOptions(QCommandLineParser *parser) override; 0048 int initCommand(QCommandLineParser *parser) override; 0049 0050 private: 0051 Akonadi::Collection *mInfoCollection; 0052 Akonadi::Item *mInfoItem; 0053 Akonadi::CollectionStatistics *mInfoStatistics; 0054 0055 private: 0056 void fetchStatistics(); 0057 void fetchItems(); 0058 void fetchParentPath(const Akonadi::Collection &collection); 0059 0060 private Q_SLOTS: 0061 void infoForNext(); 0062 0063 void onBaseFetched(KJob *job); 0064 void onStatisticsFetched(KJob *job); 0065 void onItemsFetched(KJob *job); 0066 void onParentPathFetched(KJob *job); 0067 }; 0068 0069 #endif // INFOCOMMAND_H