2013-10-01 15:52:07 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
|
|
|
|
*
|
|
|
|
* 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
|
2016-10-25 12:00:07 +03:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2013-10-01 15:52:07 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OWNCLOUDGUI_H
|
|
|
|
#define OWNCLOUDGUI_H
|
|
|
|
|
2014-07-11 02:31:24 +04:00
|
|
|
#include "systray.h"
|
|
|
|
#include "connectionvalidator.h"
|
|
|
|
#include "progressdispatcher.h"
|
2013-10-01 15:52:07 +04:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QAction>
|
|
|
|
#include <QMenu>
|
2015-07-20 19:15:45 +03:00
|
|
|
#include <QSize>
|
2016-09-23 11:44:54 +03:00
|
|
|
#include <QTimer>
|
2017-12-15 11:45:28 +03:00
|
|
|
#ifdef WITH_LIBCLOUDPROVIDERS
|
2017-07-23 21:58:00 +03:00
|
|
|
#include <QDBusConnection>
|
2017-12-15 11:45:28 +03:00
|
|
|
#endif
|
2013-10-01 15:52:07 +04:00
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2013-10-01 15:52:07 +04:00
|
|
|
|
2015-04-28 16:13:39 +03:00
|
|
|
class Folder;
|
|
|
|
|
2013-10-01 15:52:07 +04:00
|
|
|
class SettingsDialog;
|
2016-01-20 15:17:54 +03:00
|
|
|
class ShareDialog;
|
2013-10-01 15:52:07 +04:00
|
|
|
class Application;
|
2013-10-02 17:28:33 +04:00
|
|
|
class LogBrowser;
|
2015-07-03 11:59:44 +03:00
|
|
|
class AccountState;
|
2013-10-01 15:52:07 +04:00
|
|
|
|
2018-04-06 18:13:29 +03:00
|
|
|
enum class ShareDialogStartPage {
|
|
|
|
UsersAndGroups,
|
|
|
|
PublicLinks,
|
|
|
|
};
|
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The ownCloudGui class
|
|
|
|
* @ingroup gui
|
2015-06-26 18:07:47 +03:00
|
|
|
*/
|
2013-10-01 15:52:07 +04:00
|
|
|
class ownCloudGui : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-11-11 12:56:22 +03:00
|
|
|
explicit ownCloudGui(Application *parent = nullptr);
|
2013-10-01 15:52:07 +04:00
|
|
|
|
2013-11-04 19:36:23 +04:00
|
|
|
bool checkAccountExists(bool openSettings);
|
2013-10-01 15:52:07 +04:00
|
|
|
|
2014-07-07 17:20:37 +04:00
|
|
|
static void raiseDialog(QWidget *raiseWidget);
|
2020-05-27 21:19:15 +03:00
|
|
|
static QSize settingsDialogSize() { return {800, 500}; }
|
2014-08-01 16:28:34 +04:00
|
|
|
void setupOverlayIcons();
|
2017-07-23 21:58:00 +03:00
|
|
|
#ifdef WITH_LIBCLOUDPROVIDERS
|
|
|
|
void setupCloudProviders();
|
|
|
|
bool cloudProviderApiAvailable();
|
|
|
|
#endif
|
2020-01-12 23:19:18 +03:00
|
|
|
void createTray();
|
2014-07-07 17:20:37 +04:00
|
|
|
|
2013-10-01 15:52:07 +04:00
|
|
|
signals:
|
2013-10-02 17:28:33 +04:00
|
|
|
void setupProxy();
|
2018-01-19 22:53:45 +03:00
|
|
|
void serverError(int code, const QString &message);
|
2019-12-21 05:04:31 +03:00
|
|
|
void isShowingSettingsDialog();
|
2013-10-01 15:52:07 +04:00
|
|
|
|
|
|
|
public slots:
|
2013-10-02 17:28:33 +04:00
|
|
|
void slotComputeOverallSyncStatus();
|
2013-10-01 15:52:07 +04:00
|
|
|
void slotShowTrayMessage(const QString &title, const QString &msg);
|
|
|
|
void slotShowOptionalTrayMessage(const QString &title, const QString &msg);
|
|
|
|
void slotFolderOpenAction(const QString &alias);
|
2015-01-30 15:36:20 +03:00
|
|
|
void slotUpdateProgress(const QString &folder, const ProgressInfo &progress);
|
2013-10-01 15:52:07 +04:00
|
|
|
void slotShowGuiMessage(const QString &title, const QString &message);
|
|
|
|
void slotFoldersChanged();
|
2013-11-26 06:15:03 +04:00
|
|
|
void slotShowSettings();
|
2013-11-29 14:18:59 +04:00
|
|
|
void slotShowSyncProtocol();
|
2013-10-02 17:28:33 +04:00
|
|
|
void slotShutdown();
|
2015-04-28 16:13:39 +03:00
|
|
|
void slotSyncStateChange(Folder *);
|
2013-10-01 15:52:07 +04:00
|
|
|
void slotTrayClicked(QSystemTrayIcon::ActivationReason reason);
|
2013-10-02 17:28:33 +04:00
|
|
|
void slotToggleLogBrowser();
|
|
|
|
void slotOpenOwnCloud();
|
2015-09-02 12:10:01 +03:00
|
|
|
void slotOpenSettingsDialog();
|
2020-06-16 19:59:16 +03:00
|
|
|
void slotOpenMainDialog();
|
2019-12-21 05:04:31 +03:00
|
|
|
void slotSettingsDialogActivated();
|
2013-10-02 17:28:33 +04:00
|
|
|
void slotHelp();
|
2013-10-02 20:16:24 +04:00
|
|
|
void slotOpenPath(const QString &path);
|
2013-11-25 18:33:35 +04:00
|
|
|
void slotAccountStateChanged();
|
2016-03-02 13:59:36 +03:00
|
|
|
void slotTrayMessageIfServerUnsupported(Account *account);
|
2018-04-10 23:51:47 +03:00
|
|
|
|
2018-02-22 21:15:02 +03:00
|
|
|
|
2017-05-10 10:37:10 +03:00
|
|
|
/**
|
|
|
|
* Open a share dialog for a file or folder.
|
|
|
|
*
|
|
|
|
* sharePath is the full remote path to the item,
|
|
|
|
* localPath is the absolute local path to it (so not relative
|
|
|
|
* to the folder).
|
|
|
|
*/
|
2018-04-06 18:13:29 +03:00
|
|
|
void slotShowShareDialog(const QString &sharePath, const QString &localPath, ShareDialogStartPage startPage);
|
2017-05-10 10:37:10 +03:00
|
|
|
|
2016-01-20 15:17:54 +03:00
|
|
|
void slotRemoveDestroyedShareDialogs();
|
2013-10-01 15:52:07 +04:00
|
|
|
|
|
|
|
private slots:
|
2015-07-03 11:59:44 +03:00
|
|
|
void slotLogin();
|
|
|
|
void slotLogout();
|
2016-11-18 14:17:05 +03:00
|
|
|
void slotNewAccountWizard();
|
2013-10-01 15:52:07 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
QPointer<Systray> _tray;
|
|
|
|
QPointer<SettingsDialog> _settingsDialog;
|
2013-10-02 17:28:33 +04:00
|
|
|
QPointer<LogBrowser> _logBrowser;
|
2016-09-13 15:34:22 +03:00
|
|
|
|
2017-12-15 11:45:28 +03:00
|
|
|
#ifdef WITH_LIBCLOUDPROVIDERS
|
2017-07-23 21:58:00 +03:00
|
|
|
QDBusConnection _bus;
|
2017-12-15 11:45:28 +03:00
|
|
|
#endif
|
2017-07-23 21:58:00 +03:00
|
|
|
|
2016-01-20 15:17:54 +03:00
|
|
|
QMap<QString, QPointer<ShareDialog>> _shareDialogs;
|
2013-10-01 15:52:07 +04:00
|
|
|
|
2016-11-18 14:17:05 +03:00
|
|
|
QAction *_actionNewAccountWizard;
|
2013-10-01 15:52:07 +04:00
|
|
|
QAction *_actionSettings;
|
2014-04-29 03:31:27 +04:00
|
|
|
QAction *_actionEstimate;
|
2020-01-05 23:06:42 +03:00
|
|
|
|
2018-02-22 21:15:02 +03:00
|
|
|
|
2014-03-20 17:43:10 +04:00
|
|
|
QList<QAction *> _recentItemsActions;
|
2013-10-02 20:16:24 +04:00
|
|
|
Application *_app;
|
2013-10-01 15:52:07 +04:00
|
|
|
};
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
} // namespace OCC
|
2013-10-01 15:52:07 +04:00
|
|
|
|
|
|
|
#endif // OWNCLOUDGUI_H
|