kio Library API Documentation

observer.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 Matej Koss <koss@miesto.sk>
00003                       David Faure <faure@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 #ifndef __kio_observer_h__
00020 #define __kio_observer_h__
00021 
00022 #include <qobject.h>
00023 #include <dcopobject.h>
00024 #include <qintdict.h>
00025 
00026 #include <kio/global.h>
00027 #include <kio/authinfo.h>
00028 
00029 #include "kio/job.h"
00030 #include "kio/skipdlg.h"
00031 #include "kio/renamedlg.h"
00032 
00033 #include <kdemacros.h>
00034 
00035 class UIServer_stub;
00036 class KURL;
00037 
00038 namespace KIO {
00039   class Job;
00040 }
00041 
00058 class Observer : public QObject, public DCOPObject {
00059 
00060   K_DCOP
00061   Q_OBJECT
00062 
00063 public:
00064 
00069   static Observer * self() {
00070       if (!s_pObserver) s_pObserver = new Observer;
00071       return s_pObserver;
00072   }
00073 
00081   int newJob( KIO::Job * job, bool showProgress );
00082 
00088   void jobFinished( int progressId );
00089 
00093   bool openPassDlg( const QString& prompt, QString& user, QString& pass,
00094                     bool readOnly );
00095 
00101   bool openPassDlg( KIO::AuthInfo& info );
00102 
00114   static int messageBox( int progressId, int type, const QString &text, const QString &caption,
00115                          const QString &buttonYes, const QString &buttonNo );
00116 
00121   KIO::RenameDlg_Result open_RenameDlg( KIO::Job * job,
00122                                         const QString & caption,
00123                                         const QString& src, const QString & dest,
00124                                         KIO::RenameDlg_Mode mode,
00125                                         QString& newDest,
00126                                         KIO::filesize_t sizeSrc = (KIO::filesize_t) -1,
00127                                         KIO::filesize_t sizeDest = (KIO::filesize_t) -1,
00128                                         time_t ctimeSrc = (time_t) -1,
00129                                         time_t ctimeDest = (time_t) -1,
00130                                         time_t mtimeSrc = (time_t) -1,
00131                                         time_t mtimeDest = (time_t) -1
00132                                         );
00133 
00138   KIO::SkipDlg_Result open_SkipDlg( KIO::Job * job,
00139                                     bool multi,
00140                                     const QString & error_text );
00141 
00142 k_dcop:
00147   void killJob( int progressId );
00148 
00153   KIO::MetaData metadata( int progressId );
00154 
00155 protected:
00156 
00157   static Observer * s_pObserver;
00158   Observer();
00159   ~Observer() {}
00160 
00161   UIServer_stub * m_uiserver;
00162 
00163   QIntDict< KIO::Job > m_dctJobs;
00164 
00165 public slots:
00166 
00167   void slotTotalSize( KIO::Job*, KIO::filesize_t size );
00168   void slotTotalFiles( KIO::Job*, unsigned long files );
00169   void slotTotalDirs( KIO::Job*, unsigned long dirs );
00170 
00171   void slotProcessedSize( KIO::Job*, KIO::filesize_t size );
00172   void slotProcessedFiles( KIO::Job*, unsigned long files );
00173   void slotProcessedDirs( KIO::Job*, unsigned long dirs );
00174 
00175   void slotSpeed( KIO::Job*, unsigned long bytes_per_second );
00176   void slotPercent( KIO::Job*, unsigned long percent );
00177   void slotInfoMessage( KIO::Job*, const QString & msg );
00178 
00179   void slotCopying( KIO::Job*, const KURL& from, const KURL& to );
00180   void slotMoving( KIO::Job*, const KURL& from, const KURL& to );
00181   void slotDeleting( KIO::Job*, const KURL& url );
00183   void slotTransferring( KIO::Job*, const KURL& url );
00184   void slotCreatingDir( KIO::Job*, const KURL& dir );
00185   // currently unused
00186   void slotCanResume( KIO::Job*, KIO::filesize_t offset );
00187 
00188 public:
00189   void stating( KIO::Job*, const KURL& url );
00190   void mounting( KIO::Job*, const QString & dev, const QString & point );
00191   void unmounting( KIO::Job*, const QString & point );
00192 protected:
00193   virtual void virtual_hook( int id, void* data );
00194 private:
00195   class ObserverPrivate* d;
00196 };
00197 
00198 // -*- mode: c++; c-basic-offset: 2 -*-
00199 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 5 07:16:51 2004 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003