StarStoryToolButton.qml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2012 Róbert Márki
  4. **
  5. ** This file is part of Web Feeds.
  6. **
  7. ** Web Feeds is free software: you can redistribute it and/or modify
  8. ** it under the terms of the GNU General Public License as published by
  9. ** the Free Software Foundation, either version 3 of the License, or
  10. ** (at your option) any later version.
  11. **
  12. ** Web Feeds is distributed in the hope that it will be useful,
  13. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ** GNU General Public License for more details.
  16. **
  17. ** You should have received a copy of the GNU General Public License
  18. ** along with Web Feeds. If not, see <http://www.gnu.org/licenses/>.
  19. ****************************************************************************/
  20. import QtQuick 1.1
  21. import "../../../../shared/qml/" as Shared
  22. import WebFeeds 1.0
  23. import GoogleReader 1.0
  24. Shared.CommonToolBarIcon {
  25. id: root
  26. toolIconId: root.pageItem ? (root.pageItem.starred ? "toolbar-favorite-mark" : "toolbar-favorite-unmark") : ""
  27. busy: root.pageItem ? root.pageItem.starredBusy : false
  28. property variant service: null
  29. onClicked: {
  30. if(!root.busy && enabled) {
  31. root.service = root.pageItem.service;
  32. if(!root.pageItem.starred)
  33. service.starStory(root.pageItem);
  34. else
  35. service.unstarStory(root.pageItem);
  36. }
  37. }
  38. }