diff -r 6aeb7a756187 -r 3c88a81ff781 ginebra2/ContentViews/ContentViewContextMenu.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ginebra2/ContentViews/ContentViewContextMenu.cpp Fri Oct 15 17:30:59 2010 -0400 @@ -0,0 +1,48 @@ + +#include +#include + +#include "ContentViewContextMenu.h" +#include "webpagecontroller.h" +#include "Downloads.h" + +namespace GVA { + +ContentViewContextMenu::ContentViewContextMenu(QWebHitTestResult *hitTest, QWidget *parent) : + ContextMenu(parent), + m_menu(parent), + m_hitTest(hitTest) +{ + if(m_hitTest->linkUrl().isValid()) { + addAction("Open in New Window", this, SLOT(onOpenLink())); + addAction("Share Link", this, SLOT(onShareLink())); + } + if(m_hitTest->imageUrl().isValid()) { + addAction("View Image", this, SLOT(onViewImage())); + addAction("Save Image", this, SLOT(onSaveImage())); + addAction("Share Image", this, SLOT(onShareImage())); + + } +} + +void ContentViewContextMenu::onOpenLink() { + WebPageController::getSingleton()->LoadInNewWindow(m_hitTest->linkUrl().toString()); +} + +void ContentViewContextMenu::onViewImage() { + WebPageController::getSingleton()->LoadInNewWindow(m_hitTest->imageUrl().toString()); +} + +void ContentViewContextMenu::onShareImage() { + WebPageController::getSingleton()->share(m_hitTest->imageUrl().toString()); +} + +void ContentViewContextMenu::onSaveImage() { +} + +void ContentViewContextMenu::onShareLink() { + WebPageController::getSingleton()->share(m_hitTest->linkUrl().toString()); + +} + +} // GVA namespace