| 1 | /* |
| 2 | * Copyright (C) 2013-2015 Canonical Ltd. |
| 3 | * |
| 4 | * Contact: Alberto Mardegan <[email protected]> |
| 5 | * |
| 6 | * This file is part of lomiri-online-accounts-ui |
| 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 <online-accounts-common/debug.h>cxx . . $ `<file>/online-accounts-common/debug.h`/ |
| 22 | #include <online-accounts-common/globals.h>cxx . . $ `<file>/online-accounts-common/globals.h`/ |
| 23 | #include <online-accounts-common/i18n.h>cxx . . $ `<file>/online-accounts-common/i18n.h`/ |
| 24 | #include "ui-server.h"cxx . . $ `<file>/online-accounts-ui/src/ui-server.h`/ |
| 25 | |
| 26 | #include <QGuiApplication> |
| 27 | #include <QLibrary> |
| 28 | #include <QProcessEnvironment> |
| 29 | #include <QSettings> |
| 30 | #include <sys/apparmor.h> |
| 31 | |
| 32 | using namespace OnlineAccountsUi; |
| 33 | |
| 34 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) |
| 35 | { |
| 36 | QCoreApplicationcxx . . $ QCoreApplication#::setAttributecxx . . $ QCoreApplication#setAttribute(5f5acd6019f3e3ca).(Qtcxx . . $ Qt/::AA_ShareOpenGLContextscxx . . $ Qt/AA_ShareOpenGLContexts.); |
| 37 | QGuiApplicationcxx . . $ QGuiApplication# appcxx . . $ QGuiApplication#QGuiApplication(6e9b1c7df49e191d).(argc, argv); |
| 38 | |
| 39 | /* The testability driver is only loaded by QApplication but not by |
| 40 | * QGuiApplication. However, QApplication depends on QWidget which would |
| 41 | * add some unneeded overhead => Let's load the testability driver on our |
| 42 | * own. |
| 43 | */ |
| 44 | if (getenv("QT_LOAD_TESTABILITY")) { |
| 45 | QLibrarycxx . . $ QLibrary# testLibcxx . . $ QLibrary#QLibrary(6b24f83d17022bd9).(QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("qttestability")); |
| 46 | if (testLib.loadcxx . . $ QLibrary#load(c9857a73d68e59ba).()) { |
| 47 | typedef void (*TasInitializecxx . . $ main(afcd3168fc1188a4).TasInitialize#)(void); |
| 48 | TasInitializecxx . . $ main(afcd3168fc1188a4).TasInitialize# initFunction = |
| 49 | (TasInitializecxx . . $ main(afcd3168fc1188a4).TasInitialize#)testLib.resolvecxx . . $ QLibrary#resolve(3efb40c7f910a1d9).("qt_testability_init"); |
| 50 | if (initFunction) { |
| 51 | initFunction(); |
| 52 | } else { |
| 53 | qCriticalcxx . . $ `<external>/10450329605257866924/qlogging.h:167:9`!("Library qttestability resolve failed!"); |
| 54 | } |
| 55 | } else { |
| 56 | qCriticalcxx . . $ `<external>/10450329605257866924/qlogging.h:167:9`!("Library qttestability load failed!"); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(b05324713c9ab95e).("lomiri-online-accounts-service"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 61 | |
| 62 | /* read environment variables */ |
| 63 | QProcessEnvironmentcxx . . $ QProcessEnvironment# environment = QProcessEnvironmentcxx . . $ QProcessEnvironment#::systemEnvironmentcxx . . $ QProcessEnvironment#systemEnvironment(f0e8295e01d32d01).(); |
| 64 | if (environment.containscxx . . $ QProcessEnvironment#contains(f3b39adf77d9c36c).(QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).("OAU_LOGGING_LEVEL"))) { |
| 65 | bool isOk; |
| 66 | int value = environment.valuecxx . . $ QProcessEnvironment#value(11b1083083847b8e).( |
| 67 | QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).("OAU_LOGGING_LEVEL")).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&isOk); |
| 68 | if (isOk) |
| 69 | setLoggingLevelcxx . . $ setLoggingLevel(d4f767463ce0a6b3).(value); |
| 70 | } else { |
| 71 | setLoggingLevelcxx . . $ setLoggingLevel(d4f767463ce0a6b3).(settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("LoggingLevel"cxx . . $ QString#QString(85c52e162fed56f9)., 1cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).()); |
| 72 | } |
| 73 | |
| 74 | initTrcxx . . $ OnlineAccountsUi/initTr(2fa786934fe80e24).(LOA_I18N_DOMAINcxx . . $ `<built-in>:478:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 75 | |
| 76 | QStringcxx . . $ QString# socketcxx . . $ QString#QString(ced63f7c635d850d).; |
| 77 | QStringcxx . . $ QString# profilecxx . . $ QString#QString(ced63f7c635d850d).; |
| 78 | QStringListcxx . . $ QStringList# arguments = app.argumentscxx . . $ QCoreApplication#arguments(669a05bc42dd57cc).(); |
| 79 | for (int i = 0; i < arguments.countcxx . . $ QList#count(455f465bc33b4cdf).(); i++) { |
| 80 | const QStringcxx . . $ QString# &arg = arguments[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i]; |
| 81 | if (arg ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "--socket") { |
| 82 | socket =cxx . . $ QString#`operator=`(4f35bf974e7f8568). arguments.valuecxx . . $ QList#value(b4be2ec6940d8d62).(++i); |
| 83 | } else if (arg ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "--profile") { |
| 84 | profile =cxx . . $ QString#`operator=`(4f35bf974e7f8568). arguments.valuecxx . . $ QList#value(b4be2ec6940d8d62).(++i); |
| 85 | } |
| 86 | } |
| 87 | if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(socket.isEmpty())) { |
| 88 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Missing --socket argument"; |
| 89 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 90 | } |
| 91 | |
| 92 | if (!profile.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 93 | aa_change_profile(profile.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 94 | } |
| 95 | |
| 96 | UiServercxx . . $ OnlineAccountsUi/UiServer# servercxx . . $ OnlineAccountsUi/UiServer#UiServer(6b24f83d17022bd9).(socket); |
| 97 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(&server, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(finished()), |
| 98 | &app, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(quit())); |
| 99 | if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(!server.init())) { |
| 100 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Could not connect to socket"; |
| 101 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 102 | } |
| 103 | |
| 104 | return app.execcxx . . $ QGuiApplication#exec(b126dc7c1de90089).(); |
| 105 | } |