Changeset View
Changeset View
Standalone View
Standalone View
kioclient/kioclient.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | #include <QDBusConnection> | 35 | #include <QDBusConnection> | ||
36 | #include <QCommandLineParser> | 36 | #include <QCommandLineParser> | ||
37 | #include <QFileDialog> | 37 | #include <QFileDialog> | ||
38 | #include <QDebug> | 38 | #include <QDebug> | ||
39 | #include <iostream> | 39 | #include <iostream> | ||
40 | 40 | | |||
41 | bool ClientApp::m_ok = true; | 41 | bool ClientApp::m_ok = true; | ||
42 | static bool s_interactive = true; | 42 | static bool s_interactive = false; | ||
43 | static KIO::JobFlags s_jobFlags = KIO::DefaultFlags; | 43 | static KIO::JobFlags s_jobFlags = KIO::DefaultFlags; | ||
44 | 44 | | |||
45 | static QUrl makeURL(const QString &urlArg) | 45 | static QUrl makeURL(const QString &urlArg) | ||
46 | { | 46 | { | ||
47 | return QUrl::fromUserInput(urlArg, QDir::currentPath()); | 47 | return QUrl::fromUserInput(urlArg, QDir::currentPath()); | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | static QList<QUrl> makeUrls(const QStringList& urlArgs) | 50 | static QList<QUrl> makeUrls(const QStringList& urlArgs) | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 116 | #endif | |||
121 | QString programName = i18n("KIO Client"); | 121 | QString programName = i18n("KIO Client"); | ||
122 | QString description = i18n("Command-line tool for network-transparent operations"); | 122 | QString description = i18n("Command-line tool for network-transparent operations"); | ||
123 | QString version = QLatin1String(PROJECT_VERSION); | 123 | QString version = QLatin1String(PROJECT_VERSION); | ||
124 | KAboutData data(appName, programName, version, description, KAboutLicense::LGPL_V2); | 124 | KAboutData data(appName, programName, version, description, KAboutLicense::LGPL_V2); | ||
125 | KAboutData::setApplicationData(data); | 125 | KAboutData::setApplicationData(data); | ||
126 | 126 | | |||
127 | QCommandLineParser parser; | 127 | QCommandLineParser parser; | ||
128 | data.setupCommandLine(&parser); | 128 | data.setupCommandLine(&parser); | ||
129 | parser.addOption(QCommandLineOption(QStringLiteral("interactive"), i18n("Use message boxes and other native notifications"))); | ||||
130 | | ||||
129 | parser.addOption(QCommandLineOption(QStringLiteral("noninteractive"), i18n("Non-interactive use: no message boxes. If you don't want a " | 131 | parser.addOption(QCommandLineOption(QStringLiteral("noninteractive"), i18n("Non-interactive use: no message boxes. If you don't want a " | ||
130 | "graphical connection, use --platform offscreen"))); | 132 | "graphical connection, use --platform offscreen"))); | ||
131 | 133 | | |||
132 | #if !defined(KIOCLIENT_AS_KDEOPEN) | 134 | #if !defined(KIOCLIENT_AS_KDEOPEN) | ||
133 | parser.addOption(QCommandLineOption(QStringLiteral("overwrite"), i18n("Overwrite destination if it exists (for copy and move)"))); | 135 | parser.addOption(QCommandLineOption(QStringLiteral("overwrite"), i18n("Overwrite destination if it exists (for copy and move)"))); | ||
134 | #endif | 136 | #endif | ||
135 | 137 | | |||
136 | #if defined(KIOCLIENT_AS_KDEOPEN) | 138 | #if defined(KIOCLIENT_AS_KDEOPEN) | ||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | 266 | { | |||
272 | return m_ok; | 274 | return m_ok; | ||
273 | } | 275 | } | ||
274 | 276 | | |||
275 | bool ClientApp::doIt(const QCommandLineParser& parser) | 277 | bool ClientApp::doIt(const QCommandLineParser& parser) | ||
276 | { | 278 | { | ||
277 | const int argc = parser.positionalArguments().count(); | 279 | const int argc = parser.positionalArguments().count(); | ||
278 | checkArgumentCount(argc, 1, 0); | 280 | checkArgumentCount(argc, 1, 0); | ||
279 | 281 | | |||
280 | if ( !parser.isSet( QStringLiteral("noninteractive") ) ) { | 282 | if (parser.isSet(QStringLiteral("interactive"))) { | ||
283 | s_interactive = true; | ||||
284 | } else { | ||||
285 | // "noninteractive" is currently the default mode, so we don't check. | ||||
286 | // The argument still needs to exist for compatibility | ||||
dfaure: Why would we want to break compatibility yet again? ;-) | |||||
281 | s_interactive = false; | 287 | s_interactive = false; | ||
282 | s_jobFlags = KIO::HideProgressInfo; | 288 | s_jobFlags = KIO::HideProgressInfo; | ||
283 | } | 289 | } | ||
284 | #if !defined(KIOCLIENT_AS_KDEOPEN) | 290 | #if !defined(KIOCLIENT_AS_KDEOPEN) | ||
285 | if (parser.isSet(QStringLiteral("overwrite"))) { | 291 | if (parser.isSet(QStringLiteral("overwrite"))) { | ||
286 | s_jobFlags |= KIO::Overwrite; | 292 | s_jobFlags |= KIO::Overwrite; | ||
287 | } | 293 | } | ||
288 | #endif | 294 | #endif | ||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |
Why would we want to break compatibility yet again? ;-)