20 * windows view toolbar buttons |
20 * windows view toolbar buttons |
21 * |
21 * |
22 */ |
22 */ |
23 |
23 |
24 #include "BookmarksToolbarSnippet.h" |
24 #include "BookmarksToolbarSnippet.h" |
|
25 #include "ToolbarChromeItem.h" |
25 #include "ViewStack.h" |
26 #include "ViewStack.h" |
26 #include "GWebContentView.h" |
27 #include "GWebContentView.h" |
27 #include "BookmarksManager.h" |
28 #include "BookmarksManager.h" |
28 #include <QDebug> |
29 #include <QDebug> |
29 |
30 |
30 namespace GVA { |
31 namespace GVA { |
31 |
32 |
32 BookmarksToolbarSnippet::BookmarksToolbarSnippet(const QString& elementId, ChromeWidget * chrome, |
33 BookmarksToolbarSnippet::BookmarksToolbarSnippet(const QString& elementId, ChromeWidget * chrome, |
33 const QRectF& ownerArea, const QWebElement & element, QGraphicsWidget * widget) |
34 const QWebElement & element) |
34 : DualButtonToolbarSnippet(elementId, chrome, ownerArea, element, widget), |
35 : DualButtonToolbarSnippet(elementId, chrome, element), |
35 m_action1(0), m_action2(0) |
36 m_action1(0), m_action2(0) |
36 { |
37 { |
37 } |
38 } |
38 |
39 |
39 BookmarksToolbarSnippet::~BookmarksToolbarSnippet() |
40 BookmarksToolbarSnippet::~BookmarksToolbarSnippet() |
41 if(m_action1) |
42 if(m_action1) |
42 delete m_action1; |
43 delete m_action1; |
43 if(m_action2) |
44 if(m_action2) |
44 delete m_action2; |
45 delete m_action2; |
45 } |
46 } |
46 |
47 |
|
48 BookmarksToolbarSnippet * BookmarksToolbarSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element) |
|
49 { |
|
50 BookmarksToolbarSnippet * that = new BookmarksToolbarSnippet( elementId, chrome, element ); |
|
51 that->setChromeWidget( new ToolbarChromeItem( that ) ); |
|
52 return that; |
|
53 } |
|
54 |
47 void BookmarksToolbarSnippet::addChild(ChromeSnippet * child) { |
55 void BookmarksToolbarSnippet::addChild(ChromeSnippet * child) { |
48 WebChromeContainerSnippet * s = dynamic_cast<WebChromeContainerSnippet* >(child); |
56 WebChromeContainerSnippet * s = dynamic_cast<WebChromeContainerSnippet* >(child); |
49 if (!s) { |
57 if (!s) { |
50 ToolbarActions_t* t = new ToolbarActions_t(); |
58 ToolbarActions_t* t = new ToolbarActions_t(); |
51 if (child->elementId() == "BookmarksBackButton" ) { |
59 if (child->elementId() == "BookmarksBackButton" ) { |
52 t->actionId = BOOKMARKS_VIEW_ACTION_BACK; |
60 t->actionId = BOOKMARKS_VIEW_ACTION_BACK; |
53 t->actionName = BOOKMARKS_TOOLBAR_BACK; |
61 t->actionName = BOOKMARKS_TOOLBAR_BACK; |
54 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png"; |
62 t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png"; |
55 t->disabledImg = ""; |
63 t->disabledImg = ""; |
56 t->selectedImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png"; |
64 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png"; |
57 } |
65 } |
58 else if (child->elementId() == "BookmarksAddButton" ) { |
66 else if (child->elementId() == "BookmarksAddButton" ) { |
59 t->actionId = BOOKMARKS_VIEW_ACTION_ADD; |
67 t->actionId = BOOKMARKS_VIEW_ACTION_ADD; |
60 t->actionName = BOOKMARKS_TOOLBAR_ADD; |
68 t->actionName = BOOKMARKS_TOOLBAR_ADD; |
61 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png"; |
69 t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png"; |
62 t->disabledImg = ""; |
70 t->disabledImg = ""; |
63 t->selectedImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png"; |
71 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png"; |
64 } |
72 } |
65 t->id = child->elementId(); |
73 t->id = child->elementId(); |
66 m_actionInfo.append(t); |
74 m_actionInfo.append(t); |
67 } |
75 } |
68 |
76 |