Debian Codegraph @

click-hooks/online-accounts-hooks2/accounts.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <[email protected]>
5 *
6 * This file is part of lomiri-online-accounts-ui's click hooks
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include <Accounts/Account>
22 #include <Accounts/Manager>
23 #include <Accounts/Service>
24 #include <QCoreApplication>
25 #include <QDateTime>
26 #include <QDebug>
27 #include <QDir>
28 #include <QDomDocument>
29 #include <QDomElement>
30 #include <QFile>
31 #include <QFileInfo>
32 #include <QJsonArray>
33 #include <QJsonDocument>
34 #include <QJsonObject>
35 #include <QStandardPaths>
36 #include <QStringList>
37 #include <click.h>
38 #include <sys/stat.h>
39 #include <sys/types.h>
40 #include <unistd.h>
41 #include <utime.h>
42 #include "acl-updater.h"cxx . . $ `<file>/click-hooks/online-accounts-hooks2/acl-updater.h`/
43
44 static QStringcxx . . $ QString# findPackageDircxx . . $ findPackageDir(fd988a2ab94d906b).(const QStringcxx . . $ QString# &appId)
45 {
46 /* For testing */
47 QByteArraycxx . . $ QByteArray# packageDirEnv = qgetenvcxx . . $ qgetenv(531409eeffcde449).("OAH_CLICK_DIR");
48 if (!packageDirEnv.isEmptycxx . . $ QByteArray#isEmpty(50ce9a9e25b4a850).()) {
49 return QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(4e15edac36d215be).(packageDirEnv);
50 }
51
52 QStringListcxx . . $ QStringList# components = appId.splitcxx . . $ QString#split(92030b8bf74e4227).('_'cxx . . $ QChar#QChar(f349c77f591a7878).);
53 QByteArraycxx . . $ QByteArray# package = components.firstcxx . . $ QList#first(19b2b6f17af048b).().toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).();
54
55 GError *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
56 ClickUser *user = click_user_new_for_user(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &error);
57 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(!user)) {
58 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to read Click database:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). error->messagecxx . . $ _GError#message.;
59 g_error_free(error);
60 return QStringcxx . . $ QString#QString(ced63f7c635d850d).();
61 }
62
63 gchar *pkgDir = click_user_get_path(user, package.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(), &error);
64 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(!pkgDir)) {
65 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unable to get the Click package directory for" <<cxx . . $ QDebug#`operator<<`(1387ba1672043913).
66 package <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). ":" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). error->messagecxx . . $ _GError#message.;
67 g_error_free(error);
68 g_object_unref(user);
69 return QStringcxx . . $ QString#QString(ced63f7c635d850d).();
70 }
71
72 QStringcxx . . $ QString# ret = QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(5ac70cc0fa2a874e).(pkgDir);
73 g_object_unref(user);
74 g_free(pkgDir);
75 return retcxx . . $ QString#QString(28715ad661ad3cec).;
76 }
77
78 static QStringcxx . . $ QString# stripVersioncxx . . $ stripVersion(fd988a2ab94d906b).(const QStringcxx . . $ QString# &appId)
79 {
80 QStringListcxx . . $ QStringList# components = appId.splitcxx . . $ QString#split(92030b8bf74e4227).('_'cxx . . $ QChar#QChar(f349c77f591a7878).);
81 if (components.countcxx . . $ QList#count(455f465bc33b4cdf).() != 3) return appIdcxx . . $ QString#QString(132dd6869045752b).;
82
83 /* Click packages have a profile of the form
84 * $name_$application_$version
85 * (see https://wiki.ubuntu.com/SecurityTeam/Specifications/ApplicationConfinement/Manifest#Click)
86 *
87 * So we just need to strip out the last part.
88 */
89 components.removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).();
90 return components.joincxx . . $ QListSpecialMethods#join(227e33e1a3bf1f91).('_'cxx . . $ QChar#QChar(f349c77f591a7878).);
91 }
92
93 class ManifestFilecxx . . $ ManifestFile# {
94 public:
95 ManifestFilecxx . . $ ManifestFile#ManifestFile(104eadfff4909ea4).(const QFileInfocxx . . $ QFileInfo# &hookFileInfo,
96 const QStringcxx . . $ QString# &appId, const QStringcxx . . $ QString# &shortAppId);
97
98 bool writeFilescxx . . $ ManifestFile#writeFiles(4a7c9e196a4f7dee).(const QDircxx . . $ QDir# &accountsDir);
99 bool writeServiceFilecxx . . $ ManifestFile#writeServiceFile(4e2d5f0ab45697fb).(const QDircxx . . $ QDir# &accountsDir, const QStringcxx . . $ QString# &id,
100 const QStringcxx . . $ QString# &provider, const QJsonObjectcxx . . $ QJsonObject# &json);
101 bool writePluginscxx . . $ ManifestFile#writePlugins(4a7c9e196a4f7dee).(const QDircxx . . $ QDir# &accountsDir);
102 bool writeProviderFilecxx . . $ ManifestFile#writeProviderFile(8a42707398da64b1).(const QDircxx . . $ QDir# &accountsDir, const QStringcxx . . $ QString# &id,
103 const QJsonObjectcxx . . $ QJsonObject# &json);
104 QDomDocumentcxx . . $ QDomDocument# createDocumentcxx . . $ ManifestFile#createDocument(a02aa8e2c8f5519c).() const;
105 QDomElementcxx . . $ QDomElement# createGroupcxx . . $ ManifestFile#createGroup(53e73ae953cefcd1).(QDomDocumentcxx . . $ QDomDocument# &doc, const QStringcxx . . $ QString# &name);
106 void addTemplatecxx . . $ ManifestFile#addTemplate(bbc5e80836dc760c).(QDomDocumentcxx . . $ QDomDocument# &doc, const QJsonObjectcxx . . $ QJsonObject# &json);
107 void addSettingcxx . . $ ManifestFile#addSetting(781d4c2c5d5a0ab7).(QDomElementcxx . . $ QDomElement# &parent, const QStringcxx . . $ QString# &name,
108 const QStringcxx . . $ QString# &value, const QStringcxx . . $ QString# &type = QStringcxx . . $ QString#QString(ced63f7c635d850d).());
109 void addSettingscxx . . $ ManifestFile#addSettings(74e681f5457f56cf).(QDomElementcxx . . $ QDomElement# &parent, const QJsonObjectcxx . . $ QJsonObject# &json);
110 void parseManifestcxx . . $ ManifestFile#parseManifest(6b379e5d051a9fe4).(const QJsonObjectcxx . . $ QJsonObject# &mainObject);
111 void checkIdcxx . . $ ManifestFile#checkId(3520e46b33348bf6).(const QStringcxx . . $ QString# &shortAppId);
112 void addProfilecxx . . $ ManifestFile#addProfile(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc);
113 void addPackageDircxx . . $ ManifestFile#addPackageDir(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc);
114 void addTranslationscxx . . $ ManifestFile#addTranslations(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc);
115 QStringcxx . . $ QString# profilecxx . . $ ManifestFile#profile(6ef7b6c27b00b43d).() const;
116 void addDesktopFilecxx . . $ ManifestFile#addDesktopFile(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc);
117 bool writeXmlFilecxx . . $ ManifestFile#writeXmlFile(e4f6afaeae844d2d).(const QDomDocumentcxx . . $ QDomDocument# &doc, const QStringcxx . . $ QString# &fileName) const;
118 bool isValidcxx . . $ ManifestFile#isValid(50ce9a9e25b4a850).() const { return m_isValidcxx . . $ ManifestFile#m_isValid.; }
119
120 private:
121 QFileInfocxx . . $ QFileInfo# m_hookFileInfocxx . . $ ManifestFile#m_hookFileInfo.;
122 QStringcxx . . $ QString# m_packageDircxx . . $ ManifestFile#m_packageDir.;
123 QJsonArraycxx . . $ QJsonArray# m_servicescxx . . $ ManifestFile#m_services.;
124 QJsonObjectcxx . . $ QJsonObject# m_plugincxx . . $ ManifestFile#m_plugin.;
125 QStringcxx . . $ QString# m_appIdcxx . . $ ManifestFile#m_appId.;
126 QStringcxx . . $ QString# m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.;
127 QStringcxx . . $ QString# m_trDomaincxx . . $ ManifestFile#m_trDomain.;
128 bool m_isScopecxx . . $ ManifestFile#m_isScope.;
129 bool m_isValidcxx . . $ ManifestFile#m_isValid.;
130 };
131
132 ManifestFilecxx . . $ ManifestFile#::ManifestFilecxx . . $ ManifestFile#ManifestFile(104eadfff4909ea4).(const QFileInfocxx . . $ QFileInfo# &hookFileInfo,
133 const QStringcxx . . $ QString# &appId,
134 const QStringcxx . . $ QString# &shortAppId):
135 m_hookFileInfocxx . . $ ManifestFile#m_hookFileInfo.(hookFileInfo),
136 m_appIdcxx . . $ ManifestFile#m_appId.(appId),
137 m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.(shortAppId),
138 m_isScopecxx . . $ ManifestFile#m_isScope.(false),
139 m_isValidcxx . . $ ManifestFile#m_isValid.(false)
140 {
141 QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(hookFileInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).());
142 if (file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::ReadOnlycxx . . $ QIODevice#ReadOnly.)) {
143 QJsonDocumentcxx . . $ QJsonDocument# doc = QJsonDocumentcxx . . $ QJsonDocument#::fromJsoncxx . . $ QJsonDocument#fromJson(731a4d2b2d08d93c).(file.readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).());
144 QJsonObjectcxx . . $ QJsonObject# mainObject = doc.objectcxx . . $ QJsonDocument#object(ac8af9874357714b).();
145 file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).();
146
147 m_servicescxx . . $ ManifestFile#m_services. =cxx . . $ QJsonArray#`operator=`(9ab9c3fb97f1b39f). mainObject.valuecxx . . $ QJsonObject#value(23911ba692ce408c).("services"cxx . . $ QString#QString(85c52e162fed56f9).).toArraycxx . . $ QJsonValue#toArray(98974f179f8308bf).();
148 m_trDomaincxx . . $ ManifestFile#m_trDomain. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). mainObject.valuecxx . . $ QJsonObject#value(23911ba692ce408c).("translations"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
149 m_plugincxx . . $ ManifestFile#m_plugin. =cxx . . $ QJsonObject#`operator=`(4a930641ef84a0f6). mainObject.valuecxx . . $ QJsonObject#value(23911ba692ce408c).("plugin"cxx . . $ QString#QString(85c52e162fed56f9).).toObjectcxx . . $ QJsonValue#toObject(ac8af9874357714b).();
150 m_isScopecxx . . $ ManifestFile#m_isScope. = mainObject.valuecxx . . $ QJsonObject#value(23911ba692ce408c).("scope"cxx . . $ QString#QString(85c52e162fed56f9).).toBoolcxx . . $ QJsonValue#toBool(962fae8be55e1d9).();
151 m_isValidcxx . . $ ManifestFile#m_isValid. = !m_servicescxx . . $ ManifestFile#m_services..isEmptycxx . . $ QJsonArray#isEmpty(50ce9a9e25b4a850).() || !m_plugincxx . . $ ManifestFile#m_plugin..isEmptycxx . . $ QJsonObject#isEmpty(50ce9a9e25b4a850).();
152
153 m_packageDircxx . . $ ManifestFile#m_packageDir. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). findPackageDircxx . . $ findPackageDir(fd988a2ab94d906b).(appId);
154 }
155 }
156
157 bool ManifestFilecxx . . $ ManifestFile#::writeFilescxx . . $ ManifestFile#writeFiles(4a7c9e196a4f7dee).(const QDircxx . . $ QDir# &accountsDir)
158 {
159 bool ok = true;
160 QDomDocumentcxx . . $ QDomDocument# doc = createDocumentcxx . . $ ManifestFile#createDocument(a02aa8e2c8f5519c).();
161 QDomElementcxx . . $ QDomElement# root = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("application"));
162 root.setAttributecxx . . $ QDomElement#setAttribute(c1427772cd1877b0).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("id"), m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.);
163 doc.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(root);
164
165 addProfilecxx . . $ ManifestFile#addProfile(35e8232c482c7195).(doc);
166 addPackageDircxx . . $ ManifestFile#addPackageDir(35e8232c482c7195).(doc);
167 addDesktopFilecxx . . $ ManifestFile#addDesktopFile(35e8232c482c7195).(doc);
168 addTranslationscxx . . $ ManifestFile#addTranslations(35e8232c482c7195).(doc);
169
170 QDomElementcxx . . $ QDomElement# servicesElem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("services"));
171 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QJsonValue &v, m_services) {
172 QJsonObjectcxx . . $ QJsonObject# o = v.toObjectcxx . . $ QJsonValue#toObject(ac8af9874357714b).();
173 QStringcxx . . $ QString# provider = o.valuecxx . . $ QJsonObject#value(23911ba692ce408c).("provider"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
174 QStringcxx . . $ QString# id = QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1_%2").argcxx . . $ QString#arg(bc823072288cbbb5).(m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.).argcxx . . $ QString#arg(bc823072288cbbb5).(provider);
175 QStringcxx . . $ QString# description = o.valuecxx . . $ QJsonObject#value(23911ba692ce408c).("description"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
176 if (description.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) description =cxx . . $ QString#`operator=`(d02845eef0c33901). ".";
177
178 QDomElementcxx . . $ QDomElement# serviceElem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("service"));
179 serviceElem.setAttributecxx . . $ QDomElement#setAttribute(c1427772cd1877b0).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("id"), id);
180 QDomElementcxx . . $ QDomElement# elem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("description"));
181 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(description));
182 serviceElem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
183 servicesElem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(serviceElem);
184
185 if (!writeServiceFilecxx . . $ ManifestFile#writeServiceFile(4e2d5f0ab45697fb).(accountsDir, id, provider, o)) {
186 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Writing service file failed" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). id;
187 ok = false;
188 break;
189 }
190 }
191 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(servicesElem);
192
193 if (!writePluginscxx . . $ ManifestFile#writePlugins(4a7c9e196a4f7dee).(accountsDir)) {
194 ok = false;
195 }
196
197 if (ok && !m_servicescxx . . $ ManifestFile#m_services..isEmptycxx . . $ QJsonArray#isEmpty(50ce9a9e25b4a850).()) {
198 QStringcxx . . $ QString# applicationFile =
199 QStringcxx . . $ QString#QString(85c52e162fed56f9).("applications/%1.application").argcxx . . $ QString#arg(bc823072288cbbb5).(m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.);
200 if (!writeXmlFilecxx . . $ ManifestFile#writeXmlFile(e4f6afaeae844d2d).(doc, accountsDir.filePathcxx . . $ QDir#filePath(5555d9024dcf93fb).(applicationFile))) {
201 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Writing application file failed" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). applicationFile;
202 ok = false;
203 }
204 }
205
206 return ok;
207 }
208
209 bool ManifestFilecxx . . $ ManifestFile#::writeServiceFilecxx . . $ ManifestFile#writeServiceFile(4e2d5f0ab45697fb).(const QDircxx . . $ QDir# &accountsDir, const QStringcxx . . $ QString# &id,
210 const QStringcxx . . $ QString# &provider,
211 const QJsonObjectcxx . . $ QJsonObject# &json)
212 {
213 QDomDocumentcxx . . $ QDomDocument# doc = createDocumentcxx . . $ ManifestFile#createDocument(a02aa8e2c8f5519c).();
214 QDomElementcxx . . $ QDomElement# root = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("service"));
215 root.setAttributecxx . . $ QDomElement#setAttribute(c1427772cd1877b0).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("id"), id);
216 doc.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(root);
217
218 // type
219 QDomElementcxx . . $ QDomElement# elem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("type"));
220 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.));
221 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
222
223 // provider
224 elem =cxx . . $ QDomElement#`operator=`(b7fc97416e752cd8). doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("provider"));
225 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(provider));
226 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
227
228 // name
229 QStringcxx . . $ QString# name = json.valuecxx . . $ QJsonObject#value(23911ba692ce408c).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("name")).toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
230 if (name.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) {
231 name =cxx . . $ QString#`operator=`(d02845eef0c33901). ".";
232 }
233 elem =cxx . . $ QDomElement#`operator=`(b7fc97416e752cd8). doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("name"));
234 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(name));
235 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
236
237 addProfilecxx . . $ ManifestFile#addProfile(35e8232c482c7195).(doc);
238 addTranslationscxx . . $ ManifestFile#addTranslations(35e8232c482c7195).(doc);
239 addTemplatecxx . . $ ManifestFile#addTemplate(bbc5e80836dc760c).(doc, json);
240
241 return writeXmlFilecxx . . $ ManifestFile#writeXmlFile(e4f6afaeae844d2d).(doc, accountsDir.filePathcxx . . $ QDir#filePath(5555d9024dcf93fb).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("services/%1.service").argcxx . . $ QString#arg(bc823072288cbbb5).(id)));
242 }
243
244 bool ManifestFilecxx . . $ ManifestFile#::writePluginscxx . . $ ManifestFile#writePlugins(4a7c9e196a4f7dee).(const QDircxx . . $ QDir# &accountsDir)
245 {
246 if (m_plugincxx . . $ ManifestFile#m_plugin..isEmptycxx . . $ QJsonObject#isEmpty(50ce9a9e25b4a850).()) return true;
247
248 QStringcxx . . $ QString# qmlPlugin = m_plugincxx . . $ ManifestFile#m_plugin..valuecxx . . $ QJsonObject#value(23911ba692ce408c).("qml"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
249 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(qmlPlugin.isEmpty())) {
250 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Plugin is missing 'qml' key";
251 return false;
252 }
253
254 if (!QDircxx . . $ QDir#::isAbsolutePathcxx . . $ QDir#isAbsolutePath(e1defb592416720d).(qmlPlugin)) {
255 qmlPlugin =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). m_packageDircxx . . $ ManifestFile#m_packageDir. +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(fab9b4f80031f353). qmlPlugin;
256 }
257
258 if (!QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(qmlPlugin)) {
259 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Can't find QML files in" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). qmlPlugin;
260 return false;
261 }
262
263 QStringcxx . . $ QString# qmlDestination = QStringcxx . . $ QString#QString(85c52e162fed56f9).("qml-plugins/%1").argcxx . . $ QString#arg(bc823072288cbbb5).(m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.);
264 QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(accountsDir.filePathcxx . . $ QDir#filePath(5555d9024dcf93fb).(qmlDestination));
265 if (!QFilecxx . . $ QFile#::linkcxx . . $ QFile#link(edf9e4f73813982f).(qmlPlugin, accountsDir.filePathcxx . . $ QDir#filePath(5555d9024dcf93fb).(qmlDestination))) {
266 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Cannot symlink QML files" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). qmlPlugin;
267 return false;
268 }
269
270 if (!writeProviderFilecxx . . $ ManifestFile#writeProviderFile(8a42707398da64b1).(accountsDir, m_shortAppIdcxx . . $ ManifestFile#m_shortAppId., m_plugincxx . . $ ManifestFile#m_plugin.)) {
271 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Writing provider file failed" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). m_shortAppIdcxx . . $ ManifestFile#m_shortAppId.;
272 return false;
273 }
274 return true;
275 }
276
277 bool ManifestFilecxx . . $ ManifestFile#::writeProviderFilecxx . . $ ManifestFile#writeProviderFile(8a42707398da64b1).(const QDircxx . . $ QDir# &accountsDir,
278 const QStringcxx . . $ QString# &id,
279 const QJsonObjectcxx . . $ QJsonObject# &json)
280 {
281 QDomDocumentcxx . . $ QDomDocument# doc = createDocumentcxx . . $ ManifestFile#createDocument(a02aa8e2c8f5519c).();
282 QDomElementcxx . . $ QDomElement# root = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("provider"));
283 root.setAttributecxx . . $ QDomElement#setAttribute(c1427772cd1877b0).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("id"), id);
284 doc.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(root);
285
286 // name
287 QStringcxx . . $ QString# name = json.valuecxx . . $ QJsonObject#value(23911ba692ce408c).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("name")).toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
288 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(name.isEmpty())) {
289 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Provider name is required";
290 return false;
291 }
292 QDomElementcxx . . $ QDomElement# elem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("name"));
293 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(name));
294 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
295
296 // icon
297 QStringcxx . . $ QString# icon = json.valuecxx . . $ QJsonObject#value(23911ba692ce408c).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("icon")).toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
298 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(icon.isEmpty())) {
299 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Provider icon is required";
300 return false;
301 }
302 if (!QDircxx . . $ QDir#::isAbsolutePathcxx . . $ QDir#isAbsolutePath(e1defb592416720d).(icon)) {
303 QStringcxx . . $ QString# test = m_packageDircxx . . $ ManifestFile#m_packageDir. +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(fab9b4f80031f353). icon;
304 if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(test)) {
305 icon =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). test;
306 }
307 }
308 elem =cxx . . $ QDomElement#`operator=`(b7fc97416e752cd8). doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("icon"));
309 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(icon));
310 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
311
312 addProfilecxx . . $ ManifestFile#addProfile(35e8232c482c7195).(doc);
313 addTranslationscxx . . $ ManifestFile#addTranslations(35e8232c482c7195).(doc);
314 addTemplatecxx . . $ ManifestFile#addTemplate(bbc5e80836dc760c).(doc, json);
315 addPackageDircxx . . $ ManifestFile#addPackageDir(35e8232c482c7195).(doc);
316
317 return writeXmlFilecxx . . $ ManifestFile#writeXmlFile(e4f6afaeae844d2d).(doc, accountsDir.filePathcxx . . $ QDir#filePath(5555d9024dcf93fb).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("providers/%1.provider").argcxx . . $ QString#arg(bc823072288cbbb5).(id)));
318 }
319
320 QDomDocumentcxx . . $ QDomDocument# ManifestFilecxx . . $ ManifestFile#::createDocumentcxx . . $ ManifestFile#createDocument(a02aa8e2c8f5519c).() const
321 {
322 QDomDocumentcxx . . $ QDomDocument# doccxx . . $ QDomDocument#QDomDocument(49f6e7a06ebc5aa8).;
323 doc.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createProcessingInstructioncxx . . $ QDomDocument#createProcessingInstruction(90048dc8ea7f8a9e).("xml"cxx . . $ QString#QString(85c52e162fed56f9)., "version=\"1.0\" encoding=\"UTF-8\""cxx . . $ QString#QString(85c52e162fed56f9).));
324 QStringcxx . . $ QString# comment = QStringcxx . . $ QString#QString(85c52e162fed56f9).("this file is auto-generated by %1; do not modify").
325 argcxx . . $ QString#arg(bc823072288cbbb5).(QCoreApplicationcxx . . $ QCoreApplication#::applicationNamecxx . . $ QCoreApplication#applicationName(4365c3963150523e).());
326 doc.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createCommentcxx . . $ QDomDocument#createComment(60c900734d52b713).(comment));
327 return doccxx . . $ QDomDocument#QDomDocument(3308d65cb848d502).;
328 }
329
330 QDomElementcxx . . $ QDomElement# ManifestFilecxx . . $ ManifestFile#::createGroupcxx . . $ ManifestFile#createGroup(53e73ae953cefcd1).(QDomDocumentcxx . . $ QDomDocument# &doc, const QStringcxx . . $ QString# &name)
331 {
332 QDomElementcxx . . $ QDomElement# group = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("group"));
333 group.setAttributecxx . . $ QDomElement#setAttribute(c1427772cd1877b0).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("name"), name);
334 return groupcxx . . $ QDomElement#QDomElement(d2dcf726a9946ae8).;
335 }
336
337 void ManifestFilecxx . . $ ManifestFile#::addTemplatecxx . . $ ManifestFile#addTemplate(bbc5e80836dc760c).(QDomDocumentcxx . . $ QDomDocument# &doc, const QJsonObjectcxx . . $ QJsonObject# &json)
338 {
339 QDomElementcxx . . $ QDomElement# root = doc.documentElementcxx . . $ QDomDocument#documentElement(654df8c29726cab1).();
340 QDomElementcxx . . $ QDomElement# templateElem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("template"));
341
342 // auth
343 QDomElementcxx . . $ QDomElement# authElem = createGroupcxx . . $ ManifestFile#createGroup(53e73ae953cefcd1).(doc, QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("auth"));
344 QJsonObjectcxx . . $ QJsonObject# auth = json.valuecxx . . $ QJsonObject#value(23911ba692ce408c).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("auth")).toObjectcxx . . $ QJsonValue#toObject(ac8af9874357714b).();
345 for (QJsonObjectcxx . . $ QJsonObject#::const_iteratorcxx . . $ QJsonObject#const_iterator# i = authcxx . . $ QJsonObject#const_iterator#const_iterator(f5c7af6ced0b4de3)..begincxx . . $ QJsonObject#begin(c984ed7b6d8d6bb1).(); i !=cxx . . $ QJsonObject#const_iterator#`operator!=`(32e7b272c2d1ea23). auth.endcxx . . $ QJsonObject#end(c984ed7b6d8d6bb1).(); i++cxx . . $ QJsonObject#const_iterator#operator++(2555610f756059ce).) {
346 QStringListcxx . . $ QStringList# authParts = i.keycxx . . $ QJsonObject#const_iterator#key(6ef7b6c27b00b43d).().splitcxx . . $ QString#split(c8b44a97dcb6200d).("/"cxx . . $ QString#QString(85c52e162fed56f9).);
347 if (authParts.countcxx . . $ QList#count(455f465bc33b4cdf).() != 2) {
348 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "auth key must contain exactly one '/'!";
349 continue;
350 }
351 QStringcxx . . $ QString# method = authPartscxx . . $ QString#QString(132dd6869045752b).[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).0];
352 QStringcxx . . $ QString# mechanism = authPartscxx . . $ QString#QString(132dd6869045752b).[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).1];
353
354 addSettingcxx . . $ ManifestFile#addSetting(781d4c2c5d5a0ab7).(authElem, QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("method"), method);
355 addSettingcxx . . $ ManifestFile#addSetting(781d4c2c5d5a0ab7).(authElem, QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("mechanism"), mechanism);
356
357 QDomElementcxx . . $ QDomElement# methodGroup = createGroupcxx . . $ ManifestFile#createGroup(53e73ae953cefcd1).(doc, method);
358 authElem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(methodGroup);
359 QDomElementcxx . . $ QDomElement# mechanismGroup = createGroupcxx . . $ ManifestFile#createGroup(53e73ae953cefcd1).(doc, mechanism);
360
361 addSettingscxx . . $ ManifestFile#addSettings(74e681f5457f56cf).(mechanismGroup, i.valuecxx . . $ QJsonObject#const_iterator#value(6e116780281b94e5).().toObjectcxx . . $ QJsonValue#toObject(ac8af9874357714b).());
362 methodGroup.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(mechanismGroup);
363 }
364
365 if (!auth.isEmptycxx . . $ QJsonObject#isEmpty(50ce9a9e25b4a850).()) templateElem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(authElem);
366
367 // settings
368 QJsonObjectcxx . . $ QJsonObject# settings = json.valuecxx . . $ QJsonObject#value(23911ba692ce408c).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("settings")).toObjectcxx . . $ QJsonValue#toObject(ac8af9874357714b).();
369 addSettingscxx . . $ ManifestFile#addSettings(74e681f5457f56cf).(templateElem, settings);
370
371 if (templateElem.hasChildNodescxx . . $ QDomNode#hasChildNodes(50ce9a9e25b4a850).()) {
372 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(templateElem);
373 }
374 }
375
376 void ManifestFilecxx . . $ ManifestFile#::addSettingcxx . . $ ManifestFile#addSetting(781d4c2c5d5a0ab7).(QDomElementcxx . . $ QDomElement# &parent, const QStringcxx . . $ QString# &name,
377 const QStringcxx . . $ QString# &value, const QStringcxx . . $ QString# &type)
378 {
379 QDomDocumentcxx . . $ QDomDocument# doc = parent.ownerDocumentcxx . . $ QDomNode#ownerDocument(a02aa8e2c8f5519c).();
380 QDomElementcxx . . $ QDomElement# setting = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("setting"));
381 setting.setAttributecxx . . $ QDomElement#setAttribute(c1427772cd1877b0).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("name"), name);
382 if (!type.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) {
383 setting.setAttributecxx . . $ QDomElement#setAttribute(c1427772cd1877b0).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("type"), type);
384 }
385 setting.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(value));
386 parent.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(setting);
387 }
388
389 void ManifestFilecxx . . $ ManifestFile#::addSettingscxx . . $ ManifestFile#addSettings(74e681f5457f56cf).(QDomElementcxx . . $ QDomElement# &parent, const QJsonObjectcxx . . $ QJsonObject# &json)
390 {
391 QDomDocumentcxx . . $ QDomDocument# doc = parent.ownerDocumentcxx . . $ QDomNode#ownerDocument(a02aa8e2c8f5519c).();
392 for (QJsonObjectcxx . . $ QJsonObject#::const_iteratorcxx . . $ QJsonObject#const_iterator# i = json.begincxx . . $ QJsonObject#begin(254f5eb3de92cf03).(); i !=cxx . . $ QJsonObject#const_iterator#`operator!=`(e51f5f22a74cd46a). json.endcxx . . $ QJsonObject#end(254f5eb3de92cf03).(); i++cxx . . $ QJsonObject#const_iterator#operator++(2555610f756059ce).) {
393 QDomElementcxx . . $ QDomElement# elem = parentcxx . . $ QDomElement#QDomElement(d2dcf726a9946ae8).;
394 QStringListcxx . . $ QStringList# parts = i.keycxx . . $ QJsonObject#const_iterator#key(6ef7b6c27b00b43d).().splitcxx . . $ QString#split(92030b8bf74e4227).('/'cxx . . $ QChar#QChar(f349c77f591a7878).);
395 QStringcxx . . $ QString# key = parts.takeLastcxx . . $ QList#takeLast(5f357b03ed472e5e).();
396 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QString &groupName, parts) {
397 QDomElementcxx . . $ QDomElement# subGroup = createGroupcxx . . $ ManifestFile#createGroup(53e73ae953cefcd1).(doc, groupName);
398 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(subGroup);
399 elem =cxx . . $ QDomElement#`operator=`(b7fc97416e752cd8). subGroup;
400 }
401 QStringcxx . . $ QString# valuecxx . . $ QString#QString(ced63f7c635d850d).;
402 QStringcxx . . $ QString# typecxx . . $ QString#QString(ced63f7c635d850d).;
403 switch (i.valuecxx . . $ QJsonObject#const_iterator#value(6e116780281b94e5).().typecxx . . $ QJsonValue#type(a21e5957801f5c47).()) {
404 case QJsonValuecxx . . $ QJsonValue#::Boolcxx . . $ QJsonValue#Bool.:
405 type =cxx . . $ QString#`operator=`(d02845eef0c33901). "b";
406 value =cxx . . $ QString#`operator=`(d02845eef0c33901). i.valuecxx . . $ QJsonObject#const_iterator#value(6e116780281b94e5).().toBoolcxx . . $ QJsonValue#toBool(962fae8be55e1d9).() ? "true" : "false";
407 break;
408 case QJsonValuecxx . . $ QJsonValue#::Stringcxx . . $ QJsonValue#String.:
409 value =cxx . . $ QString#`operator=`(4f35bf974e7f8568). i.valuecxx . . $ QJsonObject#const_iterator#value(6e116780281b94e5).().toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).();
410 break;
411 case QJsonValuecxx . . $ QJsonValue#::Arraycxx . . $ QJsonValue#Array.:
412 {
413 QJsonArraycxx . . $ QJsonArray# array = i.valuecxx . . $ QJsonObject#const_iterator#value(6e116780281b94e5).().toArraycxx . . $ QJsonValue#toArray(98974f179f8308bf).();
414 QStringListcxx . . $ QStringList# valuescxx . . $ QStringList#QStringList(ced63f7c635d850d).;
415 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QJsonValue &v, array) {
416 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(v.type() != QJsonValue::String)) {
417 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Only arrays of strings are supported!";
418 continue;
419 }
420 values.appendcxx . . $ QList#append(77d9f17553126ecb).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("'%1'").argcxx . . $ QString#arg(bc823072288cbbb5).(v.toStringcxx . . $ QJsonValue#toString(6ef7b6c27b00b43d).()));
421 }
422 type =cxx . . $ QString#`operator=`(d02845eef0c33901). "as";
423 value =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("[%1]").argcxx . . $ QString#arg(bc823072288cbbb5).(values.joincxx . . $ QListSpecialMethods#join(227e33e1a3bf1f91).(','cxx . . $ QChar#QChar(f349c77f591a7878).));
424 }
425 break;
426 case QJsonValuecxx . . $ QJsonValue#::Objectcxx . . $ QJsonValue#Object.:
427 {
428 QDomElementcxx . . $ QDomElement# subGroup = createGroupcxx . . $ ManifestFile#createGroup(53e73ae953cefcd1).(doc, key);
429 QJsonObjectcxx . . $ QJsonObject# object = i.valuecxx . . $ QJsonObject#const_iterator#value(6e116780281b94e5).().toObjectcxx . . $ QJsonValue#toObject(ac8af9874357714b).();
430 addSettingscxx . . $ ManifestFile#addSettings(74e681f5457f56cf).(subGroup, object);
431 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(subGroup);
432 }
433 break;
434 default:
435 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Unsupported setting type:" <<cxx . . $ `operator<<`(829abc291973e271). i.valuecxx . . $ QJsonObject#const_iterator#value(6e116780281b94e5).();
436 }
437 if (value.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) continue;
438 addSettingcxx . . $ ManifestFile#addSetting(781d4c2c5d5a0ab7).(elem, key, value, type);
439 }
440 }
441
442 void ManifestFilecxx . . $ ManifestFile#::addProfilecxx . . $ ManifestFile#addProfile(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc)
443 {
444 QDomElementcxx . . $ QDomElement# root = doc.documentElementcxx . . $ QDomDocument#documentElement(654df8c29726cab1).();
445 QDomElementcxx . . $ QDomElement# elem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("profile"));
446 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(m_appIdcxx . . $ ManifestFile#m_appId.));
447 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
448 }
449
450 void ManifestFilecxx . . $ ManifestFile#::addTranslationscxx . . $ ManifestFile#addTranslations(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc)
451 {
452 if (m_trDomaincxx . . $ ManifestFile#m_trDomain..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) return;
453 QDomElementcxx . . $ QDomElement# root = doc.documentElementcxx . . $ QDomDocument#documentElement(654df8c29726cab1).();
454 QDomElementcxx . . $ QDomElement# elem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("translations"));
455 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(m_trDomaincxx . . $ ManifestFile#m_trDomain.));
456 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
457 }
458
459 void ManifestFilecxx . . $ ManifestFile#::addPackageDircxx . . $ ManifestFile#addPackageDir(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc)
460 {
461 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(m_packageDir.isEmpty())) return;
462
463 QDomElementcxx . . $ QDomElement# root = doc.documentElementcxx . . $ QDomDocument#documentElement(654df8c29726cab1).();
464 QDomElementcxx . . $ QDomElement# elem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("package-dir"));
465 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(m_packageDircxx . . $ ManifestFile#m_packageDir.));
466 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
467 }
468
469 void ManifestFilecxx . . $ ManifestFile#::addDesktopFilecxx . . $ ManifestFile#addDesktopFile(35e8232c482c7195).(QDomDocumentcxx . . $ QDomDocument# &doc)
470 {
471 QDomElementcxx . . $ QDomElement# root = doc.documentElementcxx . . $ QDomDocument#documentElement(654df8c29726cab1).();
472 QDomElementcxx . . $ QDomElement# elem = doc.createElementcxx . . $ QDomDocument#createElement(2ec621aca303d14e).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("desktop-entry"));
473 elem.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(doc.createTextNodecxx . . $ QDomDocument#createTextNode(9b156b786da100e8).(m_isScopecxx . . $ ManifestFile#m_isScope. ? m_shortAppIdcxx . . $ ManifestFile#m_shortAppId. : m_appIdcxx . . $ ManifestFile#m_appId.));
474 root.appendChildcxx . . $ QDomNode#appendChild(1fce9d70e2f1e814).(elem);
475 }
476
477 bool ManifestFilecxx . . $ ManifestFile#::writeXmlFilecxx . . $ ManifestFile#writeXmlFile(e4f6afaeae844d2d).(const QDomDocumentcxx . . $ QDomDocument# &doc, const QStringcxx . . $ QString# &fileName) const
478 {
479 QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(fileName);
480 if (!file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QIODevice#::WriteOnlycxx . . $ QIODevice#WriteOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QIODevicecxx . . $ QIODevice#::Textcxx . . $ QIODevice#Text.)) return false;
481
482 bool ok = (file.writecxx . . $ QIODevice#write(4ee2750a0be83987).(doc.toByteArraycxx . . $ QDomDocument#toByteArray(1e245adf2d5d15b2).(2)) > 0);
483 file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).();
484
485 if (ok) {
486 return true;
487 } else {
488 QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(fileName);
489 return false;
490 }
491 }
492
493 class LibAccountsFilecxx . . $ LibAccountsFile#: public QDomDocumentcxx . . $ QDomDocument# {
494 public:
495 explicit LibAccountsFilecxx . . $ LibAccountsFile#LibAccountsFile(208c3155c9413262).(const QFileInfocxx . . $ QFileInfo# &fileInfo);
496
497 QStringcxx . . $ QString# profilecxx . . $ LibAccountsFile#profile(6ef7b6c27b00b43d).() const;
498 bool createdByUscxx . . $ LibAccountsFile#createdByUs(50ce9a9e25b4a850).() const;
499 bool isValidcxx . . $ LibAccountsFile#isValid(50ce9a9e25b4a850).() const { return m_isValidcxx . . $ LibAccountsFile#m_isValid.; }
500
501 private:
502 QFileInfocxx . . $ QFileInfo# m_fileInfocxx . . $ LibAccountsFile#m_fileInfo.;
503 bool m_isValidcxx . . $ LibAccountsFile#m_isValid.;
504 };
505
506 LibAccountsFilecxx . . $ LibAccountsFile#::LibAccountsFilecxx . . $ LibAccountsFile#LibAccountsFile(208c3155c9413262).(const QFileInfocxx . . $ QFileInfo# &fileInfo):
507 QDomDocumentcxx . . $ QDomDocument#QDomDocument(49f6e7a06ebc5aa8).(),
508 m_fileInfocxx . . $ LibAccountsFile#m_fileInfo.(fileInfo),
509 m_isValidcxx . . $ LibAccountsFile#m_isValid.(false)
510 {
511 QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(fileInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).());
512 if (file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::ReadOnlycxx . . $ QIODevice#ReadOnly.)) {
513 if (setContentcxx . . $ QDomDocument#setContent(561bc04b7005bb24).(&file)) {
514 m_isValidcxx . . $ LibAccountsFile#m_isValid. = true;
515 }
516 file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).();
517 }
518 }
519
520 QStringcxx . . $ QString# LibAccountsFilecxx . . $ LibAccountsFile#::profilecxx . . $ LibAccountsFile#profile(6ef7b6c27b00b43d).() const
521 {
522 QDomElementcxx . . $ QDomElement# root = documentElementcxx . . $ QDomDocument#documentElement(654df8c29726cab1).();
523 return root.firstChildElementcxx . . $ QDomNode#firstChildElement(d563d9084a4b323c).("profile"cxx . . $ QString#QString(85c52e162fed56f9).).textcxx . . $ QDomElement#text(6ef7b6c27b00b43d).();
524 }
525
526 bool LibAccountsFilecxx . . $ LibAccountsFile#::createdByUscxx . . $ LibAccountsFile#createdByUs(50ce9a9e25b4a850).() const
527 {
528 QStringcxx . . $ QString# creatorMark = QCoreApplicationcxx . . $ QCoreApplication#::applicationNamecxx . . $ QCoreApplication#applicationName(4365c3963150523e).() +cxx . . $ operator+(3d22f08efddf8107). ";";
529 for (QDomNodecxx . . $ QDomNode# n = firstChildcxx . . $ QDomNode#firstChild(573df4c535fc6ee7).(); !n.isNullcxx . . $ QDomNode#isNull(50ce9a9e25b4a850).(); n =cxx . . $ QDomNode#`operator=`(942bdfb15aedefaf). n.nextSiblingcxx . . $ QDomNode#nextSibling(573df4c535fc6ee7).()) {
530 if (n.isCommentcxx . . $ QDomNode#isComment(50ce9a9e25b4a850).() && n.nodeValuecxx . . $ QDomNode#nodeValue(6ef7b6c27b00b43d).().containscxx . . $ QString#contains(8cce4688c16f48f3).(creatorMark)) {
531 return true;
532 }
533 }
534 return false;
535 }
536
537 static void disableServicecxx . . $ disableService(26a51dd3a24be0af).(Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager# *manager,
538 const QStringcxx . . $ QString# &serviceId,
539 const QStringcxx . . $ QString# &profile)
540 {
541 Accountscxx . . $ Accounts/::Servicecxx . . $ Accounts/Service# service = manager->servicecxx . . $ Accounts/Manager#service(5286df8bfd80fbad).(serviceId);
542 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(!service.isValid())) return;
543
544 AclUpdatercxx . . $ AclUpdater# aclUpdatercxx . . $ AclUpdater#AclUpdater(49f6e7a06ebc5aa8).;
545 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(Accounts::AccountId accountId, manager->accountListEnabled()) {
546 Accountscxx . . $ Accounts/::Accountcxx . . $ Accounts/Account# *account = manager->accountcxx . . $ Accounts/Manager#account(e94dad5fac3d2066).(accountId);
547 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(!account)) continue;
548
549 if (account->providerNamecxx . . $ Accounts/Account#providerName(6ef7b6c27b00b43d).() !=cxx . . $ `operator!=`(5bc2975d2d751687). service.providercxx . . $ Accounts/Service#provider(6ef7b6c27b00b43d).()) continue;
550
551 uintcxx . . $ uint# credentialsId = account->credentialsIdcxx . . $ Accounts/Account#credentialsId(db52760e79bf9054).();
552 account->selectServicecxx . . $ Accounts/Account#selectService(3151c7fcce91492).(service);
553 if (account->isEnabledcxx . . $ Accounts/Account#isEnabled(50ce9a9e25b4a850).()) {
554 account->setEnabledcxx . . $ Accounts/Account#setEnabled(b45ddcbc8423892c).(false);
555 account->synccxx . . $ Accounts/Account#sync(49f6e7a06ebc5aa8).();
556 aclUpdater.removeAppcxx . . $ AclUpdater#removeApp(ba319f3035cc12a4).(stripVersioncxx . . $ stripVersion(fd988a2ab94d906b).(profile), credentialsId);
557 }
558 }
559 }
560
561 static void removeStaleAccountscxx . . $ removeStaleAccounts(bafb010a866eb68d).(Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager# *manager,
562 const QStringcxx . . $ QString# &providerName)
563 {
564 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(Accounts::AccountId id, manager->accountList()) {
565 Accountscxx . . $ Accounts/::Accountcxx . . $ Accounts/Account# *account = manager->accountcxx . . $ Accounts/Manager#account(e94dad5fac3d2066).(id);
566 if (account->providerNamecxx . . $ Accounts/Account#providerName(6ef7b6c27b00b43d).() ==cxx . . $ `operator==`(5bc2975d2d751687). providerName) {
567 account->removecxx . . $ Accounts/Account#remove(49f6e7a06ebc5aa8).();
568 account->syncAndBlockcxx . . $ Accounts/Account#syncAndBlock(c9857a73d68e59ba).();
569 }
570 }
571 }
572
573 static void removeStaleFilescxx . . $ removeStaleFiles(a0805b975728bbc4).(Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager# *manager,
574 const QStringListcxx . . $ QStringList# &fileTypes,
575 const QDircxx . . $ QDir# &accountsDir,
576 const QDircxx . . $ QDir# &hooksDirIn)
577 {
578 /* Walk through all of
579 * ~/.local/share/accounts/{providers,services,applications}/
580 * and remove files which are no longer present in hooksDirIn.
581 */
582 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QString &fileType, fileTypes) {
583 QDircxx . . $ QDir# dircxx . . $ QDir#QDir(3520e46b33348bf6).(accountsDir.filePathcxx . . $ QDir#filePath(5555d9024dcf93fb).(fileType +cxx . . $ operator+(3d22f08efddf8107). "s"));
584 dir.setFiltercxx . . $ QDir#setFilter(3cb6a626764edf13).(QDircxx . . $ QDir#::Filescxx . . $ QDir#Files. |cxx . . $ `operator|`(153b300229e4e3d0). QDircxx . . $ QDir#::Readablecxx . . $ QDir#Readable.);
585 QStringListcxx . . $ QStringList# fileTypeFiltercxx . . $ QStringList#QStringList(ced63f7c635d850d).;
586 fileTypeFilter <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "*." +cxx . . $ operator+(c75c3ae4eb9af1a8). fileType;
587 dir.setNameFilterscxx . . $ QDir#setNameFilters(631c0101495f0328).(fileTypeFilter);
588
589 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QFileInfo &fileInfo, dir.entryInfoList()) {
590 LibAccountsFilecxx . . $ LibAccountsFile# filecxx . . $ LibAccountsFile#LibAccountsFile(208c3155c9413262).(fileInfo);
591
592 /* If this file was not created by our hook let's ignore it. */
593 if (!file.createdByUscxx . . $ LibAccountsFile#createdByUs(50ce9a9e25b4a850).()) continue;
594
595 QStringcxx . . $ QString# profile = file.profilecxx . . $ LibAccountsFile#profile(6ef7b6c27b00b43d).();
596
597 /* Check that the hook file is still there; if it isn't, then it
598 * means that the click package was removed, and we must remove our
599 * copy as well. */
600 QStringcxx . . $ QString# hookFileName = stripVersioncxx . . $ stripVersion(fd988a2ab94d906b).(profile) +cxx . . $ operator+(3d22f08efddf8107). "_*.accounts";
601 QStringListcxx . . $ QStringList# nameFilters = QStringListcxx . . $ QStringList#QStringList(ced63f7c635d850d).() <<cxx . . $ QStringList#`operator<<`(85116071a693d053). hookFileName;
602 if (!hooksDirIn.entryListcxx . . $ QDir#entryList(4575c08c50802968).(nameFilters).isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) continue;
603
604 if (fileType ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "service") {
605 /* Make sure services get disabled. See also:
606 * https://bugs.launchpad.net/bugs/1417261 */
607 disableServicecxx . . $ disableService(26a51dd3a24be0af).(manager, fileInfo.completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).(), profile);
608 } else if (fileType ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "provider") {
609 /* If this is a provider, we must also remove any accounts
610 * associated with it */
611 removeStaleAccountscxx . . $ removeStaleAccounts(bafb010a866eb68d).(manager, fileInfo.completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).());
612 }
613 QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(fileInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).());
614 }
615 }
616 }
617
618 static void removeStaleTimestampFilescxx . . $ removeStaleTimestampFiles(601f444709e147bb).(const QDircxx . . $ QDir# &hooksDirIn)
619 {
620 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QFileInfo &fileInfo, hooksDirIn.entryInfoList()) {
621 if (fileInfo.suffixcxx . . $ QFileInfo#suffix(6ef7b6c27b00b43d).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "processed") continue;
622
623 /* Find the corresponding hook file */
624 QFileInfocxx . . $ QFileInfo# hookInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(fileInfo.absolutePathcxx . . $ QFileInfo#absolutePath(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(fab9b4f80031f353). fileInfo.completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).());
625
626 if (!hookInfo.existscxx . . $ QFileInfo#exists(50ce9a9e25b4a850).()) {
627 QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(fileInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).());
628 }
629 }
630 }
631
632 /* Get the modification time of a file; this differs from
633 * QFileInfo::lastModified() in that if the file is a symlink here we take the
634 * info from the symlink itself. */
635 static QDateTimecxx . . $ QDateTime# lastModifiedcxx . . $ lastModified(b660c26f576c0856).(const QFileInfocxx . . $ QFileInfo# &fileInfo)
636 {
637 struct stat data;
638 if (lstat(fileInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(), &data) < 0) {
639 return QDateTimecxx . . $ QDateTime#QDateTime(ced63f7c635d850d).();
640 }
641 return QDateTimecxx . . $ QDateTime#::fromSecsSinceEpochcxx . . $ QDateTime#fromSecsSinceEpoch(3ddfaf8b563ea524).(data.st_mtimecxx . . $ `<external>/16045971866008360577/struct_stat.h:78:11`!);
642 }
643
644 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv)
645 {
646 QCoreApplicationcxx . . $ QCoreApplication# appcxx . . $ QCoreApplication#QCoreApplication(6e9b1c7df49e191d).(argc, argv);
647
648 Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager#::Optionscxx . . $ Accounts/Manager#Options# managerOptionscxx . . $ QFlags#QFlags(ced63f7c635d850d).;
649 if (qgetenvcxx . . $ qgetenv(531409eeffcde449).("DBUS_SESSION_BUS_ADDRESS").isEmptycxx . . $ QByteArray#isEmpty(50ce9a9e25b4a850).()) {
650 managerOptions |=cxx . . $ QFlags#`operator|=`(fd64b2b07d6098e0). Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager#::DisableNotificationscxx . . $ Accounts/Manager#DisableNotifications.;
651 }
652 Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager# *manager = new Accountscxx . . $ Accounts/::Managercxx . . $ Accounts/Manager#(managerOptions);
653
654 /* Go through the hook files in ~/.local/share/online-accounts-hooks2/ and
655 * check if they have already been processed into a file under
656 * ~/.local/share/accounts/{services,applications}/;
657 * if not, open the hook file, write the APP_ID somewhere in it, and
658 * save the result in the location where libaccounts expects to find it.
659 */
660
661 QStringListcxx . . $ QStringList# fileTypescxx . . $ QStringList#QStringList(ced63f7c635d850d).;
662 fileTypes <<cxx . . $ QStringList#`operator<<`(85116071a693d053).
663 QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("service") <<cxx . . $ QStringList#`operator<<`(85116071a693d053).
664 QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("provider") <<cxx . . $ QStringList#`operator<<`(85116071a693d053).
665 QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("application");
666
667 // This is ~/.local/share/
668 const QStringcxx . . $ QString# localShare =
669 QStandardPathscxx . . $ QStandardPaths#::writableLocationcxx . . $ QStandardPaths#writableLocation(7d8b34fbb6a9c1bf).(QStandardPathscxx . . $ QStandardPaths#::GenericDataLocationcxx . . $ QStandardPaths#GenericDataLocation.);
670 QDircxx . . $ QDir# hooksDirIncxx . . $ QDir#QDir(3520e46b33348bf6).(localShare +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(3d22f08efddf8107). HOOK_FILES_SUBDIRcxx . . $ `<built-in>:477:9`!);
671
672 /* Make sure the directories exist */
673 QDircxx . . $ QDir# accountsDircxx . . $ QDir#QDir(3520e46b33348bf6).(localShare +cxx . . $ operator+(3d22f08efddf8107). "/accounts");
674 accountsDir.mkpathcxx . . $ QDir#mkpath(f3b39adf77d9c36c).("applications"cxx . . $ QString#QString(85c52e162fed56f9).);
675 accountsDir.mkpathcxx . . $ QDir#mkpath(f3b39adf77d9c36c).("services"cxx . . $ QString#QString(85c52e162fed56f9).);
676 accountsDir.mkpathcxx . . $ QDir#mkpath(f3b39adf77d9c36c).("providers"cxx . . $ QString#QString(85c52e162fed56f9).);
677 accountsDir.mkpathcxx . . $ QDir#mkpath(f3b39adf77d9c36c).("qml-plugins"cxx . . $ QString#QString(85c52e162fed56f9).);
678
679 removeStaleFilescxx . . $ removeStaleFiles(a0805b975728bbc4).(manager, fileTypes, accountsDir, hooksDirIn);
680 removeStaleTimestampFilescxx . . $ removeStaleTimestampFiles(601f444709e147bb).(hooksDirIn);
681
682 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QFileInfo &fileInfo, hooksDirIn.entryInfoList()) {
683 if (fileInfo.suffixcxx . . $ QFileInfo#suffix(6ef7b6c27b00b43d).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "accounts") continue;
684
685 // Our click hook sets the base name to the APP_ID
686 QStringcxx . . $ QString# appId = fileInfo.completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).();
687
688 /* When publishing this file for libaccounts, we want to strip
689 * the version number out. */
690 QStringcxx . . $ QString# shortAppId = stripVersioncxx . . $ stripVersion(fd988a2ab94d906b).(appId);
691
692 /* We create an empty file whenever we succesfully process a hook file.
693 * The name of this file is the same as the hook file, with the
694 * .processed suffix appended.
695 */
696 QFileInfocxx . . $ QFileInfo# processedInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(fileInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). ".processed");
697 if (processedInfo.existscxx . . $ QFileInfo#exists(50ce9a9e25b4a850).() &&
698 processedInfo.lastModifiedcxx . . $ QFileInfo#lastModified(4e062b5c490497ac).() ==cxx . . $ QDateTime#`operator==`(147858620bc979f5). lastModifiedcxx . . $ lastModified(b660c26f576c0856).(fileInfo)) {
699 continue;
700 }
701
702 ManifestFilecxx . . $ ManifestFile# manifest = ManifestFilecxx . . $ ManifestFile#ManifestFile(104eadfff4909ea4).(fileInfo, appId, shortAppId);
703 if (!manifest.isValidcxx . . $ ManifestFile#isValid(50ce9a9e25b4a850).()) {
704 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Invalid file" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). fileInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).();
705 continue;
706 }
707
708 if (manifest.writeFilescxx . . $ ManifestFile#writeFiles(4a7c9e196a4f7dee).(accountsDir)) {
709 QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(processedInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).());
710 if (file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QIODevice#::WriteOnlycxx . . $ QIODevice#WriteOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QIODevicecxx . . $ QIODevice#::Textcxx . . $ QIODevice#Text.)) {
711 file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).();
712 struct utimbuf sourceTime;
713 sourceTime.actime = sourceTime.modtime =
714 lastModifiedcxx . . $ lastModified(b660c26f576c0856).(fileInfo).toSecsSinceEpochcxx . . $ QDateTime#toSecsSinceEpoch(98833e9ab7de59a4).();
715 utime(processedInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(),
716 &sourceTime);
717 } else {
718 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Could not create timestamp file" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8).
719 processedInfo.filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).();
720 }
721 }
722 }
723
724 /* To ensure that all the installed services are parsed into
725 * libaccounts' DB, we enumerate them now.
726 */
727 manager->serviceListcxx . . $ Accounts/Manager#serviceList(afa5a1da79d6f492).();
728 delete manager;
729
730 return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!;
731 }
732