[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenox/konq-embed/dropin/kio
From:       Eva Brucherseifer <eva () kde ! org>
Date:       2006-04-24 20:10:15
Message-ID: 1145909415.306001.23373.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 533435 by eva:

Download Dialog:
- fixed download cancel 
- fixed delay closing of dialog after finished download

remaining bug: 
- after cancel dialog doesn't close automatically. Instead you have to
  cancel/close a second time


 M  +9 -5      jobclasses.cpp  
 M  +3 -3      jobclasses.h  
 M  +2 -39     progressbase.cpp  
 M  +3 -3      progressbase.h  
 M  +22 -16    progressdlg.cpp  
 M  +6 -11     progressdlg.h  


--- trunk/kdenox/konq-embed/dropin/kio/jobclasses.cpp #533434:533435
@@ -31,8 +31,8 @@
 #include "scheduler.h"
 #include "mimehandler.h"
 
-#include "progressdlg.h"
 
+
 #include <assert.h>
 
 #include <qtimer.h>
@@ -650,9 +650,10 @@
 
   if (showProgressInfo)
   {
-     defaultProgress = new KIO::ProgressDlg(parent);
+     defaultProgress = new ::ProgressDlg(parent);
      defaultProgress->slotTransferring( this, url );
-     defaultProgress->setOnlyClean( false );
+     defaultProgress->setOnlyClean( true );
+     defaultProgress->setJob(this);
 
      connect( this, SIGNAL( percent( KIO::Job*, unsigned long ) ),
                  defaultProgress, SLOT( slotPercent( KIO::Job*, unsigned long ) ) );
@@ -694,12 +695,14 @@
 
 void IODeviceJob::start( Slave *slave )
 {
-   defaultProgress->exec();
+   defaultProgress->show();
    TransferJob::start(slave);
 }
 
 void IODeviceJob::slotStoredData( KIO::Job *, const QByteArray &data )
 {
+  if (!m_iodevice)
+      return;
   // check for end-of-data marker:
   if ( data.size() == 0 )
   {
@@ -714,6 +717,8 @@
 
 void IODeviceJob::slotStoredDataReq( KIO::Job *, QByteArray &data )
 {
+  if (!m_iodevice)
+      return;
   // Inspired from kmail's KMKernel::byteArrayToRemoteFile
   // send the data in 64 KB chunks
   int bytesread = m_iodevice->readBlock(myData(), MAX_CHUNK_SIZE);
@@ -732,7 +737,6 @@
   defaultProgress->finished();
 }
 
-
 #include "jobclasses.moc"
 
 /* vim: et sw=4
--- trunk/kdenox/konq-embed/dropin/kio/jobclasses.h #533434:533435
@@ -33,6 +33,8 @@
 #include <kio/global.h>
 #include <kio/mimehandler.h>
 
+#include "progressdlg.h"
+
 // Hack! XXX 
 // #define StatJob TransferJob
 
@@ -263,8 +265,6 @@
 	return empty; 
     };
 
-    class ProgressDlg;
-
     class KIO_EXPORT IODeviceJob : public KIO::TransferJob {
         Q_OBJECT
 
@@ -281,7 +281,7 @@
       void start( Slave *slave );
 
       static const int MAX_CHUNK_SIZE = 64*1024;
-      
+
     private slots:
       void slotStoredData( KIO::Job *job, const QByteArray &data );
       void slotStoredDataReq( KIO::Job *job, QByteArray &data );
--- trunk/kdenox/konq-embed/dropin/kio/progressbase.cpp #533434:533435
@@ -19,7 +19,7 @@
 #include "jobclasses.h"
 #include "progressbase.h"
 
-namespace KIO {
+//namespace KIO {
 
 ProgressBase::ProgressBase( QWidget *parent )
   : QDialog( parent )
@@ -78,43 +78,7 @@
   m_pJob = job;
 }
 
-/*
-void ProgressBase::setJob( KIO::DeleteJob *job )
-{
-  // first connect all slots
-  connect( job, SIGNAL( totalSize( KIO::Job*, KIO::filesize_t ) ),
-	   SLOT( slotTotalSize( KIO::Job*, KIO::filesize_t ) ) );
-  connect( job, SIGNAL( totalFiles( KIO::Job*, unsigned long ) ),
-	   SLOT( slotTotalFiles( KIO::Job*, unsigned long ) ) );
-  connect( job, SIGNAL( totalDirs( KIO::Job*, unsigned long ) ),
-	   SLOT( slotTotalDirs( KIO::Job*, unsigned long ) ) );
 
-  connect( job, SIGNAL( processedSize( KIO::Job*, KIO::filesize_t ) ),
-	   SLOT( slotProcessedSize( KIO::Job*, KIO::filesize_t ) ) );
-  connect( job, SIGNAL( processedFiles( KIO::Job*, unsigned long ) ),
-	   SLOT( slotProcessedFiles( KIO::Job*, unsigned long ) ) );
-  connect( job, SIGNAL( processedDirs( KIO::Job*, unsigned long ) ),
-	   SLOT( slotProcessedDirs( KIO::Job*, unsigned long ) ) );
-
-  connect( job, SIGNAL( speed( KIO::Job*, unsigned long ) ),
-	   SLOT( slotSpeed( KIO::Job*, unsigned long ) ) );
-  connect( job, SIGNAL( percent( KIO::Job*, unsigned long ) ),
-	   SLOT( slotPercent( KIO::Job*, unsigned long ) ) );
-
-  connect( job, SIGNAL( deleting( KIO::Job*, const KURL& ) ),
-	   SLOT( slotDeleting( KIO::Job*, const KURL& ) ) );
-
-  connect( job, SIGNAL( result( KIO::Job* ) ),
-	   SLOT( slotFinished( KIO::Job* ) ) );
-
-  connect( job, SIGNAL( canceled( KIO::Job* ) ),
-	   SLOT( slotFinished( KIO::Job* ) ) );
-
-  // then assign job
-  m_pJob = job;
-}
-*/
-
 void ProgressBase::closeEvent( QCloseEvent* ) {
   // kill job when desired
   if ( m_bStopOnClose ) {
@@ -136,7 +100,6 @@
     slotClean();
   } else {
         accept();
-///    deleteLater();
   }
 }
 
@@ -161,7 +124,7 @@
   accept();
 }
 
-}
+//}
 
 #include "progressbase.moc"
 
--- trunk/kdenox/konq-embed/dropin/kio/progressbase.h #533434:533435
@@ -31,8 +31,8 @@
   class IODeviceJob;
 }
 
-namespace KIO
-{
+//namespace KIO
+//{
   enum Progress {
     DEFAULT = 1,
     STATUSBAR = 2,
@@ -236,6 +236,6 @@
     class ProgressBasePrivate* d;
 };
 
-} /* namespace */
+//} /* namespace */
 
 #endif // __progressbase_h__
--- trunk/kdenox/konq-embed/dropin/kio/progressdlg.cpp #533434:533435
@@ -32,7 +32,7 @@
 #include "jobclasses.h"
 #include "progressdlg.h"
 
-namespace KIO {
+//namespace KIO {
 
 class ProgressDlg::ProgressDlgPrivate
 {
@@ -73,25 +73,25 @@
 
   m_pProgressBar = new QProgressBar(this);
   topLayout->addWidget( m_pProgressBar );
-  grid->addRowSpacing(1,20);
+  grid->addRowSpacing(1,10);
 
   // processed info
   QHBoxLayout *hBox = new QHBoxLayout();
-  topLayout->addLayout(hBox);
+//  topLayout->addLayout(hBox);
 
-  sizeLabel = new QLabel(this);
+//  sizeLabel = new QLabel(this);
 //  hBox->addWidget(sizeLabel);
 
-  resumeLabel = new QLabel(this);
+//  resumeLabel = new QLabel(this);
 //  hBox->addWidget(resumeLabel);
 
-  progressLabel = new QLabel( this );
-  progressLabel->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding,
-                                             QSizePolicy::Preferred ) );
-  progressLabel->setAlignment( QLabel::AlignRight );
+//  progressLabel = new QLabel( this );
+//  progressLabel->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding,
+//                                             QSizePolicy::Preferred ) );
+//  progressLabel->setAlignment( QLabel::AlignRight );
 //  hBox->addWidget( progressLabel );
 
-  hBox = new QHBoxLayout();
+//  hBox = new QHBoxLayout();
   topLayout->addLayout(hBox);
 
   speedLabel = new QLabel(this);
@@ -108,7 +108,7 @@
   hBox->addStretch(1);
 
   d->cancelClose = new KPushButton( KStdGuiItem::cancel(), this );
-  connect( d->cancelClose, SIGNAL( clicked() ), SLOT( slotStop() ) );
+  connect( d->cancelClose, SIGNAL( clicked() ), this, SLOT( slotStop() ) );
   hBox->addWidget( d->cancelClose );
 
   resize( sizeHint() );
@@ -171,14 +171,14 @@
 
 
 void ProgressDlg::slotProcessedSize( KIO::Job*, KIO::filesize_t bytes ) {
-  if ( m_iProcessedSize == bytes )
+/*  if ( m_iProcessedSize == bytes )
     return;
   m_iProcessedSize = bytes;
 
   QString tmp = i18n( "%1 of %2 complete")
                 .arg( KIO::convertSize(bytes) )
                 .arg( KIO::convertSize(m_iTotalSize));
-  sizeLabel->setText( tmp );
+  sizeLabel->setText( tmp );*/
 }
 
 
@@ -216,18 +216,24 @@
 
 void ProgressDlg::slotCanResume( KIO::Job*, KIO::filesize_t resume )
 {
-  if ( resume ) {
+/*  if ( resume ) {
     resumeLabel->setText( i18n("Resuming from %1").arg(KIO::number(resume)) );
   } else {
     resumeLabel->setText( i18n("Not resumable") );
-  }
+  }*/
 }
 
 void ProgressDlg::slotClean()
 {
-  QTimer::singleShot( 2000, this, SLOT( accept() ) );
+  QTimer::singleShot( 1000, this, SLOT( slotDone() ) );
 }
 
+void ProgressDlg::slotDone()
+{
+  accept();
 }
 
+
+//}
+
 #include "progressdlg.moc"
--- trunk/kdenox/konq-embed/dropin/kio/progressdlg.h #533434:533435
@@ -28,7 +28,7 @@
 
 class KLineEdit;
 
-namespace KIO {
+//namespace KIO {
 
 /*
  * A default implementation of the progress dialog ProgressBase.
@@ -58,23 +58,18 @@
   void slotTransferring( KIO::Job*, const KURL& url );
   virtual void slotCanResume( KIO::Job*, KIO::filesize_t );
 
-  /**
-   * Called when the job is cleaned.
-   * @since 3.1
-   */
   void slotClean();
+  void slotDone();
 
 protected:
-  /// @since 3.1
   void init();
   void showTotals();
 
   KLineEdit* sourceEdit;
-  QLabel* progressLabel;
-  QLabel* destInvite;
+//  QLabel* progressLabel;
   QLabel* speedLabel;
-  QLabel* sizeLabel;
-  QLabel* resumeLabel;
+//  QLabel* sizeLabel;
+//  QLabel* resumeLabel;
 
   QProgressBar* m_pProgressBar;
 
@@ -89,7 +84,7 @@
   ProgressDlgPrivate* d;
 };
 
-} /* namespace */
+//} /* namespace */
 
 #endif // __progressdlg_h__
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic