• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

uiserver.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, 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   unsigned int remainingSeconds() { return m_remainingSeconds; }
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   int m_remainingSeconds;
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 
00294   int messageBox( int id, int type, const QString &text, const QString &caption,
00295                   const QString &buttonYes, const QString &buttonNo );
00296 
00302   QByteArray open_RenameDlg64( int id,
00303                              const QString & caption,
00304                              const QString& src, const QString & dest,
00305                              int /* KIO::RenameDlg_Mode */ mode,
00306                              KIO::filesize_t sizeSrc,
00307                              KIO::filesize_t sizeDest,
00308                              unsigned long /* time_t */ ctimeSrc,
00309                              unsigned long /* time_t */ ctimeDest,
00310                              unsigned long /* time_t */ mtimeSrc,
00311                              unsigned long /* time_t */ mtimeDest
00312                              );
00318   QByteArray open_RenameDlg( int id,
00319                              const QString & caption,
00320                              const QString& src, const QString & dest,
00321                              int /* KIO::RenameDlg_Mode */ mode,
00322                              unsigned long sizeSrc,
00323                              unsigned long sizeDest,
00324                              unsigned long /* time_t */ ctimeSrc,
00325                              unsigned long /* time_t */ ctimeDest,
00326                              unsigned long /* time_t */ mtimeSrc,
00327                              unsigned long /* time_t */ mtimeDest
00328                              );
00329 
00335   int open_SkipDlg( int id,
00336                     int /*bool*/ multi,
00337                     const QString & error_text );
00338 
00342   void setListMode( bool list );
00343 
00348   void setJobVisible( int id, bool visible );
00349 
00353   void showSSLInfoDialog(const QString &url, const KIO::MetaData &data, int mainwindow);
00354 
00358   void showSSLInfoDialog(const QString &url, const KIO::MetaData &data);
00359 
00360   /*
00361    * Show an SSL Certificate Selection Dialog
00362    */
00363   KSSLCertDlgRet showSSLCertDialog(const QString& host, const QStringList& certList, int mainwindow);
00364 
00365   /*
00366    * @deprecated
00367    */
00368   KSSLCertDlgRet showSSLCertDialog(const QString& host, const QStringList& certList);
00369 
00370 public slots:
00371   void slotConfigure();
00372   void slotRemoveSystemTrayIcon();
00373 protected slots:
00374 
00375   void slotUpdate();
00376   void slotQuit();
00377 
00378   void slotCancelCurrent();
00379 
00380   void slotToggleDefaultProgress( QListViewItem * );
00381   void slotSelection();
00382 
00383   void slotJobCanceled( ProgressItem * );
00384   void slotApplyConfig();
00385   void slotShowContextMenu(KListView*, QListViewItem *item, const QPoint& pos);
00386 
00387 protected:
00388 
00389   ProgressItem* findItem( int id );
00390 
00391   virtual void resizeEvent(QResizeEvent* e);
00392   virtual bool queryClose();
00393 
00394   void setItemVisible( ProgressItem * item, bool visible );
00395 
00396   QTimer* updateTimer;
00397   ListProgress* listProgress;
00398 
00399   KToolBar::BarPosition toolbarPos;
00400   QString properties;
00401 
00402   void applySettings();
00403   void readSettings();
00404   void writeSettings();
00405 private:
00406 
00407   void killJob( QCString observerAppId, int progressId );
00408 
00409   int m_initWidth;
00410   int m_initHeight;
00411   int m_idCancelItem;
00412   bool m_bShowList;
00413   bool m_showStatusBar;
00414   bool m_showToolBar;
00415   bool m_keepListOpen;
00416   bool m_showSystemTray;
00417   bool m_shuttingDown;
00418 
00419   // true if there's a new job that hasn't been shown yet.
00420   bool m_bUpdateNewJob;
00421   ProgressConfigDialog *m_configDialog;
00422   QPopupMenu* m_contextMenu;
00423   UIServerSystemTray *m_systemTray;
00424 
00425   static int s_jobId;
00426   friend class no_bogus_warning_from_gcc;
00427 };
00428 
00429 // -*- mode: c++; c-basic-offset: 2 -*-
00430 #endif

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal