17#include <QApplication>
30 Q_ASSERT(start >= 0 && start <= args.size());
31 return args.mid(start).join(
" ");
44 const QString &suffix) ->
void {
45 if (!suffix.isEmpty()) {
46 if (!target.isEmpty())
59auto main(
int argc,
char *argv[]) ->
int {
65 QString name = qgetenv(
"USER");
67 name = qgetenv(
"USERNAME");
70 QApplication app(argc, argv);
73 const QStringList args = app.arguments();
74 bool consumeNextArg =
false;
75 for (
int i = 1; i < args.count(); ++i) {
76 const auto &arg = args.at(i);
79 consumeNextArg =
false;
85 consumeNextArg =
false;
89 if (arg.startsWith(
'-')) {
94 const bool optionTakesSeparateValue =
95 !arg.contains(
'=') && i + 1 < args.count() && arg.startsWith(
"--") &&
96 !arg.startsWith(
"---") && !args[i + 1].startsWith(
'-');
97 if (optionTakesSeparateValue)
98 consumeNextArg =
true;
107 if ((text.indexOf(
"-psn_") == 0) || (text.indexOf(
"-session") == 0)) {
121 Q_INIT_RESOURCE(resources);
122 Q_INIT_RESOURCE(qmake_qmake_qm_files);
124 QCoreApplication::setOrganizationName(
"IJHack");
125 QCoreApplication::setOrganizationDomain(
"ijhack.org");
126 QCoreApplication::setApplicationName(
"QtPass");
127 QCoreApplication::setApplicationVersion(VERSION);
141 QTranslator translator;
142 if (translator.load(QLocale::system(), QStringLiteral(
"localization"),
143 QStringLiteral(
"_"), QStringLiteral(
":/localization"),
144 QStringLiteral(
".qm"))) {
146 SingleApplication::installTranslator(&translator);
147 SingleApplication::setLayoutDirection(
148 QObject::tr(
"LTR") ==
"RTL" ? Qt::RightToLeft : Qt::LeftToRight);
150 QApplication::installTranslator(&translator);
151 QApplication::setLayoutDirection(
152 QObject::tr(
"LTR") ==
"RTL" ? Qt::RightToLeft : Qt::LeftToRight);
160 QGuiApplication::setDesktopFileName(
161 qEnvironmentVariable(
"FLATPAK_ID", QStringLiteral(
"qtpass")));
162 QApplication::setWindowIcon(QIcon(
":artwork/icon.png"));
187 return SingleApplication::exec();
189 return QApplication::exec();
Main application window orchestrating UI, user interactions, and external process handlers.
void messageAvailable(const QString &message)
Handle an incoming inter-process message (single-instance mode).
auto initSucceeded() const -> bool
Return whether startup configuration succeeded.
static auto load() -> AppSettings
Load all flat settings into an AppSettings value object.
QApplication subclass enforcing single-instance behavior via IPC.
auto isRunning() -> bool
Query whether another instance is already running.
void messageAvailable(const QString &message)
messageAvailable notification from commandline
auto sendMessage(const QString &message) -> bool
Send a message to the running instance.
static void initialise(const QString &override={})
Ensure SSH_AUTH_SOCK is set for child processes.
static void applyPassProcessDefaults()
Set up the process the way pass sets up its own, before anything runs git or gpg or writes into the s...
auto main(int argc, char *argv[]) -> int
Application entry point: parses arguments and launches the main window.
static auto joinRemainingArgs(const QStringList &args, int start) -> QString
Joins all arguments from index start onward into a space-separated string.
static auto appendWithSpaceIfSuffixNotEmpty(QString &target, const QString &suffix) -> void
Appends a suffix to a target string, inserting a separating space if the target is not empty.
MainWindow: the main application window (tree, toolbar, search, status bar, process output dock) and ...
QtPassSettings, the QSettings singleton behind every saved setting, the profiles and the Pass backend...
SingleApplication: a QApplication that keeps one QtPass instance per user via a shared-memory segment...
SshAuthSock: finding an SSH agent socket for child processes and judging a configured override.
Util: static helpers for the process environment, binary discovery, store paths, URL safety and the l...