Bug 105398

Summary: ark should not open internal or external viewer when extraction fails
Product: [Applications] ark Reporter: Haris Kouzinopoulos <kouzinopoulos>
Component: generalAssignee: Harald Hvaal <metellius>
Status: RESOLVED FIXED    
Severity: normal CC: rakuco
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Haris Kouzinopoulos 2005-05-10 11:47:52 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    Gentoo Packages

Why should ark open i.e. an image viewer when the extraction of the image fails? There is nothing to show! This is very annoying, as i have to work with many corrupted files
Comment 1 Henrique Pinto 2005-05-27 03:50:13 UTC
SVN commit 418595 by henrique:

    * Fix bug #105398 (ark should not open internal or external viewer when extraction fails)
      BUG: 105398



 M  +1 -0      ark_part.cpp  
 M  +1 -2      ark_part.h  
 M  +19 -18    arkwidget.cpp  
 M  +1 -1      arkwidget.h  


--- trunk/KDE/kdeutils/ark/ark_part.cpp #418594:418595
@@ -22,6 +22,7 @@
 
 #include "ark_part.h"
 #include "arkfactory.h"
+#include "arkwidget.h"
 #include "settings.h"
 
 #include <kdebug.h>
--- trunk/KDE/kdeutils/ark/ark_part.h #418594:418595
@@ -22,8 +22,6 @@
 #ifndef __ark_part_h__
 #define __ark_part_h__
 
-#include "arkwidget.h"
-
 #include <kparts/part.h>
 #include <kparts/browserextension.h>
 #include <kparts/statusbarextension.h>
@@ -35,6 +33,7 @@
 
 
 class KAboutData;
+class ArkWidget;
 
 
 class ArkBrowserExtension: public KParts::BrowserExtension
--- trunk/KDE/kdeutils/ark/arkwidget.cpp #418594:418595
@@ -1893,39 +1893,40 @@
 ArkWidget::action_view()
 {
     connect( arch, SIGNAL( sigExtract( bool ) ), this,
-             SLOT( viewSlotExtractDone() ) );
+             SLOT( viewSlotExtractDone( bool ) ) );
     busy( i18n( "Extracting file to view" ) );
     showCurrentFile();
 }
 
 void
-ArkWidget::viewSlotExtractDone()
+ArkWidget::viewSlotExtractDone( bool success )
 {
-    chmod( QFile::encodeName( m_strFileToView ), 0400 );
-    bool view = true;
-
-    if ( Settings::useIntegratedViewer() )
+    if ( success )
     {
-        ArkViewer * viewer = new ArkViewer( this, "viewer" );
+        chmod( QFile::encodeName( m_strFileToView ), 0400 );
+        bool view = true;
 
-        if ( !viewer->view( m_strFileToView ) )
+        if ( Settings::useIntegratedViewer() )
         {
-            kdDebug( 1601 ) << "ArkWidget::viewSlotExtractDone(): Internal Viewer can't view this file." << endl;
-            QString text = i18n( "The internal viewer is not able to display this file. Would you like to view it using an external program?" );
-            view = ( KMessageBox::warningYesNo( this, text ) == KMessageBox::Yes );
+            ArkViewer * viewer = new ArkViewer( this, "viewer" );
 
-            if ( view )
-                viewInExternalViewer( this, m_strFileToView );
+            if ( !viewer->view( m_strFileToView ) )
+            {
+                QString text = i18n( "The internal viewer is not able to display this file. Would you like to view it using an external program?" );
+                view = ( KMessageBox::warningYesNo( this, text ) == KMessageBox::Yes );
 
+                if ( view )
+                    viewInExternalViewer( this, m_strFileToView );
+            }
         }
+        else
+        {
+            viewInExternalViewer( this, m_strFileToView );
+        }
     }
-    else
-    {
-        viewInExternalViewer( this, m_strFileToView );
-    }
 
     disconnect( arch, SIGNAL( sigExtract( bool ) ), this,
-                SLOT( viewSlotExtractDone( ) ) );
+                SLOT( viewSlotExtractDone( bool ) ) );
     // avoid race condition, don't do updates if application is exiting
     if( archiveContent )
     {
--- trunk/KDE/kdeutils/ark/arkwidget.h #418594:418595
@@ -231,7 +231,7 @@
     void startDragSlotExtractDone( bool );
     void editSlotExtractDone();
     void editSlotAddDone( bool success );
-    void viewSlotExtractDone();
+    void viewSlotExtractDone( bool success );
     void openWithSlotExtractDone();
 
     void createRealArchiveSlotCreate( Arch * newArch, bool success,