File: utils.h

package info (click to toggle)
pim-data-exporter 4%3A22.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,780 kB
  • sloc: cpp: 14,067; xml: 197; makefile: 6; sh: 3
file content (108 lines) | stat: -rw-r--r-- 3,859 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
   SPDX-FileCopyrightText: 2012-2022 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: GPL-2.0-or-later
*/

#pragma once
#include "pimdataexportcore_debug.h"
#include "pimdataexporter_export.h"
#include <KSharedConfig>
#include <QString>
class KZip;

struct ResourceFiles {
    QString akonadiConfigFile;
    QString akonadiResources;
    QString akonadiAgentConfigFile;
    void debug() const
    {
        qDebug() << " akonadiconfigfile :" << akonadiConfigFile << " akonadiResources:" << akonadiResources
                 << " akonadiAgentConfigFile:" << akonadiAgentConfigFile;
    }

    bool operator<(const ResourceFiles &other) const
    {
        return other.akonadiConfigFile < akonadiConfigFile;
    }
};

namespace Utils
{
struct AkonadiInstanceInfo {
    QString identifier;
    QStringList mimeTypes;
    QStringList capabilities;
};
enum StoredType {
    None = 0,
    Identity = 1,
    Mails = 2,
    MailTransport = 4,
    Resources = 8,
    Config = 16,
    Data = 32
    // TODO add more type to import/export
};
Q_DECLARE_FLAGS(StoredTypes, StoredType)

enum AppsType { Unknown = 0, KMail, KAddressBook, KAlarm, KOrganizer, KNotes, Akregator };

struct importExportParameters {
    importExportParameters()
        : numberSteps(0)
        , types(None)
    {
    }

    bool isEmpty() const
    {
        return types == None;
    }

    int numberSteps;
    Utils::StoredTypes types;
};

Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString transportsPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString resourcesPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString identitiesPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString mailsPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString configsPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString akonadiPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString dataPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString calendarPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString addressbookPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString alarmPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString infoPath();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString notePath();

Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString storeMails();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString backupnote();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString storeCalendar();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString storeAlarm();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString storeAddressbook();

Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString resourceNoteArchiveName();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString resourceAddressbookArchiveName();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString resourceAlarmArchiveName();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString resourceCalendarArchiveName();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString resourceMailArchiveName();

Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString prefixAkonadiConfigFile();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString exportDataTypeFileName();
Q_REQUIRED_RESULT QString akonadiAgentName(const QString &configPath);
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QVector<Utils::AkonadiInstanceInfo> listOfResource();

KZip *openZip(const QString &filename, QString &errorMsg);
PIMDATAEXPORTER_EXPORT void storeDataExportInfo(KZip *archive, const QString &exportInfoFileName);

PIMDATAEXPORTER_EXPORT void addVersion(KZip *archive);
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT int archiveVersion(KZip *archive);

Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT int currentArchiveVersion();
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString appTypeToI18n(AppsType type);
Q_REQUIRED_RESULT PIMDATAEXPORTER_EXPORT QString storedTypeToI18n(StoredType type);
}
Q_DECLARE_TYPEINFO(Utils::AkonadiInstanceInfo, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(Utils::StoredTypes)