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

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/crypto
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2008-04-22 8:48:34
Message-ID: 1208854114.667566.970.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 799759 by osterfeld:

connect progress() signal for D/V tasks, introduce setProgress() slot so Task can \
store the passed values (total amount in particular, needed to calculate aggregated \
progress)

 M  +8 -0      decryptverifytask.cpp  
 M  +1 -1      encryptemailtask.cpp  
 M  +1 -1      signemailtask.cpp  
 M  +3 -3      signencryptfilestask.cpp  
 M  +29 -2     task.cpp  
 M  +15 -2     task.h  


--- trunk/KDE/kdepim/kleopatra/crypto/decryptverifytask.cpp #799758:799759
@@ -441,6 +441,8 @@
     void registerJob( DecryptVerifyJob * job ) {
         q->connect( job, \
                SIGNAL(result(GpgME::DecryptionResult,GpgME::VerificationResult,QByteArray)),
                
                     q, \
SLOT(slotResult(GpgME::DecryptionResult,GpgME::VerificationResult,QByteArray)) ); +   \
q->connect( job, SIGNAL(progress(QString,int,int)), +                    q, \
SLOT(setProgress(QString,int,int)) );  }
 
     void emitResult( const shared_ptr<DecryptVerifyResult>& result );
@@ -547,6 +549,8 @@
     void registerJob( DecryptJob * job ) {
         q->connect( job, SIGNAL(result(GpgME::DecryptionResult,QByteArray)),
                     q, SLOT(slotResult(GpgME::DecryptionResult,QByteArray)) );
+        q->connect( job, SIGNAL(progress(QString,int,int)),
+                    q, SLOT(setProgress(QString,int,int)) );
     }
 
     void emitResult( const shared_ptr<DecryptVerifyResult>& result );
@@ -654,6 +658,8 @@
     void registerJob( VerifyOpaqueJob* job ) {
         q->connect( job, SIGNAL(result(GpgME::VerificationResult,QByteArray)),
                     q, SLOT(slotResult(GpgME::VerificationResult,QByteArray)) );
+        q->connect( job, SIGNAL(progress(QString,int,int)),
+                    q, SLOT(setProgress(QString,int,int)) );
     }
 
     void emitResult( const shared_ptr<DecryptVerifyResult>& result );
@@ -760,6 +766,8 @@
     void registerJob( VerifyDetachedJob* job ) {
         q->connect( job, SIGNAL(result(GpgME::VerificationResult)),
                     q, SLOT(slotResult(GpgME::VerificationResult)) );
+        q->connect( job, SIGNAL(progress(QString,int,int)),
+                    q, SLOT(setProgress(QString,int,int)) );
     }
 
     void emitResult( const shared_ptr<DecryptVerifyResult>& result );
--- trunk/KDE/kdepim/kleopatra/crypto/encryptemailtask.cpp #799758:799759
@@ -184,7 +184,7 @@
     if ( proto == CMS )
         encryptJob->setOutputIsBase64Encoded( true );
     connect( encryptJob.get(), SIGNAL(progress(QString,int,int)),
-             q, SIGNAL(progress(QString,int,int)) );
+             q, SLOT(setProgress(QString,int,int)) );
     connect( encryptJob.get(), SIGNAL(result(GpgME::EncryptionResult,QByteArray)),
              q, SLOT(slotResult(GpgME::EncryptionResult)) );
     return encryptJob;
--- trunk/KDE/kdepim/kleopatra/crypto/signemailtask.cpp #799758:799759
@@ -195,7 +195,7 @@
     if ( proto == CMS )
         signJob->setOutputIsBase64Encoded( true );
     connect( signJob.get(), SIGNAL(progress(QString,int,int)),
-             q, SIGNAL(progress(QString,int,int)) );
+             q, SLOT(setProgress(QString,int,int)) );
     connect( signJob.get(), SIGNAL(result(GpgME::SigningResult,QByteArray)),
              q, SLOT(slotResult(GpgME::SigningResult)) );
     return signJob;
--- trunk/KDE/kdepim/kleopatra/crypto/signencryptfilestask.cpp #799758:799759
@@ -276,7 +276,7 @@
     std::auto_ptr<Kleo::SignJob> signJob( backend->signJob( /*armor=*/true, \
/*textmode=*/false ) );  kleo_assert( signJob.get() );
     connect( signJob.get(), SIGNAL(progress(QString,int,int)),
-             q, SIGNAL(progress(QString,int,int)) );
+             q, SLOT(setProgress(QString,int,int)) );
     connect( signJob.get(), SIGNAL(result(GpgME::SigningResult,QByteArray)),
              q, SLOT(slotResult(GpgME::SigningResult)) );
     return signJob;
@@ -288,7 +288,7 @@
     std::auto_ptr<Kleo::SignEncryptJob> signEncryptJob( backend->signEncryptJob( \
/*armor=*/true, /*textmode=*/false ) );  kleo_assert( signEncryptJob.get() );
     connect( signEncryptJob.get(), SIGNAL(progress(QString,int,int)),
-             q, SIGNAL(progress(QString,int,int)) );
+             q, SLOT(setProgress(QString,int,int)) );
     connect( signEncryptJob.get(), \
                SIGNAL(result(GpgME::SigningResult,GpgME::EncryptionResult,QByteArray)),
                
              q, SLOT(slotResult(GpgME::SigningResult,GpgME::EncryptionResult)) );
     return signEncryptJob;
@@ -300,7 +300,7 @@
     std::auto_ptr<Kleo::EncryptJob> encryptJob( backend->encryptJob( /*armor=*/true, \
/*textmode=*/false ) );  kleo_assert( encryptJob.get() );
     connect( encryptJob.get(), SIGNAL(progress(QString,int,int)),
-             q, SIGNAL(progress(QString,int,int)) );
+             q, SLOT(setProgress(QString,int,int)) );
     connect( encryptJob.get(), SIGNAL(result(GpgME::EncryptionResult,QByteArray)),
              q, SLOT(slotResult(GpgME::EncryptionResult)) );
     return encryptJob;
--- trunk/KDE/kdepim/kleopatra/crypto/task.cpp #799758:799759
@@ -78,11 +78,13 @@
     explicit Private( Task * qq );
 
 private:
-    // ### 
+    QString m_progressLabel;
+    int m_processedSize;
+    int m_totalSize;
 };
 
 Task::Private::Private( Task * qq )
-    : q( qq )
+    : q( qq ), m_progressLabel(), m_processedSize( 0 ), m_totalSize( 0 )
 {
 
 }
@@ -95,6 +97,31 @@
 
 Task::~Task() {}
 
+int Task::processedSize() const
+{
+    return d->m_processedSize;
+}
+
+int Task::totalSize() const
+{
+    return d->m_totalSize;
+}
+
+QString Task::progressLabel() const
+{
+    d->m_progressLabel;
+}
+
+void Task::setProgress( const QString & label, int processed, int total )
+{
+    if ( processed == d->m_processedSize && total == d->m_totalSize && \
d->m_progressLabel == label ) +        return;
+    d->m_processedSize = processed;
+    d->m_totalSize == total;
+    d->m_progressLabel = label;
+    emit progress( label, processed, total );
+}
+
 void Task::start() {
     try {
         doStart();
--- trunk/KDE/kdepim/kleopatra/crypto/task.h #799758:799759
@@ -59,20 +59,33 @@
 
         virtual QString label() const = 0;
 
+        QString progressLabel() const;
+        int processedSize() const;
+        int totalSize() const;
+
     public Q_SLOTS:
         virtual void cancel() = 0;
 
     Q_SIGNALS:
-        void progress( const QString & what, int current, int total );
         void result( const boost::shared_ptr<const Kleo::Crypto::Task::Result> & );
         void started();
 
+#ifndef Q_MOC_RUN
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+private: // don't tell moc, but those signals are in fact private
+#endif
+#endif
+        void progress( const QString & what, int processed, int total );
+
     protected:
         static boost::shared_ptr<Result> makeErrorResult( int errCode, const \
QString& details );  
+    protected Q_SLOTS:
+        void setProgress( const QString & msg, int processed, int total );
+
     private Q_SLOTS:
         void emitError( int errCode, const QString& details );
-            
+        
     private:
         virtual void doStart() = 0;
         


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

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