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");
71 QApplication app(argc, argv);
74 const QStringList args = app.arguments();
75 bool consumeNextArg =
false;
76 for (
int i = 1; i < args.count(); ++i) {
77 const auto &arg = args.at(i);
80 consumeNextArg =
false;
86 consumeNextArg =
false;
90 if (arg.startsWith(
'-')) {
95 const bool optionTakesSeparateValue =
96 !arg.contains(
'=') && i + 1 < args.count() && arg.startsWith(
"--") &&
97 !arg.startsWith(
"---") && !args[i + 1].startsWith(
'-');
98 if (optionTakesSeparateValue)
99 consumeNextArg =
true;
108 if ((text.indexOf(
"-psn_") == 0) || (text.indexOf(
"-session") == 0)) {
122 Q_INIT_RESOURCE(resources);
123 Q_INIT_RESOURCE(qmake_qmake_qm_files);
125 QCoreApplication::setOrganizationName(
"IJHack");
126 QCoreApplication::setOrganizationDomain(
"ijhack.org");
127 QCoreApplication::setApplicationName(
"QtPass");
128 QCoreApplication::setApplicationVersion(VERSION);
142 QTranslator translator;
143 if (translator.load(QLocale::system(), QStringLiteral(
"localization"),
144 QStringLiteral(
"_"), QStringLiteral(
":/localization"),
145 QStringLiteral(
".qm"))) {
147 SingleApplication::installTranslator(&translator);
148 SingleApplication::setLayoutDirection(
149 QObject::tr(
"LTR") ==
"RTL" ? Qt::RightToLeft : Qt::LeftToRight);
151 QApplication::installTranslator(&translator);
152 QApplication::setLayoutDirection(
153 QObject::tr(
"LTR") ==
"RTL" ? Qt::RightToLeft : Qt::LeftToRight);
161 QGuiApplication::setDesktopFileName(
162 qEnvironmentVariable(
"FLATPAK_ID", QStringLiteral(
"qtpass")));
163 QApplication::setWindowIcon(QIcon(
":artwork/icon.png"));
188 return SingleApplication::exec();
190 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. Detects whether another instance wi...
auto isRunning() -> bool
Query whether another instance is already running.
static auto privateKey(const QString &base) -> QString
The key to construct with: a socket path in a folder only this user can write to (see privateKeyIn())...
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 lock file and forward...
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...