# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | 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 class KSqueezedTextLabel;
    00037 class ProgressItem;
    00038 class UIServer;
    00039
    00040 namespace KIO {
    00041   class Job;
    00042   class DefaultProgress;
    00043 }
    00044
    00045
    00046 struct ListProgressColumnConfig
    00047 {
    00048    QString title;
    00049    int index;
    00050    int width;
    00051    bool enabled;
    00052 };
    00053
    00058 class KIO_EXPORT ListProgress : public KListView {
    00059
    00060   Q_OBJECT
    00061
    00062 public:
    00063
    00064   ListProgress (QWidget *parent = 0, const char *name = 0 );
    00065
    00066   virtual ~ListProgress();
    00067
    00071   enum ListProgressFields {
    00072     TB_OPERATION = 0,
    00073     TB_LOCAL_FILENAME = 1,
    00074     TB_RESUME = 2,
    00075     TB_COUNT = 3,     //lv_count
    00076     TB_PROGRESS = 4,  // lv_progress
    00077     TB_TOTAL = 5,
    00078     TB_SPEED = 6,
    00079     TB_REMAINING_TIME = 7,
    00080     TB_ADDRESS = 8,
    00081     TB_MAX = 9
    00082   };
    00083
    00084   friend class ProgressItem;
    00085   friend class UIServer;
    00086 protected slots:
    00087   void columnWidthChanged(int column);
    00088 protected:
    00089
    00090   void writeSettings();
    00091   void readSettings();
    00092   void applySettings();
    00093   void createColumns();
    00094
    00095   bool m_showHeader;
    00096   bool m_fixedColumnWidths;
    00097   ListProgressColumnConfig m_lpcc[TB_MAX];
    00098   //hack, alexxx
    00099   KSqueezedTextLabel *m_squeezer;
    00100 };
    00101
    00106 class KIO_EXPORT ProgressItem : public QObject, public QListViewItem {
    00107
    00108   Q_OBJECT
    00109
    00110 public:
    00111   ProgressItem( ListProgress* view, QListViewItem *after, QCString app_id, int job_id,
    00112                 bool showDefault = true );
    00113   ~ProgressItem();
    00114
    00115   QCString appId() { return m_sAppId; }
    00116   int jobId() { return m_iJobId; }
    00117
    00118     bool keepOpen() const;
    00119   void finished();
    00120
    00121   void setVisible( bool visible );
    00122   void setDefaultProgressVisible( bool visible );
    00123   bool isVisible() const { return m_visible; }
    00124
    00125   void setTotalSize( KIO::filesize_t bytes );
    00126   void setTotalFiles( unsigned long files );
    00127   void setTotalDirs( unsigned long dirs );
    00128
    00129   void setProcessedSize( KIO::filesize_t size );
    00130   void setProcessedFiles( unsigned long files );
    00131   void setProcessedDirs( unsigned long dirs );
    00132
    00133   void setPercent( unsigned long percent );
    00134   void setSpeed( unsigned long bytes_per_second );
    00135   void setInfoMessage( const QString & msg );
    00136
    00137   void setCopying( const KURL& from, const KURL& to );
    00138   void setMoving( const KURL& from, const KURL& to );
    00139   void setDeleting( const KURL& url );
    00140   void setTransferring( const KURL& url );
    00141   void setCreatingDir( const KURL& dir );
    00142   void setStating( const KURL& url );
    00143   void setMounting( const QString & dev, const QString & point );
    00144   void setUnmounting( const QString & point );
    00145
    00146   void setCanResume( KIO::filesize_t offset );
    00147
    00148   KIO::filesize_t totalSize() { return m_iTotalSize; }
    00149   unsigned long totalFiles() { return m_iTotalFiles; }
    00150   KIO::filesize_t processedSize() { return m_iProcessedSize; }
    00151   unsigned long processedFiles() { return m_iProcessedFiles; }
    00152   unsigned long speed() { return m_iSpeed; }
    00153   QTime remainingTime() { return m_remainingTime; }
    00154
    00155   const QString& fullLengthAddress() const {return m_fullLengthAddress;}
    00156   void setText(ListProgress::ListProgressFields field, const QString& text);
    00157 public slots:
    00158   void slotShowDefaultProgress();
    00159   void slotToggleDefaultProgress();
    00160
    00161 protected slots:
    00162   void slotCanceled();
    00163
    00164 signals:
    00165   void jobCanceled( ProgressItem* );
    00166
    00167 protected:
    00168   void updateVisibility();
    00169
    00170   // ids that uniquely identify this progress item
    00171   QCString m_sAppId;
    00172   int m_iJobId;
    00173
    00174   // whether shown or not (it is hidden if a rename dialog pops up for the same job)
    00175   bool m_visible;
    00176   bool m_defaultProgressVisible;
    00177
    00178   // parent listview
    00179   ListProgress *listProgress;
    00180
    00181   // associated default progress dialog
    00182   KIO::DefaultProgress *defaultProgress;
    00183
    00184   // we store these values for calculation of totals ( for statusbar )
    00185   KIO::filesize_t m_iTotalSize;
    00186   unsigned long m_iTotalFiles;
    00187   KIO::filesize_t m_iProcessedSize;
    00188   unsigned long m_iProcessedFiles;
    00189   unsigned long m_iSpeed;
    00190   QTime m_remainingTime;
    00191   QTimer m_showTimer;
    00192   QString m_fullLengthAddress;
    00193 };
    00194
    00195 class QResizeEvent;
    00196 class QHideEvent;
    00197 class QShowEvent;
    00198 class ProgressConfigDialog;
    00199 class QPopupMenu;
    00200 class UIServerSystemTray;
    00201
    00217 class KIO_EXPORT UIServer : public KMainWindow, public DCOPObject {
    00218
    00219   K_DCOP
    00220   Q_OBJECT
    00221
    00222   UIServer();
    00223   virtual ~UIServer();
    00224
    00225 public:
    00226    static UIServer* createInstance();
    00227
    00228 k_dcop:
    00229
    00239   int newJob( QCString appId, bool showProgress );
    00240
    00241   ASYNC jobFinished( int id );
    00242
    00243   ASYNC totalSize( int id, unsigned long size );
    00244   ASYNC totalSize64( int id, KIO::filesize_t size );
    00245   ASYNC totalFiles( int id, unsigned long files );
    00246   ASYNC totalDirs( int id, unsigned long dirs );
    00247
    00248   ASYNC processedSize( int id, unsigned long bytes );
    00249   ASYNC processedSize64( int id, KIO::filesize_t bytes );
    00250   ASYNC processedFiles( int id, unsigned long files );
    00251   ASYNC processedDirs( int id, unsigned long dirs );
    00252
    00253   ASYNC percent( int id, unsigned long ipercent );
    00254   ASYNC speed( int id, unsigned long bytes_per_second );
    00255   ASYNC infoMessage( int id, const QString & msg );
    00256
    00257   ASYNC copying( int id, KURL from, KURL to );
    00258   ASYNC moving( int id, KURL from, KURL to );
    00259   ASYNC deleting( int id, KURL url );
    00260   ASYNC transferring( int id, KURL url );
    00261   ASYNC creatingDir( int id, KURL dir );
    00262   ASYNC stating( int id, KURL url );
    00263
    00264   ASYNC mounting( int id, QString dev, QString point );
    00265   ASYNC unmounting( int id, QString point );
    00266
    00267   ASYNC canResume( int id, unsigned long offset );
    00268   ASYNC canResume64( int id, KIO::filesize_t offset );
    00269
    00275   QByteArray openPassDlg( const KIO::AuthInfo &info );
    00276
    00293   int messageBox( int id, int type, const QString &text, const QString &caption,
    00294                   const QString &buttonYes, const QString &buttonNo );
    00295
    00301   QByteArray open_RenameDlg64( int id,
    00302                              const QString & caption,
    00303                              const QString& src, const QString & dest,
    00304                              int /* KIO::RenameDlg_Mode */ mode,
    00305                              KIO::filesize_t sizeSrc,
    00306                              KIO::filesize_t sizeDest,
    00307                              unsigned long /* time_t */ ctimeSrc,
    00308                              unsigned long /* time_t */ ctimeDest,
    00309                              unsigned long /* time_t */ mtimeSrc,
    00310                              unsigned long /* time_t */ mtimeDest
    00311                              );
    00317   QByteArray open_RenameDlg( int id,
    00318                              const QString & caption,
    00319                              const QString& src, const QString & dest,
    00320                              int /* KIO::RenameDlg_Mode */ mode,
    00321                              unsigned long sizeSrc,
    00322                              unsigned long sizeDest,
    00323                              unsigned long /* time_t */ ctimeSrc,
    00324                              unsigned long /* time_t */ ctimeDest,
    00325                              unsigned long /* time_t */ mtimeSrc,
    00326                              unsigned long /* time_t */ mtimeDest
    00327                              );
    00328
    00334   int open_SkipDlg( int id,
    00335                     int /*bool*/ multi,
    00336                     const QString & error_text );
    00337
    00341   void setListMode( bool list );
    00342
    00347   void setJobVisible( int id, bool visible );
    00348
    00352   void showSSLInfoDialog(const QString &url, const KIO::MetaData &data, int mainwindow);
    00353
    00357   void showSSLInfoDialog(const QString &url, const KIO::MetaData &data);
    00358
    00359   /*
    00360    * Show an SSL Certificate Selection Dialog
    00361    */
    00362   KSSLCertDlgRet showSSLCertDialog(const QString& host, const QStringList& certList, int mainwindow);
    00363
    00364   /*
    00365    * @deprecated
    00366    */
    00367   KSSLCertDlgRet showSSLCertDialog(const QString& host, const QStringList& certList);
    00368
    00369 public slots:
    00370   void slotConfigure();
    00371   void slotRemoveSystemTrayIcon();
    00372 protected slots:
    00373
    00374   void slotUpdate();
    00375   void slotQuit();
    00376
    00377   void slotCancelCurrent();
    00378
    00379   void slotToggleDefaultProgress( QListViewItem * );
    00380   void slotSelection();
    00381
    00382   void slotJobCanceled( ProgressItem * );
    00383   void slotApplyConfig();
    00384   void slotShowContextMenu(KListView*, QListViewItem *item, const QPoint& pos);
    00385
    00386 protected:
    00387
    00388   ProgressItem* findItem( int id );
    00389
    00390   virtual void resizeEvent(QResizeEvent* e);
    00391   virtual bool queryClose();
    00392
    00393   void setItemVisible( ProgressItem * item, bool visible );
    00394
    00395   QTimer* updateTimer;
    00396   ListProgress* listProgress;
    00397
    00398   KToolBar::BarPosition toolbarPos;
    00399   QString properties;
    00400
    00401   void applySettings();
    00402   void readSettings();
    00403   void writeSettings();
    00404 private:
    00405
    00406   void killJob( QCString observerAppId, int progressId );
    00407
    00408   int m_initWidth;
    00409   int m_initHeight;
    00410   int m_idCancelItem;
    00411   bool m_bShowList;
    00412   bool m_showStatusBar;
    00413   bool m_showToolBar;
    00414   bool m_keepListOpen;
    00415   bool m_showSystemTray;
    00416   bool m_shuttingDown;
    00417
    00418   // true if there's a new job that hasn't been shown yet.
    00419   bool m_bUpdateNewJob;
    00420   ProgressConfigDialog *m_configDialog;
    00421   QPopupMenu* m_contextMenu;
    00422   UIServerSystemTray *m_systemTray;
    00423
    00424   static int s_jobId;
    00425   friend class no_bogus_warning_from_gcc;
    00426 };
    00427
    00428 // -*- mode: c++; c-basic-offset: 2 -*-
    00429 #endif

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:08 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003