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>
|
2012-03-29 11:41:30 +04:00
|
|
|
#include <QNetworkReply>
|
2012-08-15 20:01:32 +04:00
|
|
|
#include <QSslError>
|
2013-06-27 18:54:33 +04:00
|
|
|
#include <QPointer>
|
2013-07-31 00:22:43 +04:00
|
|
|
#include <QQueue>
|
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-03-20 13:03:49 +04:00
|
|
|
#include "mirall/systray.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"
|
2012-02-17 12:48:31 +04:00
|
|
|
|
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;
|
2013-07-04 21:59:40 +04:00
|
|
|
class Folder;
|
2011-09-30 13:49:19 +04:00
|
|
|
class FolderWatcher;
|
2013-06-11 20:33:39 +04:00
|
|
|
class FolderWizard;
|
2012-03-29 11:41:30 +04:00
|
|
|
class ownCloudInfo;
|
2012-08-15 20:01:32 +04:00
|
|
|
class SslErrorDialog;
|
2013-07-04 21:59:40 +04:00
|
|
|
class SettingsDialog;
|
2013-08-02 13:33:45 +04:00
|
|
|
class ItemProgressDialog;
|
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();
|
2011-02-17 02:21:45 +03:00
|
|
|
void setupActions();
|
|
|
|
void setupSystemTray();
|
|
|
|
void setupContextMenu();
|
2012-06-05 17:49:53 +04:00
|
|
|
void setupLogBrowser();
|
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
|
|
|
|
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
|
|
|
|
2013-06-05 18:14:20 +04:00
|
|
|
// reimplemented
|
|
|
|
#if defined(Q_WS_WIN)
|
|
|
|
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:
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotFoldersChanged();
|
|
|
|
void slotSettings();
|
2013-08-02 13:33:45 +04:00
|
|
|
void slotItemProgressDialog();
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotParseOptions( const QString& );
|
|
|
|
void slotShowTrayMessage(const QString&, const QString&);
|
2013-07-05 03:01:23 +04:00
|
|
|
void slotShowOptionalTrayMessage(const QString&, const QString&);
|
2013-08-07 16:58:56 +04:00
|
|
|
void slotShowGuiMessage(const QString& title, const QString& message);
|
2013-07-05 15:14:48 +04:00
|
|
|
void slotCheckConnection();
|
|
|
|
void slotConnectionValidatorResult(ConnectionValidator::Status);
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotSyncStateChange( const QString& );
|
2011-09-26 17:00:12 +04:00
|
|
|
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-06-05 17:11:29 +04:00
|
|
|
void slotOpenLogBrowser();
|
2012-08-15 20:01:32 +04:00
|
|
|
void slotSSLFailed( QNetworkReply *reply, QList<QSslError> errors );
|
2012-04-02 22:10:29 +04:00
|
|
|
void slotStartUpdateDetector();
|
2013-06-27 18:54:33 +04:00
|
|
|
void slotSetupProxy();
|
2013-06-29 01:01:31 +04:00
|
|
|
void slotRefreshQuotaDisplay( qint64 total, qint64 used );
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotUseMonoIconsChanged( bool );
|
2013-07-31 00:22:43 +04:00
|
|
|
void slotUpdateProgress(const QString&, const Progress::Info&);
|
|
|
|
void slotProgressSyncProblem(const QString& folder, const Progress::SyncProblem &problem);
|
2013-07-23 15:18:52 +04:00
|
|
|
void slotDisplayIdle();
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotHelp();
|
2013-07-29 16:28:19 +04:00
|
|
|
void slotCredentialsFetched();
|
2011-02-17 02:21:45 +03:00
|
|
|
private:
|
2013-01-29 08:19:14 +04:00
|
|
|
void setHelp();
|
2013-01-15 23:41:52 +04:00
|
|
|
void raiseDialog( QWidget* );
|
2013-07-31 00:22:43 +04:00
|
|
|
void rebuildRecentMenus();
|
2013-07-29 16:28:19 +04:00
|
|
|
void runValidator();
|
2012-06-15 15:36:38 +04:00
|
|
|
|
2013-03-20 13:03:49 +04:00
|
|
|
Systray *_tray;
|
2012-05-15 20:29:12 +04:00
|
|
|
QAction *_actionOpenoC;
|
2013-07-04 21:59:40 +04:00
|
|
|
QAction *_actionSettings;
|
|
|
|
QAction *_actionQuota;
|
2013-07-23 15:18:52 +04:00
|
|
|
QAction *_actionStatus;
|
2013-07-31 00:22:43 +04:00
|
|
|
QAction *_actionRecent;
|
2013-07-04 21:59:40 +04:00
|
|
|
QAction *_actionHelp;
|
|
|
|
QAction *_actionQuit;
|
2011-10-14 18:39:53 +04:00
|
|
|
|
2011-04-04 13:36:44 +04:00
|
|
|
QNetworkConfigurationManager *_networkMgr;
|
2011-04-04 14:23:30 +04:00
|
|
|
|
2013-06-27 18:54:33 +04:00
|
|
|
QPointer<FolderWizard> _folderWizard;
|
2012-08-15 20:01:32 +04:00
|
|
|
SslErrorDialog *_sslErrorDialog;
|
2013-07-05 15:14:48 +04:00
|
|
|
ConnectionValidator *_conValidator;
|
2011-04-06 12:56:20 +04:00
|
|
|
|
|
|
|
// tray's menu
|
|
|
|
QMenu *_contextMenu;
|
2013-07-31 00:22:43 +04:00
|
|
|
QMenu *_recentActionsMenu;
|
2011-12-12 20:47:30 +04:00
|
|
|
|
2012-02-16 13:42:44 +04:00
|
|
|
Theme *_theme;
|
2012-02-21 14:50:19 +04:00
|
|
|
QSignalMapper *_folderOpenActionMapper;
|
2012-06-05 17:11:29 +04:00
|
|
|
LogBrowser *_logBrowser;
|
2013-07-04 21:59:40 +04:00
|
|
|
QPointer<SettingsDialog> _settingsDialog;
|
2013-08-02 13:33:45 +04:00
|
|
|
QPointer<ItemProgressDialog> _progressDialog;
|
|
|
|
|
2012-10-16 21:05:28 +04:00
|
|
|
QString _logFile;
|
2013-06-03 18:23:29 +04:00
|
|
|
QString _logDirectory;
|
2013-07-31 00:22:43 +04:00
|
|
|
|
2013-06-07 20:57:45 +04:00
|
|
|
int _logExpire;
|
2012-10-16 21:05:28 +04:00
|
|
|
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
|