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