branches/KDE/4.3/kdeutils/ark/part

View: New views
1 Messages — Rating Filter:   Alert me  

branches/KDE/4.3/kdeutils/ark/part

by Bugzilla from kubito@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

SVN commit 1046532 by rkcosta:

Backport r1046438.

Explicitly close the part when closing ArkViewer.

Calling ReadOnlyPart::closeUrl() is necessary, otherwise
the part may be destroyed before performing some proper
clean-up.

A progress bar dialog is shown if the part takes too long
to close.

CCBUG: 211880
CCMAIL: kde-i18n-doc@...


 M  +17 -0     arkviewer.cpp  
 M  +1 -0      arkviewer.h  


--- branches/KDE/4.3/kdeutils/ark/part/arkviewer.cpp #1046531:1046532
@@ -30,6 +30,7 @@
 #include <KIconLoader>
 #include <KVBox>
 #include <KMessageBox>
+#include <KProgressDialog>
 #include <KPushButton>
 #include <KRun>
 #include <KIO/NetAccess>
@@ -81,6 +82,22 @@
 {
 }
 
+void ArkViewer::closeEvent(QCloseEvent *event)
+{
+    KProgressDialog progressDialog(this,
+                                   i18n("Closing preview"),
+                                   i18n("Please wait while the preview is being closed..."));
+
+    progressDialog.setMinimumDuration(500);
+    progressDialog.setModal(true);
+    progressDialog.setAllowCancel(false);
+    progressDialog.progressBar()->setRange(0, 0);
+
+    m_part->closeUrl();
+
+    KDialog::closeEvent(event);
+}
+
 void ArkViewer::view(const QString& filename, QWidget *parent)
 {
     KService::Ptr viewer = ArkViewer::getViewer(filename);
--- branches/KDE/4.3/kdeutils/ark/part/arkviewer.h #1046531:1046532
@@ -37,6 +37,7 @@
     static void view(const QString& filename, QWidget* parent = 0);
 
 protected:
+    virtual void closeEvent(QCloseEvent *event);
     virtual void keyPressEvent(QKeyEvent *event);
 
 protected slots: