2011-04-06 13:48:02 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
#ifndef APPLICATION_H
|
|
|
|
#define APPLICATION_H
|
|
|
|
|
|
|
|
#include <QApplication>
|
2013-06-27 18:54:33 +04:00
|
|
|
#include <QPointer>
|
2013-07-31 00:22:43 +04:00
|
|
|
#include <QQueue>
|
2014-04-19 11:45:54 +04:00
|
|
|
#include <QTimer>
|
2015-09-28 23:51:16 +03:00
|
|
|
#include <QElapsedTimer>
|
2015-11-23 23:47:30 +03:00
|
|
|
#include <QNetworkConfigurationManager>
|
2011-02-17 02:21:45 +03:00
|
|
|
|
2012-07-30 18:10:48 +04:00
|
|
|
#include "qtsingleapplication.h"
|
|
|
|
|
2014-07-11 02:31:24 +04:00
|
|
|
#include "syncresult.h"
|
|
|
|
#include "logbrowser.h"
|
|
|
|
#include "owncloudgui.h"
|
|
|
|
#include "connectionvalidator.h"
|
|
|
|
#include "progressdispatcher.h"
|
|
|
|
#include "clientproxy.h"
|
|
|
|
#include "folderman.h"
|
2012-02-17 12:48:31 +04:00
|
|
|
|
2013-11-27 17:15:56 +04:00
|
|
|
class QMessageBox;
|
2011-02-17 02:21:45 +03:00
|
|
|
class QSystemTrayIcon;
|
2014-05-21 14:31:44 +04:00
|
|
|
class QSocket;
|
2011-02-17 02:21:45 +03:00
|
|
|
|
2015-03-12 18:49:47 +03:00
|
|
|
namespace CrashReporter {
|
|
|
|
class Handler;
|
|
|
|
}
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2017-05-09 15:24:11 +03:00
|
|
|
|
|
|
|
Q_DECLARE_LOGGING_CATEGORY(lcApplication)
|
|
|
|
|
2012-02-16 13:42:44 +04:00
|
|
|
class Theme;
|
2013-07-04 21:59:40 +04:00
|
|
|
class Folder;
|
2012-08-15 20:01:32 +04:00
|
|
|
class SslErrorDialog;
|
2011-02-17 02:21:45 +03:00
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The Application class
|
|
|
|
* @ingroup gui
|
2015-06-26 18:07:47 +03:00
|
|
|
*/
|
2012-07-30 18:10:48 +04:00
|
|
|
class Application : public SharedTools::QtSingleApplication
|
2011-02-17 02:21:45 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-04-20 15:17:48 +04:00
|
|
|
explicit Application(int &argc, char **argv);
|
2011-02-17 02:21:45 +03:00
|
|
|
~Application();
|
2012-06-15 15:36:38 +04:00
|
|
|
|
|
|
|
bool giveHelp();
|
2013-01-29 08:19:14 +04:00
|
|
|
void showHelp();
|
2015-07-03 17:01:24 +03:00
|
|
|
void showHint(std::string errorHint);
|
2014-08-26 17:46:24 +04:00
|
|
|
bool debugMode();
|
2018-11-02 15:57:10 +03:00
|
|
|
bool backgroundMode() const;
|
2015-07-16 19:12:45 +03:00
|
|
|
bool versionOnly(); // only display the version?
|
|
|
|
void showVersion();
|
2012-06-15 15:36:38 +04:00
|
|
|
|
2020-06-16 19:59:16 +03:00
|
|
|
void showMainDialog();
|
2015-01-26 15:00:45 +03:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
public slots:
|
|
|
|
// TODO: this should not be public
|
2012-11-28 22:25:12 +04:00
|
|
|
void slotownCloudWizardDone(int);
|
2017-09-20 12:48:13 +03:00
|
|
|
void slotCrash();
|
2011-02-17 02:21:45 +03:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
protected:
|
2012-10-16 21:05:28 +04:00
|
|
|
void parseOptions(const QStringList &);
|
2013-02-14 21:27:44 +04:00
|
|
|
void setupTranslations();
|
2013-10-02 17:28:33 +04:00
|
|
|
void setupLogging();
|
2011-02-17 02:21:45 +03:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
signals:
|
|
|
|
void folderRemoved();
|
|
|
|
void folderStateChanged(Folder *);
|
2019-12-21 05:04:31 +03:00
|
|
|
void isShowingSettingsDialog();
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2011-09-26 17:00:12 +04:00
|
|
|
protected slots:
|
2015-02-19 18:54:34 +03:00
|
|
|
void slotParseMessage(const QString &, QObject *);
|
2013-07-05 15:14:48 +04:00
|
|
|
void slotCheckConnection();
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotUseMonoIconsChanged(bool);
|
2013-09-18 16:11:19 +04:00
|
|
|
void slotCleanup();
|
2014-12-17 16:09:57 +03:00
|
|
|
void slotAccountStateAdded(AccountState *accountState);
|
|
|
|
void slotAccountStateRemoved(AccountState *accountState);
|
2015-11-23 23:47:30 +03:00
|
|
|
void slotSystemOnlineConfigurationChanged(QNetworkConfiguration);
|
2019-12-21 05:04:31 +03:00
|
|
|
void slotGuiIsShowingSettings();
|
2013-11-23 03:14:02 +04:00
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
private:
|
2013-01-29 08:19:14 +04:00
|
|
|
void setHelp();
|
2012-06-15 15:36:38 +04:00
|
|
|
|
2013-10-01 15:52:07 +04:00
|
|
|
QPointer<ownCloudGui> _gui;
|
2011-04-04 14:23:30 +04:00
|
|
|
|
2012-02-16 13:42:44 +04:00
|
|
|
Theme *_theme;
|
2013-08-02 13:33:45 +04:00
|
|
|
|
2013-10-02 17:28:33 +04:00
|
|
|
bool _helpOnly;
|
2015-07-16 19:12:45 +03:00
|
|
|
bool _versionOnly;
|
2013-07-31 00:22:43 +04:00
|
|
|
|
2015-09-28 23:51:16 +03:00
|
|
|
QElapsedTimer _startedAt;
|
|
|
|
|
2013-10-02 17:28:33 +04:00
|
|
|
// options from command line:
|
2012-10-16 21:05:28 +04:00
|
|
|
bool _showLogWindow;
|
2013-10-02 17:28:33 +04:00
|
|
|
QString _logFile;
|
|
|
|
QString _logDir;
|
|
|
|
int _logExpire;
|
|
|
|
bool _logFlush;
|
2017-05-09 18:04:04 +03:00
|
|
|
bool _logDebug;
|
2013-11-27 17:15:56 +04:00
|
|
|
bool _userTriggeredConnect;
|
2014-08-26 17:46:24 +04:00
|
|
|
bool _debugMode;
|
2018-11-02 15:57:10 +03:00
|
|
|
bool _backgroundMode;
|
2013-10-02 17:28:33 +04:00
|
|
|
|
2014-01-16 15:07:58 +04:00
|
|
|
ClientProxy _proxy;
|
|
|
|
|
2015-11-23 23:47:30 +03:00
|
|
|
QNetworkConfigurationManager _networkConfigurationManager;
|
2014-04-19 11:45:54 +04:00
|
|
|
QTimer _checkConnectionTimer;
|
|
|
|
|
2015-03-12 18:49:47 +03:00
|
|
|
#if defined(WITH_CRASHREPORTER)
|
|
|
|
QScopedPointer<CrashReporter::Handler> _crashHandler;
|
|
|
|
#endif
|
2015-01-08 18:52:23 +03:00
|
|
|
QScopedPointer<FolderMan> _folderManager;
|
2011-02-17 02:21:45 +03:00
|
|
|
};
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
} // namespace OCC
|
2011-02-17 02:21:45 +03:00
|
|
|
|
|
|
|
#endif // APPLICATION_H
|