| 33 | #include <QTextStream> |
| 34 | |
| 35 | void initialiseCmdLineArgs(QCommandLineParser* cmdLineParser) |
| 36 | { |
| 37 | const QString configFileName = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, "kdiff3rc"); |
| 38 | QFile configFile(configFileName); |
| 39 | QString ignorableOptionsLine = "-u;-query;-html;-abort"; |
| 40 | if(configFile.open(QIODevice::ReadOnly)) |
| 41 | { |
| 42 | QTextStream ts(&configFile); |
| 43 | while(!ts.atEnd()) |
| 44 | { |
| 45 | const QString line = ts.readLine(); |
| 46 | if(line.startsWith(u8"IgnorableCmdLineOptions=")) |
| 47 | { |
| 48 | const qsizetype pos = line.indexOf('='); |
| 49 | if(pos >= 0) |
| 50 | { |
| 51 | ignorableOptionsLine = line.mid(pos + 1); |
| 52 | } |
| 53 | break; |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | const QStringList ignorableOptions = ignorableOptionsLine.split(';'); |
| 59 | |
| 60 | for(QString ignorableOption: ignorableOptions) |
| 61 | { |
| 62 | ignorableOption.remove('-'); |
| 63 | if(!ignorableOption.isEmpty()) |
| 64 | { |
| 65 | if(ignorableOption.length() == 1) |
| 66 | { |
| 67 | cmdLineParser->addOption(QCommandLineOption({ignorableOption, u8"ignore"}, i18n("Ignored. (User defined.)"))); |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | cmdLineParser->addOption(QCommandLineOption(ignorableOption, i18n("Ignored. (User defined.)"))); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | qint32 main(qint32 argc, char* argv[]) |
| 78 | { |