kio Library API Documentation

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 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 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 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); 00353 00354 /* 00355 * Show an SSL Certificate Selection Dialog 00356 */ 00357 KSSLCertDlgRet showSSLCertDialog(const QString& host, const QStringList& certList); 00358 00359 public slots: 00360 void slotConfigure(); 00361 void slotRemoveSystemTrayIcon(); 00362 protected slots: 00363 00364 void slotUpdate(); 00365 void slotQuit(); 00366 00367 void slotCancelCurrent(); 00368 00369 void slotToggleDefaultProgress( QListViewItem * ); 00370 void slotSelection(); 00371 00372 void slotJobCanceled( ProgressItem * ); 00373 void slotApplyConfig(); 00374 void slotShowContextMenu(KListView*, QListViewItem *item, const QPoint& pos); 00375 00376 protected: 00377 00378 ProgressItem* findItem( int id ); 00379 00380 virtual void resizeEvent(QResizeEvent* e); 00381 virtual bool queryClose(); 00382 00383 void setItemVisible( ProgressItem * item, bool visible ); 00384 00385 QTimer* updateTimer; 00386 ListProgress* listProgress; 00387 00388 KToolBar::BarPosition toolbarPos; 00389 QString properties; 00390 00391 void applySettings(); 00392 void readSettings(); 00393 void writeSettings(); 00394 private: 00395 00396 void killJob( QCString observerAppId, int progressId ); 00397 00398 int m_initWidth; 00399 int m_initHeight; 00400 int m_idCancelItem; 00401 bool m_bShowList; 00402 bool m_showStatusBar; 00403 bool m_showToolBar; 00404 bool m_keepListOpen; 00405 bool m_showSystemTray; 00406 bool m_shuttingDown; 00407 00408 // true if there's a new job that hasn't been shown yet. 00409 bool m_bUpdateNewJob; 00410 ProgressConfigDialog *m_configDialog; 00411 QPopupMenu* m_contextMenu; 00412 UIServerSystemTray *m_systemTray; 00413 00414 static int s_jobId; 00415 friend class no_bogus_warning_from_gcc; 00416 }; 00417 00418 // -*- mode: c++; c-basic-offset: 2 -*- 00419 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:29:37 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003