File indexing completed on 2024-05-12 05:12:41
0001 /* 0002 * Copyright (C) 2017 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 0020 #ifndef DUMPCOMMAND_H 0021 #define DUMPCOMMAND_H 0022 0023 #include <qstringlist.h> 0024 0025 #include <Akonadi/Item> 0026 #include <Akonadi/Tag> 0027 0028 #include "abstractcommand.h" 0029 0030 class DumpCommand : public AbstractCommand 0031 { 0032 Q_OBJECT 0033 0034 public: 0035 explicit DumpCommand(QObject *parent = nullptr); 0036 virtual ~DumpCommand() = default; 0037 0038 QString name() const override; 0039 0040 public Q_SLOTS: 0041 void start() override; 0042 0043 protected: 0044 int initCommand(QCommandLineParser *parser) override; 0045 void setupCommandOptions(QCommandLineParser *parser) override; 0046 0047 private: 0048 bool mMaildir; 0049 bool mAkonadiCategories; 0050 0051 QString mDirectoryArg; 0052 Akonadi::Item::List mItemList; 0053 Akonadi::Tag::List mTagList; 0054 QStringList mCreatedDirs; 0055 0056 private: 0057 void writeItem(const Akonadi::Item &item, const QString &parent); 0058 0059 private Q_SLOTS: 0060 void onCollectionFetched(KJob *job); 0061 void onItemsFetched(KJob *job); 0062 void onTagsFetched(KJob *job); 0063 void onParentPathFetched(KJob *job); 0064 void processNextItem(); 0065 }; 0066 0067 #endif // DUMPCOMMAND_H