nextcloud-desktop/src/mirall/application.h

139 lines
3.7 KiB
C
Raw Normal View History

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>
2011-09-26 17:00:12 +04:00
#include <QSystemTrayIcon>
#include <QNetworkReply>
#include <QSslError>
2011-02-17 02:21:45 +03:00
#include "qtsingleapplication.h"
2011-04-08 13:36:53 +04:00
#include "mirall/syncresult.h"
#include "mirall/folder.h"
#include "mirall/logbrowser.h"
#include "mirall/folderman.h"
2011-02-17 02:21:45 +03:00
class QAction;
2011-04-06 12:56:20 +04:00
class QMenu;
2011-02-17 02:21:45 +03:00
class QSystemTrayIcon;
class QNetworkConfigurationManager;
class QSignalMapper;
class QNetworkReply;
2011-02-17 02:21:45 +03:00
namespace Mirall {
class Theme;
class FolderWatcher;
class FolderWizard;
2011-09-26 17:00:12 +04:00
class StatusDialog;
class OwncloudSetupWizard;
class ownCloudInfo;
class SslErrorDialog;
class UpdateDetector;
2011-02-17 02:21:45 +03: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();
2011-02-17 02:21:45 +03:00
signals:
protected slots:
void slotAddFolder();
void slotOpenStatus();
2011-10-13 15:55:52 +04:00
void slotRemoveFolder( const QString& );
void slotEnableFolder( const QString&, const bool );
void slotInfoFolder( const QString& );
2011-10-14 18:39:53 +04:00
void slotConfigure();
void slotConfigureProxy();
void slotParseOptions( const QString& );
void slotShowTrayMessage(const QString&, const QString&);
2011-02-17 02:21:45 +03:00
void slotSyncStateChange( const QString& );
2012-11-28 22:25:12 +04:00
void slotownCloudWizardDone(int);
2011-02-17 02:21:45 +03:00
protected:
void parseOptions(const QStringList& );
2011-02-17 02:21:45 +03:00
void setupActions();
void setupSystemTray();
void setupContextMenu();
void setupLogBrowser();
void setupProxy();
2011-02-17 02:21:45 +03:00
//folders have to be disabled while making config changes
void computeOverallSyncStatus();
2011-09-26 17:00:12 +04:00
protected slots:
void slotTrayClicked( QSystemTrayIcon::ActivationReason );
void slotFolderOpenAction(const QString & );
void slotOpenOwnCloud();
void slotStartFolderSetup(int result = QDialog::Accepted); // defaulting to Accepted
void slotOwnCloudFound( const QString&, const QString&, const QString&, const QString& );
void slotNoOwnCloudFound( QNetworkReply* );
void slotCheckAuthentication();
void slotAuthCheck( const QString& ,QNetworkReply* );
void slotOpenLogBrowser();
2012-09-17 23:06:20 +04:00
void slotAbout();
void slotSSLFailed( QNetworkReply *reply, QList<QSslError> errors );
void slotFetchCredentials();
void slotCredentialsFetched( bool );
void slotStartUpdateDetector();
2011-02-17 02:21:45 +03:00
private:
2012-06-15 15:36:38 +04:00
void showHelp();
// configuration file -> folder
2011-02-17 02:21:45 +03:00
QSystemTrayIcon *_tray;
QAction *_actionQuit;
QAction *_actionAddFolder;
QAction *_actionOpenStatus;
2011-10-14 18:39:53 +04:00
QAction *_actionConfigure;
QAction *_actionOpenoC;
QAction *_actionConfigureProxy;
2012-09-17 23:06:20 +04:00
QAction *_actionAbout;
2011-10-14 18:39:53 +04:00
#if QT_VERSION >= 0x040700
QNetworkConfigurationManager *_networkMgr;
#endif
2011-04-04 14:23:30 +04:00
FolderWizard *_folderWizard;
OwncloudSetupWizard *_owncloudSetupWizard;
SslErrorDialog *_sslErrorDialog;
2011-04-06 12:56:20 +04:00
// tray's menu
QMenu *_contextMenu;
2011-09-26 17:00:12 +04:00
StatusDialog *_statusDialog;
FolderMan *_folderMan;
Theme *_theme;
QSignalMapper *_folderOpenActionMapper;
UpdateDetector *_updateDetector;
QMap<QString, QString> _overallStatusStrings;
LogBrowser *_logBrowser;
QString _logFile;
bool _showLogWindow;
bool _logFlush;
bool _helpOnly;
2011-02-17 02:21:45 +03:00
};
} // namespace Mirall
#endif // APPLICATION_H