| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# uiserver.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_uiserver_h__
    00020 #define __kio_uiserver_h__
    00021
    00022 #include <qintdict.h>
    00023 #include <qdatetime.h>
    00024 #include <qtimer.h>
    00025
    00026 #include <dcopobject.h>
    00027 #include <kio/global.h>
    00028 #include <kio/authinfo.h>
    00029 #include <kurl.h>
    00030 #include <kmainwindow.h>
    00031 #include <kdatastream.h>
    00032 #include <klistview.h>
    00033 #include <ksslcertdlg.h>
    00034
    00035 class ListProgress;
    00036
    00037 namespace KIO {
    00038   class Job;
    00039   class DefaultProgress;
    00040 }
    00041
    00046 class ProgressItem : public QObject, public QListViewItem {
    00047
    00048   Q_OBJECT
    00049
    00050 public:
    00051   ProgressItem( ListProgress* view, QListViewItem *after, QCString app_id, int job_id,
    00052                 bool showDefault = true );
    00053   ~ProgressItem();
    00054
    00055   QCString appId() { return m_sAppId; }
    00056   int jobId() { return m_iJobId; }
    00057
    00058   void setVisible( bool visible );
    00059   void setDefaultProgressVisible( bool visible );
    00060   bool isVisible() const { return m_visible; }
    00061
    00062   void setTotalSize( KIO::filesize_t bytes );
    00063   void setTotalFiles( unsigned long files );
    00064   void setTotalDirs( unsigned long dirs );
    00065
    00066   void setProcessedSize( KIO::filesize_t size );
    00067   void setProcessedFiles( unsigned long files );
    00068   void setProcessedDirs( unsigned long dirs );
    00069
    00070   void setPercent( unsigned long percent );
    00071   void setSpeed( unsigned long bytes_per_second );
    00072   void setInfoMessage( const QString & msg );
    00073
    00074   void setCopying( const KURL& from, const KURL& to );
    00075   void setMoving( const KURL& from, const KURL& to );
    00076   void setDeleting( const KURL& url );
    00077   void setTransferring( const KURL& url );
    00078   void setCreatingDir( const KURL& dir );
    00079   void setStating( const KURL& url );
    00080   void setMounting( const QString & dev, const QString & point );
    00081   void setUnmounting( const QString & point );
    00082
    00083   void setCanResume( KIO::filesize_t offset );
    00084
    00085   KIO::filesize_t totalSize() { return m_iTotalSize; }
    00086   unsigned long totalFiles() { return m_iTotalFiles; }
    00087   KIO::filesize_t processedSize() { return m_iProcessedSize; }
    00088   unsigned long processedFiles() { return m_iProcessedFiles; }
    00089   unsigned long speed() { return m_iSpeed; }
    00090   QTime remainingTime() { return m_remainingTime; }
    00091
    00092 public slots:
    00093   void slotShowDefaultProgress();
    00094   void slotToggleDefaultProgress();
    00095
    00096 protected slots:
    00097   void slotCanceled();
    00098
    00099 signals:
    00100   void jobCanceled( ProgressItem* );
    00101
    00102 protected:
    00103   void updateVisibility();
    00104
    00105   // ids that uniquely identify this progress item
    00106   QCString m_sAppId;
    00107   int m_iJobId;
    00108
    00109   // whether shown or not (it is hidden if a rename dialog pops up for the same job)
    00110   bool m_visible;
    00111   bool m_defaultProgressVisible;
    00112
    00113   // parent listview
    00114   ListProgress *listProgress;
    00115
    00116   // associated default progress dialog
    00117   KIO::DefaultProgress *defaultProgress;
    00118
    00119   // we store these values for calculation of totals ( for statusbar )
    00120   KIO::filesize_t m_iTotalSize;
    00121   unsigned long m_iTotalFiles;
    00122   KIO::filesize_t m_iProcessedSize;
    00123   unsigned long m_iProcessedFiles;
    00124   unsigned long m_iSpeed;
    00125   QTime m_remainingTime;
    00126   QTimer m_showTimer;
    00127 };
    00128
    00129
    00134 class ListProgress : public KListView {
    00135
    00136   Q_OBJECT
    00137
    00138 public:
    00139
    00140   ListProgress (QWidget *parent = 0, const char *name = 0 );
    00141
    00142   virtual ~ListProgress();
    00143
    00147   enum ListProgressFields {
    00148     TB_OPERATION = 0,
    00149     TB_LOCAL_FILENAME = 1,
    00150     TB_RESUME = 2,
    00151     TB_COUNT = 3,
    00152     TB_PROGRESS = 4,
    00153     TB_TOTAL = 5,
    00154     TB_SPEED = 6,
    00155     TB_REMAINING_TIME = 7,
    00156     TB_ADDRESS = 8
    00157   };
    00158
    00159   friend class ProgressItem;
    00160
    00161 protected:
    00162
    00163   void readConfig();
    00164   void writeConfig();
    00165
    00166   // ListView IDs
    00167   int lv_operation, lv_filename, lv_resume, lv_count, lv_progress;
    00168   int lv_size, lv_speed, lv_remaining, lv_url;
    00169 };
    00170
    00171
    00186 class UIServer : public KMainWindow, public DCOPObject {
    00187
    00188   K_DCOP
    00189   Q_OBJECT
    00190
    00191 public:
    00192
    00193   UIServer();
    00194   virtual ~UIServer();
    00195
    00196 k_dcop:
    00197
    00207   int newJob( QCString appId, bool showProgress );
    00208
    00209   ASYNC jobFinished( int id );
    00210
    00211   ASYNC totalSize( int id, unsigned long size );
    00212   ASYNC totalSize64( int id, KIO::filesize_t size );
    00213   ASYNC totalFiles( int id, unsigned long files );
    00214   ASYNC totalDirs( int id, unsigned long dirs );
    00215
    00216   ASYNC processedSize( int id, unsigned long bytes );
    00217   ASYNC processedSize64( int id, KIO::filesize_t bytes );
    00218   ASYNC processedFiles( int id, unsigned long files );
    00219   ASYNC processedDirs( int id, unsigned long dirs );
    00220
    00221   ASYNC percent( int id, unsigned long ipercent );
    00222   ASYNC speed( int id, unsigned long bytes_per_second );
    00223   ASYNC infoMessage( int id, const QString & msg );
    00224
    00225   ASYNC copying( int id, KURL from, KURL to );
    00226   ASYNC moving( int id, KURL from, KURL to );
    00227   ASYNC deleting( int id, KURL url );
    00228   ASYNC transferring( int id, KURL url );
    00229   ASYNC creatingDir( int id, KURL dir );
    00230   ASYNC stating( int id, KURL url );
    00231
    00232   ASYNC mounting( int id, QString dev, QString point );
    00233   ASYNC unmounting( int id, QString point );
    00234
    00235   ASYNC canResume( int id, unsigned long offset );
    00236   ASYNC canResume64( int id, KIO::filesize_t offset );
    00237
    00243   QByteArray openPassDlg( const KIO::AuthInfo &info );
    00244
    00261   int messageBox( int id, int type, const QString &text, const QString &caption,
    00262                   const QString &buttonYes, const QString &buttonNo );
    00263
    00269   QByteArray open_RenameDlg64( int id,
    00270                              const QString & caption,
    00271                              const QString& src, const QString & dest,
    00272                              int /* KIO::RenameDlg_Mode */ mode,
    00273                              KIO::filesize_t sizeSrc,
    00274                              KIO::filesize_t sizeDest,
    00275                              unsigned long /* time_t */ ctimeSrc,
    00276                              unsigned long /* time_t */ ctimeDest,
    00277                              unsigned long /* time_t */ mtimeSrc,
    00278                              unsigned long /* time_t */ mtimeDest
    00279                              );
    00285   QByteArray open_RenameDlg( int id,
    00286                              const QString & caption,
    00287                              const QString& src, const QString & dest,
    00288                              int /* KIO::RenameDlg_Mode */ mode,
    00289                              unsigned long sizeSrc,
    00290                              unsigned long sizeDest,
    00291                              unsigned long /* time_t */ ctimeSrc,
    00292                              unsigned long /* time_t */ ctimeDest,
    00293                              unsigned long /* time_t */ mtimeSrc,
    00294                              unsigned long /* time_t */ mtimeDest
    00295                              );
    00296
    00302   int open_SkipDlg( int id,
    00303                     int /*bool*/ multi,
    00304                     const QString & error_text );
    00305
    00309   void setListMode( bool list );
    00310
    00315   void setJobVisible( int id, bool visible );
    00316
    00320   void showSSLInfoDialog(const QString &url, const KIO::MetaData &data);
    00321
    00322   /*
    00323    * Show an SSL Certificate Selection Dialog
    00324    */
    00325   KSSLCertDlgRet showSSLCertDialog(const QString& host, const QStringList& certList);
    00326
    00327 protected slots:
    00328
    00329   void slotUpdate();
    00330
    00331   void cancelCurrent();
    00332
    00333   void slotToggleDefaultProgress( QListViewItem * );
    00334   void slotSelection();
    00335
    00336   void slotJobCanceled( ProgressItem * );
    00337
    00338 protected:
    00339
    00340   ProgressItem* findItem( int id );
    00341
    00342   void closeEvent( QCloseEvent * );
    00343
    00344   void setItemVisible( ProgressItem * item, bool visible );
    00345
    00346   QTimer* updateTimer;
    00347   ListProgress* listProgress;
    00348
    00349   KToolBar::BarPosition toolbarPos;
    00350   QString properties;
    00351
    00352   void readSettings();
    00353
    00354 private:
    00355
    00356   void killJob( QCString observerAppId, int progressId );
    00357
    00358   bool m_bShowList;
    00359
    00360   // true if there's a new job that hasn't been shown yet.
    00361   bool m_bUpdateNewJob;
    00362
    00363   static int s_jobId;
    00364 };
    00365
    00366 // -*- mode: c++; c-basic-offset: 2 -*-
    00367 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:43 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001