author | zecke <zecke> | 2004-10-08 21:34:32 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-08 21:34:32 (UTC) |
commit | 16afa90172c9b1facaa8888780ed8bb8bd93598c (patch) (side-by-side diff) | |
tree | 3642810e51ceaacff2f6fba499e78d0cff0121b9 | |
parent | 0c3966672847b3b81c96c942727178368ac70e65 (diff) | |
download | opie-16afa90172c9b1facaa8888780ed8bb8bd93598c.zip opie-16afa90172c9b1facaa8888780ed8bb8bd93598c.tar.gz opie-16afa90172c9b1facaa8888780ed8bb8bd93598c.tar.bz2 |
Use KeyPressed instead of KeyReleased for the Accelerator
Key in the Image Display component. This fixes the
double 'next' problem when going from the browser to the viewer/display
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index b4f3110..5522131 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -20,19 +20,17 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name m_ignore_next_in = false; QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); initKeys(); } ImageView::~ImageView() { odebug << "Delete Imageview" << oendl; - if (m_viewManager) { - delete m_viewManager; - } + delete m_viewManager; } Opie::Core::OKeyConfigManager* ImageView::manager() { if (!m_viewManager) { initKeys(); } return m_viewManager; @@ -50,16 +48,24 @@ void ImageView::initKeys() lst.append( Opie::Core::OKeyPair::downArrowKey() ); lst.append( Opie::Core::OKeyPair::leftArrowKey() ); lst.append( Opie::Core::OKeyPair::rightArrowKey() ); lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", lst, false,this, "image_view_keys" ); + /** + * Handle KeyEvents when they're pressed. This avoids problems + * with 'double next' on Return. + * The Return press would switch to this view and the return + * release would emit the dispNext Signal. + */ + m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); + m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", Resource::loadPixmap("1to1"), ViewInfo, Opie::Core::OKeyPair(Qt::Key_I,0), this, SLOT(slotShowImageInfo()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", Resource::loadPixmap("rotate"), Autorotate, Opie::Core::OKeyPair(Qt::Key_R,0), @@ -141,17 +147,17 @@ void ImageView::focusInEvent(QFocusEvent *) { // Always do it here, no matter the size. odebug << "Focus in (view)" << oendl; //if (fullScreen()) parentWidget()->showNormal(); if (m_ignore_next_in){m_ignore_next_in=false;return;} if (fullScreen()) enableFullscreen(); } -void ImageView::hide() +void ImageView::hide() { if (fullScreen()) { m_ignore_next_in = true; showNormal(); } QWidget::hide(); } void ImageView::enableFullscreen() |