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>
|
2011-02-17 02:21:45 +03:00
|
|
|
|
2012-07-30 18:10:48 +04:00
|
|
|
#include "qtsingleapplication.h"
|
|
|
|
|
2011-04-08 13:36:53 +04:00
|
|
|
#include "mirall/syncresult.h"
|
2012-06-05 17:11:29 +04:00
|
|
|
#include "mirall/logbrowser.h"
|
2013-10-01 15:52:07 +04:00
|
|
|
#include "mirall/owncloudgui.h"
|
2013-07-05 15:14:48 +04:00
|
|
|
#include "mirall/connectionvalidator.h"
|
2013-07-26 15:44:38 +04:00
|
|
|
#include "mirall/progressdispatcher.h"
|
2014-01-16 15:07:58 +04:00
|
|
|
#include "mirall/clientproxy.h"
|
2014-05-26 16:34:08 +04:00
|
|
|
#include "mirall/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
|
|
|
|
|
|
|
namespace Mirall {
|
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;
|
2013-10-03 19:04:55 +04:00
|
|
|
class SocketApi;
|
2011-02-17 02:21:45 +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();
|
2012-06-15 15:36:38 +04: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);
|
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();
|
2013-06-03 18:23:29 +04:00
|
|
|
void enterNextLogFile();
|
2013-08-05 14:19:53 +04:00
|
|
|
bool checkConfigExists(bool openSettings);
|
2011-02-17 02:21:45 +03:00
|
|
|
|
2013-06-05 18:14:20 +04:00
|
|
|
// reimplemented
|
2014-01-28 18:30:58 +04:00
|
|
|
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
2013-06-05 18:14:20 +04:00
|
|
|
bool winEventFilter( MSG * message, long * result );
|
|
|
|
#endif
|
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
signals:
|
|
|
|
void folderRemoved();
|
|
|
|
void folderStateChanged(Folder*);
|
|
|
|
|
2011-09-26 17:00:12 +04:00
|
|
|
protected slots:
|
2014-05-21 14:31:44 +04:00
|
|
|
void slotParseOptions( const QString&, QObject* );
|
2013-07-05 15:14:48 +04:00
|
|
|
void slotCheckConnection();
|
|
|
|
void slotConnectionValidatorResult(ConnectionValidator::Status);
|
2012-04-02 22:10:29 +04:00
|
|
|
void slotStartUpdateDetector();
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotUseMonoIconsChanged( bool );
|
2013-11-23 03:14:02 +04:00
|
|
|
void slotLogin();
|
|
|
|
void slotLogout();
|
2013-09-18 16:11:19 +04:00
|
|
|
void slotCleanup();
|
2014-02-20 20:00:45 +04:00
|
|
|
void slotAccountChanged(Account *newAccount, Account *oldAccount = 0);
|
2014-01-28 14:06:40 +04:00
|
|
|
void slotCredentialsFetched();
|
2014-02-20 20:00:45 +04:00
|
|
|
void slotToggleFolderman(int state);
|
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;
|
2013-10-03 19:04:55 +04:00
|
|
|
QPointer<SocketApi> _socketApi;
|
2011-04-04 14:23:30 +04:00
|
|
|
|
2014-01-28 14:06:40 +04:00
|
|
|
QPointer<ConnectionValidator> _conValidator;
|
2011-04-06 12:56:20 +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;
|
2013-10-11 13:43:23 +04:00
|
|
|
bool _startupNetworkError;
|
2013-07-31 00:22:43 +04:00
|
|
|
|
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;
|
2013-11-27 17:15:56 +04:00
|
|
|
bool _userTriggeredConnect;
|
2013-10-02 17:28:33 +04:00
|
|
|
|
2014-01-16 15:07:58 +04:00
|
|
|
ClientProxy _proxy;
|
|
|
|
|
2014-04-19 11:45:54 +04:00
|
|
|
QTimer _checkConnectionTimer;
|
|
|
|
|
2014-05-26 16:34:08 +04:00
|
|
|
FolderMan folderManager;
|
|
|
|
|
2013-10-15 19:00:53 +04:00
|
|
|
friend class ownCloudGui; // for _startupNetworkError
|
2011-02-17 02:21:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Mirall
|
|
|
|
|
|
|
|
#endif // APPLICATION_H
|