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 
00131   static int messageBox( int progressId, int type, const QString &text, const QString &caption,
00132                          const QString &buttonYes, const QString &buttonNo, const QString &dontAskAgainName );
00133 
00138   KIO::RenameDlg_Result open_RenameDlg( KIO::Job * job,
00139                                         const QString & caption,
00140                                         const QString& src, const QString & dest,
00141                                         KIO::RenameDlg_Mode mode,
00142                                         QString& newDest,
00143                                         KIO::filesize_t sizeSrc = (KIO::filesize_t) -1,
00144                                         KIO::filesize_t sizeDest = (KIO::filesize_t) -1,
00145                                         time_t ctimeSrc = (time_t) -1,
00146                                         time_t ctimeDest = (time_t) -1,
00147                                         time_t mtimeSrc = (time_t) -1,
00148                                         time_t mtimeDest = (time_t) -1
00149                                         );
00150 
00155   KIO::SkipDlg_Result open_SkipDlg( KIO::Job * job,
00156                                     bool multi,
00157                                     const QString & error_text );
00158 
00159 k_dcop:
00164   void killJob( int progressId );
00165 
00170   KIO::MetaData metadata( int progressId );
00171 
00172 protected:
00173 
00174   static Observer * s_pObserver;
00175   Observer();
00176   ~Observer() {}
00177 
00178   UIServer_stub * m_uiserver;
00179 
00180   QIntDict< KIO::Job > m_dctJobs;
00181 
00182 public slots:
00183 
00184   void slotTotalSize( KIO::Job*, KIO::filesize_t size );
00185   void slotTotalFiles( KIO::Job*, unsigned long files );
00186   void slotTotalDirs( KIO::Job*, unsigned long dirs );
00187 
00188   void slotProcessedSize( KIO::Job*, KIO::filesize_t size );
00189   void slotProcessedFiles( KIO::Job*, unsigned long files );
00190   void slotProcessedDirs( KIO::Job*, unsigned long dirs );
00191 
00192   void slotSpeed( KIO::Job*, unsigned long bytes_per_second );
00193   void slotPercent( KIO::Job*, unsigned long percent );
00194   void slotInfoMessage( KIO::Job*, const QString & msg );
00195 
00196   void slotCopying( KIO::Job*, const KURL& from, const KURL& to );
00197   void slotMoving( KIO::Job*, const KURL& from, const KURL& to );
00198   void slotDeleting( KIO::Job*, const KURL& url );
00200   void slotTransferring( KIO::Job*, const KURL& url );
00201   void slotCreatingDir( KIO::Job*, const KURL& dir );
00202   // currently unused
00203   void slotCanResume( KIO::Job*, KIO::filesize_t offset );
00204 
00205 public:
00206   void stating( KIO::Job*, const KURL& url );
00207   void mounting( KIO::Job*, const QString & dev, const QString & point );
00208   void unmounting( KIO::Job*, const QString & point );
00209 protected:
00210   virtual void virtual_hook( int id, void* data );
00211 private:
00212   class ObserverPrivate* d;
00213 };
00214 
00215 // -*- mode: c++; c-basic-offset: 2 -*-
00216 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Jul 22 10:17:21 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003