diff --git a/src/main.cpp b/src/main.cpp index e4bd280f7..6b3b3b360 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,8 @@ int main(int argc, char **argv) Mirall::Application app(argc, argv); - return app.exec(); + if( ! app.giveHelp() ) + return app.exec(); + } diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index cb839f854..a376ec2f5 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -13,6 +13,7 @@ */ #define LOG_TO_CALLBACK // FIXME: This should be in csync. +#include #include "mirall/application.h" #include "mirall/folder.h" @@ -70,7 +71,8 @@ Application::Application(int &argc, char **argv) : #endif _contextMenu(0), _ocInfo(0), - _updateDetector(0) + _updateDetector(0), + _helpOnly(false) { #ifdef OWNCLOUD_CLIENT @@ -81,9 +83,11 @@ Application::Application(int &argc, char **argv) : setApplicationName( _theme->appName() ); setWindowIcon( _theme->applicationIcon() ); - processEvents(); - + if( arguments().contains("--help")) { + showHelp(); + } setupLogBrowser(); + processEvents(); QTranslator *qtTranslator = new QTranslator; qtTranslator->load("qt_" + QLocale::system().name(), @@ -717,5 +721,23 @@ void Application::computeOverallSyncStatus() _tray->setToolTip(trayMessage); } +void Application::showHelp() +{ + std::cout << _theme->appName().toLatin1().constData() << " version " << + _theme->version().toLatin1().constData() << std::endl << std::endl; + std::cout << "File synchronisation desktop utility." << std::endl << std::endl; + std::cout << "Options:" << std::endl; + std::cout << " --logwindow : open a window to show log output." << std::endl; + std::cout << " --logfile : write log output to file ." << std::endl; + std::cout << " --flushlog : flush the log file after every write." << std::endl; + std::cout << std::endl; + std::cout << "For more information, see http://www.owncloud.org" << std::endl; + _helpOnly = true; +} + +bool Application::giveHelp() +{ + return _helpOnly; +} } // namespace Mirall diff --git a/src/mirall/application.h b/src/mirall/application.h index 1305b72d4..e66ee020c 100644 --- a/src/mirall/application.h +++ b/src/mirall/application.h @@ -46,6 +46,9 @@ class Application : public QApplication public: explicit Application(int &argc, char **argv); ~Application(); + + bool giveHelp(); + signals: protected slots: @@ -81,6 +84,8 @@ protected slots: void slotStartUpdateDetector(); private: + void showHelp(); + // configuration file -> folder QSystemTrayIcon *_tray; QAction *_actionQuit; @@ -107,6 +112,7 @@ private: UpdateDetector *_updateDetector; QMap _overallStatusStrings; LogBrowser *_logBrowser; + bool _helpOnly; }; } // namespace Mirall diff --git a/src/mirall/updatedetector.cpp b/src/mirall/updatedetector.cpp index ed72fd784..fb3610fa8 100644 --- a/src/mirall/updatedetector.cpp +++ b/src/mirall/updatedetector.cpp @@ -48,6 +48,7 @@ void UpdateDetector::versionCheck( Theme *theme ) #ifdef Q_OS_MAC platform = QLatin1String( "macos" ); #endif + qDebug() << "00 client update check to " << url.toString(); QString sysInfo = getSystemInfo(); if( !sysInfo.isEmpty() ) { @@ -56,8 +57,6 @@ void UpdateDetector::versionCheck( Theme *theme ) url.addQueryItem( "version", ver ); url.addQueryItem( "platform", platform ); - qDebug() << "00 client update check to " << url.toString(); - _accessManager->get( QNetworkRequest( url )); }