Bug 116347 - All the Image tools freeze the Image Editor and ShowFoto when validating a value in a spinbox with the key ENTER.
Summary: All the Image tools freeze the Image Editor and ShowFoto when validating a va...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-Curves (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-14 15:03 UTC by Tung NGUYEN
Modified: 2022-01-18 16:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.6.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tung NGUYEN 2005-11-14 15:03:26 UTC
Version:           0.8.0-rc (using KDE KDE 3.4.2)
Installed from:    Compiled From Sources
OS:                Linux

For exemple, with the Blur core filter, enter the value 1 in the Smoothness spinbox and validate with the key ENTER => the filter freezes at the end of the process, the cursor has a sand glass shape. In Konsole, there are:

digikam: GaussianBlur::Computation aborted... ( 0 s )
digikam: Preview Gaussian Blur failed...
digikam: GaussianBlur::End of computation !!! ... ( 0 s )

This problem occurs with all the plugins which have a spinbox (Charcoal, FreeRotation, ...).
Comment 1 caulier.gilles 2005-11-15 13:45:06 UTC
SVN commit 480380 by cgilles:

Prevent Enter keys events between dialog and spinBox
CCBUG : 116347

 M  +38 -0     imageeffect_blur.cpp  
 M  +1 -0      imageeffect_blur.h  
 M  +38 -0     imageeffect_sharpen.cpp  
 M  +1 -0      imageeffect_sharpen.h  


--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_blur.cpp #480379:480380
@@ -301,4 +301,42 @@
     delete d;        
 }
 
+// Backport KDialog::keyPressEvent() implementation from KDELibs to ignore Enter/Return Key events 
+// to prevent any conflicts between dialog keys events and SpinBox keys events.
+
+void ImageEffect_Blur::keyPressEvent(QKeyEvent *e)
+{
+    if ( e->state() == 0 )
+    {
+        switch ( e->key() )
+        {
+        case Key_Escape:
+            e->accept();
+            reject();
+        break;
+        case Key_Enter:            
+        case Key_Return:     
+            e->ignore();              
+        break;
+        default:
+            e->ignore();
+            return;
+        }
+    }
+    else
+    {
+        // accept the dialog when Ctrl-Return is pressed
+        if ( e->state() == ControlButton &&
+            (e->key() == Key_Return || e->key() == Key_Enter) )
+        {
+            e->accept();
+            accept();
+        }
+        else
+        {
+            e->ignore();
+        }
+    }
+}
+
 #include "imageeffect_blur.moc"
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_blur.h #480379:480380
@@ -80,6 +80,7 @@
     void closeEvent(QCloseEvent *e);
     void customEvent(QCustomEvent *event);
     void abortPreview(void);
+    void keyPressEvent(QKeyEvent *e);
 };
 
 #endif /* IMAGEEFFECT_BLUR_H */
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_sharpen.cpp #480379:480380
@@ -301,4 +301,42 @@
     delete d;        
 }
 
+// Backport KDialog::keyPressEvent() implementation from KDELibs to ignore Enter/Return Key events 
+// to prevent any conflicts between dialog keys events and SpinBox keys events.
+
+void ImageEffect_Sharpen::keyPressEvent(QKeyEvent *e)
+{
+    if ( e->state() == 0 )
+    {
+        switch ( e->key() )
+        {
+        case Key_Escape:
+            e->accept();
+            reject();
+        break;
+        case Key_Enter:            
+        case Key_Return:     
+            e->ignore();              
+        break;
+        default:
+            e->ignore();
+            return;
+        }
+    }
+    else
+    {
+        // accept the dialog when Ctrl-Return is pressed
+        if ( e->state() == ControlButton &&
+            (e->key() == Key_Return || e->key() == Key_Enter) )
+        {
+            e->accept();
+            accept();
+        }
+        else
+        {
+            e->ignore();
+        }
+    }
+}
+
 #include "imageeffect_sharpen.moc"
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_sharpen.h #480379:480380
@@ -80,6 +80,7 @@
     void closeEvent(QCloseEvent *e);
     void customEvent(QCustomEvent *event);
     void abortPreview(void);
+    void keyPressEvent(QKeyEvent *e);
 };
 
 #endif /* IMAGEEFFECT_SHARPEN_H */
Comment 2 caulier.gilles 2005-11-15 13:45:35 UTC
SVN commit 480381 by cgilles:

Prevent Enter keys events between dialog and spinBox
CCBUG : 116347

 M  +39 -1     ctrlpaneldialog.cpp  
 M  +1 -0      ctrlpaneldialog.h  
 M  +38 -0     imageguidedialog.cpp  
 M  +1 -0      imageguidedialog.h  


--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/ctrlpaneldialog.cpp #480380:480381
@@ -62,7 +62,7 @@
                              i18n("&Abort"),
                              i18n("&Save As..."),
                              i18n("&Load...")),
-                     m_parent(parent), m_name(name), m_tryAction(tryAction)
+                 m_parent(parent), m_name(name), m_tryAction(tryAction)
 {
     m_currentRenderingMode = NoneRendering;
     m_timer                = 0L;
@@ -333,6 +333,44 @@
     delete d;
 }
 
+// Backport KDialog::keyPressEvent() implementation from KDELibs to ignore Enter/Return Key events 
+// to prevent any conflicts between dialog keys events and SpinBox keys events.
+
+void CtrlPanelDialog::keyPressEvent(QKeyEvent *e)
+{
+    if ( e->state() == 0 )
+    {
+        switch ( e->key() )
+        {
+        case Key_Escape:
+            e->accept();
+            reject();
+        break;
+        case Key_Enter:            
+        case Key_Return:     
+            e->ignore();              
+        break;
+        default:
+            e->ignore();
+            return;
+        }
+    }
+    else
+    {
+        // accept the dialog when Ctrl-Return is pressed
+        if ( e->state() == ControlButton &&
+            (e->key() == Key_Return || e->key() == Key_Enter) )
+        {
+            e->accept();
+            accept();
+        }
+        else
+        {
+            e->ignore();
+        }
+    }
+}
+
 }  // NameSpace DigikamImagePlugins
 
 #include "ctrlpaneldialog.moc"
--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/ctrlpaneldialog.h #480380:480381
@@ -103,6 +103,7 @@
     void closeEvent(QCloseEvent *e);
     void customEvent(QCustomEvent *event);
     void abortPreview(void);
+    void keyPressEvent(QKeyEvent *e);
 
     virtual void writeUserSettings(void){};            
     virtual void resetValues(void){};
--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imageguidedialog.cpp #480380:480381
@@ -401,6 +401,44 @@
     delete d;
 }
 
+// Backport KDialog::keyPressEvent() implementation from KDELibs to ignore Enter/Return Key events 
+// to prevent any conflicts between dialog keys events and SpinBox keys events.
+
+void ImageGuideDialog::keyPressEvent(QKeyEvent *e)
+{
+    if ( e->state() == 0 )
+    {
+        switch ( e->key() )
+        {
+        case Key_Escape:
+            e->accept();
+            reject();
+        break;
+        case Key_Enter:            
+        case Key_Return:     
+            e->ignore();              
+        break;
+        default:
+            e->ignore();
+            return;
+        }
+    }
+    else
+    {
+        // accept the dialog when Ctrl-Return is pressed
+        if ( e->state() == ControlButton &&
+            (e->key() == Key_Return || e->key() == Key_Enter) )
+        {
+            e->accept();
+            accept();
+        }
+        else
+        {
+            e->ignore();
+        }
+    }
+}
+
 }  // NameSpace DigikamImagePlugins
 
 #include "imageguidedialog.moc"
--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imageguidedialog.h #480380:480381
@@ -117,6 +117,7 @@
     void abortPreview(void);
     void readSettings(void);
     void writeSettings(void);
+    void keyPressEvent(QKeyEvent *e);
             
     virtual void writeUserSettings(void){};
     virtual void resetValues(void){};
Comment 3 caulier.gilles 2005-11-15 13:46:22 UTC
Tung,

Let's me hear if all is ok for you. You need to update digikam and digikamimageplugins.

Gilles
Comment 4 Tung NGUYEN 2005-11-16 11:04:47 UTC
Gilles, 

I have tested your SVN commits with all the Image plugins which have a spinbox and now the key enter works fine (no freeze).

---
Tung.
Comment 5 caulier.gilles 2005-11-16 11:10:15 UTC
ok. Then I Close it

Gilles