Changeset View
Changeset View
Standalone View
Standalone View
kcms/colors/editor/kcolorschemeeditor.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 30 | { | |||
---|---|---|---|---|---|
44 | aboutData.addAuthor(i18n("Matthew Woehlke"), i18n("KCM code (reused in here)"), | 44 | aboutData.addAuthor(i18n("Matthew Woehlke"), i18n("KCM code (reused in here)"), | ||
45 | QStringLiteral("mw_triad@users.sourceforge.net")); | 45 | QStringLiteral("mw_triad@users.sourceforge.net")); | ||
46 | KAboutData::setApplicationData(aboutData); | 46 | KAboutData::setApplicationData(aboutData); | ||
47 | 47 | | |||
48 | QCommandLineParser parser; | 48 | QCommandLineParser parser; | ||
49 | parser.addPositionalArgument("theme", i18n("Scheme to edit or to use as a base."), | 49 | parser.addPositionalArgument("theme", i18n("Scheme to edit or to use as a base."), | ||
50 | QStringLiteral("kcolorschemeeditor ThemeName")); | 50 | QStringLiteral("kcolorschemeeditor ThemeName")); | ||
51 | 51 | | |||
52 | QCommandLineOption overwriteOption(QStringLiteral("overwrite"), i18n("Overwrite edited theme when saving")); | 52 | QCommandLineOption overwriteOption(QStringLiteral("overwrite"), i18n("Show 'Apply' button that saves changes without asking (unlike 'Save As' button)")); | ||
53 | parser.addOption(overwriteOption); | 53 | parser.addOption(overwriteOption); | ||
54 | 54 | | |||
55 | QCommandLineOption attachOption(QStringLiteral("attach"), i18n("Makes the dialog transient for another application window specified by handle"), QStringLiteral("handle")); | 55 | QCommandLineOption attachOption(QStringLiteral("attach"), i18n("Makes the dialog transient for another application window specified by handle"), QStringLiteral("handle")); | ||
56 | parser.addOption(attachOption); | 56 | parser.addOption(attachOption); | ||
57 | 57 | | |||
58 | aboutData.setupCommandLine(&parser); | 58 | aboutData.setupCommandLine(&parser); | ||
59 | parser.process(app); | 59 | parser.process(app); | ||
60 | aboutData.processCommandLine(&parser); | 60 | aboutData.processCommandLine(&parser); | ||
61 | 61 | | |||
62 | const QStringList args = parser.positionalArguments(); | 62 | const QStringList args = parser.positionalArguments(); | ||
63 | QString path = ""; | 63 | QString path = ""; | ||
64 | if (args.count() == 1) | 64 | if (args.count() == 1) | ||
65 | { | 65 | { | ||
66 | const QString fileBaseName(args.at(0)); | 66 | const QString fileBaseName(args.at(0)); | ||
67 | path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, | 67 | path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, | ||
68 | "color-schemes/" + fileBaseName + ".colors"); | 68 | "color-schemes/" + fileBaseName + ".colors"); | ||
69 | } | 69 | } | ||
70 | if (path.isEmpty()) | 70 | if (path.isEmpty()) | ||
71 | { | 71 | { | ||
72 | QTextStream out(stderr); | 72 | QTextStream out(stderr); | ||
73 | out << i18n("Scheme not found, falling back to current one.\n"); | 73 | out << i18n("Scheme not found, falling back to current one.\n"); | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | SchemeEditorDialog dialog(path); | 76 | SchemeEditorDialog dialog(path); | ||
77 | dialog.setOverwriteOnSave(parser.isSet(overwriteOption)); | 77 | dialog.setShowApplyOverwriteButton(parser.isSet(overwriteOption)); | ||
78 | 78 | | |||
79 | // FIXME doesn't work :( | 79 | // FIXME doesn't work :( | ||
80 | const QString attachHandle = parser.value(attachOption); | 80 | const QString attachHandle = parser.value(attachOption); | ||
81 | if (!attachHandle.isEmpty()) { | 81 | if (!attachHandle.isEmpty()) { | ||
82 | // TODO wayland: once we have foreign surface support | 82 | // TODO wayland: once we have foreign surface support | ||
83 | const QString x11Prefix = QStringLiteral("x11:"); | 83 | const QString x11Prefix = QStringLiteral("x11:"); | ||
84 | 84 | | |||
85 | if (attachHandle.startsWith(x11Prefix)) { | 85 | if (attachHandle.startsWith(x11Prefix)) { | ||
Show All 13 Lines |