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 class UIServer_stub;
00034 class KURL;
00035 
00036 namespace KIO {
00037   class Job;
00038 };
00039 
00052 class Observer : public QObject, public DCOPObject {
00053 
00054   K_DCOP
00055   Q_OBJECT
00056 
00057 public:
00058 
00062   static Observer * self() {
00063       if (!s_pObserver) s_pObserver = new Observer;
00064       return s_pObserver;
00065   }
00066 
00072   int newJob( KIO::Job * job, bool showProgress );
00073 
00078   void jobFinished( int progressId );
00079 
00083   bool openPassDlg( const QString& prompt, QString& user, QString& pass,
00084                     bool readOnly );
00085 
00086   bool openPassDlg( KIO::AuthInfo& info );
00087 
00093   static int messageBox( int progressId, int type, const QString &text, const QString &caption,
00094                          const QString &buttonYes, const QString &buttonNo );
00095 
00099   KIO::RenameDlg_Result open_RenameDlg( KIO::Job * job,
00100                                         const QString & caption,
00101                                         const QString& src, const QString & dest,
00102                                         KIO::RenameDlg_Mode mode,
00103                                         QString& newDest,
00104                                         KIO::filesize_t sizeSrc = (KIO::filesize_t) -1,
00105                                         KIO::filesize_t sizeDest = (KIO::filesize_t) -1,
00106                                         time_t ctimeSrc = (time_t) -1,
00107                                         time_t ctimeDest = (time_t) -1,
00108                                         time_t mtimeSrc = (time_t) -1,
00109                                         time_t mtimeDest = (time_t) -1
00110                                         );
00111 
00115   KIO::SkipDlg_Result open_SkipDlg( KIO::Job * job,
00116                                     bool multi,
00117                                     const QString & error_text );
00118 
00119 k_dcop:
00123   void killJob( int progressId );
00124 
00128   KIO::MetaData metadata( int progressId );
00129 
00130 protected:
00131 
00132   static Observer * s_pObserver;
00133   Observer();
00134   ~Observer() {}
00135 
00136   UIServer_stub * m_uiserver;
00137 
00138   QIntDict< KIO::Job > m_dctJobs;
00139 
00140 public slots:
00141 
00142   void slotTotalSize( KIO::Job*, KIO::filesize_t size );
00143   void slotTotalFiles( KIO::Job*, unsigned long files );
00144   void slotTotalDirs( KIO::Job*, unsigned long dirs );
00145 
00146   void slotProcessedSize( KIO::Job*, KIO::filesize_t size );
00147   void slotProcessedFiles( KIO::Job*, unsigned long files );
00148   void slotProcessedDirs( KIO::Job*, unsigned long dirs );
00149 
00150   void slotSpeed( KIO::Job*, unsigned long bytes_per_second );
00151   void slotPercent( KIO::Job*, unsigned long percent );
00152   void slotInfoMessage( KIO::Job*, const QString & msg );
00153 
00154   void slotCopying( KIO::Job*, const KURL& from, const KURL& to );
00155   void slotMoving( KIO::Job*, const KURL& from, const KURL& to );
00156   void slotDeleting( KIO::Job*, const KURL& url );
00158   void slotTransferring( KIO::Job*, const KURL& url );
00159   void slotCreatingDir( KIO::Job*, const KURL& dir );
00160   // currently unused
00161   void slotCanResume( KIO::Job*, KIO::filesize_t offset );
00162 
00163 public:
00164   void stating( KIO::Job*, const KURL& url );
00165   void mounting( KIO::Job*, const QString & dev, const QString & point );
00166   void unmounting( KIO::Job*, const QString & point );
00167 protected:
00168   virtual void virtual_hook( int id, void* data );
00169 private:
00170   class ObserverPrivate* d;
00171 };
00172 
00173 // -*- mode: c++; c-basic-offset: 2 -*-
00174 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:33 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001