/sources/qst/syncnativebrowser.cpp

https://github.com/sieren/QSyncthingTray · C++ · 93 lines · 38 code · 24 blank · 31 comment · 0 complexity · da466cee18e978eebd06e6853f22c80b MD5 · raw file

  1. /******************************************************************************
  2. // QSyncthingTray
  3. // Copyright (c) Matthias Frick, All rights reserved.
  4. //
  5. // This library is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU Lesser General Public
  7. // License as published by the Free Software Foundation; either
  8. // version 3.0 of the License, or (at your option) any later version.
  9. //
  10. // This library is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. // Lesser General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public
  16. // License along with this library.
  17. ******************************************************************************/
  18. #include <qst/syncnativebrowser.h>
  19. #include <QContextMenuEvent>
  20. #include <functional>
  21. #include <QDesktopServices>
  22. //------------------------------------------------------------------------------------//
  23. #define UNUSED(x) (void)(x)
  24. //------------------------------------------------------------------------------------//
  25. namespace qst
  26. {
  27. namespace webview
  28. {
  29. //------------------------------------------------------------------------------------//
  30. SyncNativeBrowser::SyncNativeBrowser(QUrl url, Authentication authInfo,
  31. std::shared_ptr<settings::AppSettings> appSettings) :
  32. mSyncThingUrl(url)
  33. ,mAuthInfo(authInfo)
  34. ,mpAppSettings(appSettings)
  35. {
  36. }
  37. //------------------------------------------------------------------------------------//
  38. void SyncNativeBrowser::updateConnection(const QUrl &url, const Authentication &authInfo)
  39. {
  40. mSyncThingUrl = url;
  41. mAuthInfo = authInfo;
  42. }
  43. //------------------------------------------------------------------------------------//
  44. bool SyncNativeBrowser::isVisible() const
  45. {
  46. return false;
  47. }
  48. //------------------------------------------------------------------------------------//
  49. void SyncNativeBrowser::setZoomFactor(double value)
  50. {
  51. UNUSED(value);
  52. // NOOP
  53. }
  54. //------------------------------------------------------------------------------------//
  55. void SyncNativeBrowser::raise()
  56. {
  57. // NOOP
  58. }
  59. //------------------------------------------------------------------------------------//
  60. void SyncNativeBrowser::show()
  61. {
  62. QDesktopServices::openUrl(QUrl(mSyncThingUrl));
  63. }
  64. } // qst namespace
  65. } // webview namespace
  66. //------------------------------------------------------------------------------------//
  67. //------------------------------------------------------------------------------------//
  68. // EOF
  69. //------------------------------------------------------------------------------------//