owncloudgui.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #ifndef OWNCLOUDGUI_H
  15. #define OWNCLOUDGUI_H
  16. #include "systray.h"
  17. #include "connectionvalidator.h"
  18. #include "progressdispatcher.h"
  19. #include <QObject>
  20. #include <QPointer>
  21. #include <QAction>
  22. #include <QMenu>
  23. #include <QSize>
  24. #include <QTimer>
  25. #ifdef WITH_LIBCLOUDPROVIDERS
  26. #include <QDBusConnection>
  27. #endif
  28. namespace OCC {
  29. class Folder;
  30. class SettingsDialog;
  31. class ShareDialog;
  32. class Application;
  33. class LogBrowser;
  34. class AccountState;
  35. enum class ShareDialogStartPage {
  36. UsersAndGroups,
  37. PublicLinks,
  38. };
  39. /**
  40. * @brief The ownCloudGui class
  41. * @ingroup gui
  42. */
  43. class ownCloudGui : public QObject
  44. {
  45. Q_OBJECT
  46. public:
  47. explicit ownCloudGui(Application *parent = nullptr);
  48. bool checkAccountExists(bool openSettings);
  49. static void raiseDialog(QWidget *raiseWidget);
  50. static QSize settingsDialogSize() { return {800, 500}; }
  51. void setupOverlayIcons();
  52. #ifdef WITH_LIBCLOUDPROVIDERS
  53. void setupCloudProviders();
  54. bool cloudProviderApiAvailable();
  55. #endif
  56. void createTray();
  57. void hideAndShowTray();
  58. signals:
  59. void setupProxy();
  60. void serverError(int code, const QString &message);
  61. void isShowingSettingsDialog();
  62. public slots:
  63. void slotComputeOverallSyncStatus();
  64. void slotShowTrayMessage(const QString &title, const QString &msg);
  65. void slotShowTrayUpdateMessage(const QString &title, const QString &msg, const QUrl &webUrl);
  66. void slotShowOptionalTrayMessage(const QString &title, const QString &msg);
  67. void slotFolderOpenAction(const QString &alias);
  68. void slotUpdateProgress(const QString &folder, const OCC::ProgressInfo &progress);
  69. void slotShowGuiMessage(const QString &title, const QString &message);
  70. void slotFoldersChanged();
  71. void slotShowSettings();
  72. void slotShowSyncProtocol();
  73. void slotShutdown();
  74. void slotSyncStateChange(OCC::Folder *);
  75. void slotTrayClicked(QSystemTrayIcon::ActivationReason reason);
  76. void slotToggleLogBrowser();
  77. void slotOpenOwnCloud();
  78. void slotOpenSettingsDialog();
  79. void slotOpenMainDialog();
  80. void slotSettingsDialogActivated();
  81. void slotHelp();
  82. void slotOpenPath(const QString &path);
  83. void slotAccountStateChanged();
  84. void slotTrayMessageIfServerUnsupported(OCC::Account *account);
  85. /**
  86. * Open a share dialog for a file or folder.
  87. *
  88. * localPath is the absolute local path to it (so not relative
  89. * to the folder).
  90. */
  91. void slotShowShareDialog(const QString &localPath) const;
  92. void slotShowFileActivityDialog(const QString &localPath) const;
  93. void slotNewAccountWizard();
  94. private slots:
  95. void slotLogin();
  96. void slotLogout();
  97. private:
  98. QPointer<Systray> _tray;
  99. QPointer<SettingsDialog> _settingsDialog;
  100. QPointer<LogBrowser> _logBrowser;
  101. #ifdef WITH_LIBCLOUDPROVIDERS
  102. QDBusConnection _bus;
  103. #endif
  104. QAction *_actionNewAccountWizard;
  105. QAction *_actionSettings;
  106. QAction *_actionEstimate;
  107. QList<QAction *> _recentItemsActions;
  108. Application *_app;
  109. };
  110. } // namespace OCC
  111. #endif // OWNCLOUDGUI_H