From ed5750c200b642c9710e03248c46993830e6fab5 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 3 Aug 2026 10:56:34 +0200 Subject: Add GPLv2-only license and per-file headers Confirmed with the maintainer as v2-only rather than v2-or-later. LICENSE is the official text from gnu.org. Every file under src/ and tests/ carries the matching notice. Co-Authored-By: Claude Opus 5 --- src/main.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 2c5dc13..4d3ed0a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,14 +1,63 @@ +/* + * qtmaildir - a Qt6 mail client for notmuch-indexed Maildirs + * Copyright (C) 2026 Danilo M. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include #include #include #include +#include +#include + #include "config.h" #include "mainwindow.h" +#include "version.h" int main(int argc, char *argv[]) { + // Answered before anything heavier starts: registering web engine schemes + // and constructing a QApplication to print one line would be absurd, and + // --version has to work on a machine where the GUI cannot open at all. + for (int i = 1; i < argc; ++i) { + if (std::strcmp(argv[i], "--version") == 0 + || std::strcmp(argv[i], "-v") == 0) { + std::printf("qtmaildir %s\n", QTMAILDIR_VERSION); + return 0; + } + if (std::strcmp(argv[i], "--help") == 0 + || std::strcmp(argv[i], "-h") == 0) { + std::printf( + "qtmaildir %s - a Qt6 mail client for notmuch-indexed Maildirs\n" + "\n" + "Usage: qtmaildir [options]\n" + "\n" + " -h, --help Show this help and exit\n" + " -v, --version Show the version and exit\n" + "\n" + "Configuration: ~/.config/qtmaildir/qtmaildir.conf\n" + "qtmaildir reads a notmuch-indexed Maildir. It does no network\n" + "protocol work: fetching and sending are external commands.\n", + QTMAILDIR_VERSION); + return 0; + } + } + // Custom schemes must be registered before QApplication is constructed. { QWebEngineUrlScheme scheme(QByteArrayLiteral("cid")); @@ -25,6 +74,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); app.setApplicationName(QStringLiteral("qtmaildir")); app.setOrganizationName(QStringLiteral("qtmaildir")); + app.setApplicationVersion(QStringLiteral(QTMAILDIR_VERSION)); // Fail loudly on an ABI mismatch rather than crashing later. if (LIBNOTMUCH_MAJOR_VERSION < 5) { -- cgit v1.2.3