You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
431 lines
12 KiB
431 lines
12 KiB
15 years ago
|
/* This file is part of the KDE libraries
|
||
|
Copyright (C) 2000 Matej Koss <koss@miesto.sk>
|
||
|
David Faure <faure@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License version 2 as published by the Free Software Foundation.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
12 years ago
|
#ifndef __tdeio_uiserver_h__
|
||
|
#define __tdeio_uiserver_h__
|
||
15 years ago
|
|
||
15 years ago
|
#include <tqintdict.h>
|
||
|
#include <tqdatetime.h>
|
||
|
#include <tqtimer.h>
|
||
15 years ago
|
|
||
|
#include <dcopobject.h>
|
||
12 years ago
|
#include <tdeio/global.h>
|
||
|
#include <tdeio/authinfo.h>
|
||
15 years ago
|
#include <kurl.h>
|
||
|
#include <kmainwindow.h>
|
||
|
#include <kdatastream.h>
|
||
|
#include <klistview.h>
|
||
|
#include <ksslcertdlg.h>
|
||
|
|
||
|
class ListProgress;
|
||
|
class KSqueezedTextLabel;
|
||
|
class ProgressItem;
|
||
|
class UIServer;
|
||
|
|
||
12 years ago
|
namespace TDEIO {
|
||
15 years ago
|
class Job;
|
||
|
class DefaultProgress;
|
||
|
}
|
||
|
|
||
|
|
||
|
struct ListProgressColumnConfig
|
||
|
{
|
||
15 years ago
|
TQString title;
|
||
15 years ago
|
int index;
|
||
|
int width;
|
||
|
bool enabled;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* List view in the UIServer.
|
||
|
* @internal
|
||
|
*/
|
||
12 years ago
|
class TDEIO_EXPORT ListProgress : public KListView {
|
||
15 years ago
|
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
|
||
15 years ago
|
ListProgress (TQWidget *parent = 0, const char *name = 0 );
|
||
15 years ago
|
|
||
|
virtual ~ListProgress();
|
||
|
|
||
|
/**
|
||
|
* Field constants
|
||
|
*/
|
||
|
enum ListProgressFields {
|
||
|
TB_OPERATION = 0,
|
||
|
TB_LOCAL_FILENAME = 1,
|
||
|
TB_RESUME = 2,
|
||
|
TB_COUNT = 3, //lv_count
|
||
|
TB_PROGRESS = 4, // lv_progress
|
||
|
TB_TOTAL = 5,
|
||
|
TB_SPEED = 6,
|
||
|
TB_REMAINING_TIME = 7,
|
||
|
TB_ADDRESS = 8,
|
||
|
TB_MAX = 9
|
||
|
};
|
||
|
|
||
|
friend class ProgressItem;
|
||
|
friend class UIServer;
|
||
|
protected slots:
|
||
|
void columnWidthChanged(int column);
|
||
|
protected:
|
||
|
|
||
|
void writeSettings();
|
||
|
void readSettings();
|
||
|
void applySettings();
|
||
|
void createColumns();
|
||
|
|
||
|
bool m_showHeader;
|
||
|
bool m_fixedColumnWidths;
|
||
|
ListProgressColumnConfig m_lpcc[TB_MAX];
|
||
|
//hack, alexxx
|
||
|
KSqueezedTextLabel *m_squeezer;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* One item in the ListProgress
|
||
|
* @internal
|
||
|
*/
|
||
12 years ago
|
class TDEIO_EXPORT ProgressItem : public TQObject, public TQListViewItem {
|
||
15 years ago
|
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
15 years ago
|
ProgressItem( ListProgress* view, TQListViewItem *after, TQCString app_id, int job_id,
|
||
15 years ago
|
bool showDefault = true );
|
||
|
~ProgressItem();
|
||
|
|
||
15 years ago
|
TQCString appId() { return m_sAppId; }
|
||
15 years ago
|
int jobId() { return m_iJobId; }
|
||
|
|
||
|
bool keepOpen() const;
|
||
|
void finished();
|
||
|
|
||
13 years ago
|
void setVisible( bool visible );
|
||
15 years ago
|
void setDefaultProgressVisible( bool visible );
|
||
|
bool isVisible() const { return m_visible; }
|
||
|
|
||
12 years ago
|
void setTotalSize( TDEIO::filesize_t bytes );
|
||
15 years ago
|
void setTotalFiles( unsigned long files );
|
||
|
void setTotalDirs( unsigned long dirs );
|
||
|
|
||
12 years ago
|
void setProcessedSize( TDEIO::filesize_t size );
|
||
15 years ago
|
void setProcessedFiles( unsigned long files );
|
||
|
void setProcessedDirs( unsigned long dirs );
|
||
|
|
||
|
void setPercent( unsigned long percent );
|
||
|
void setSpeed( unsigned long bytes_per_second );
|
||
15 years ago
|
void setInfoMessage( const TQString & msg );
|
||
15 years ago
|
|
||
|
void setCopying( const KURL& from, const KURL& to );
|
||
|
void setMoving( const KURL& from, const KURL& to );
|
||
|
void setDeleting( const KURL& url );
|
||
|
void setTransferring( const KURL& url );
|
||
|
void setCreatingDir( const KURL& dir );
|
||
|
void setStating( const KURL& url );
|
||
15 years ago
|
void setMounting( const TQString & dev, const TQString & point );
|
||
|
void setUnmounting( const TQString & point );
|
||
15 years ago
|
|
||
12 years ago
|
void setCanResume( TDEIO::filesize_t offset );
|
||
15 years ago
|
|
||
12 years ago
|
TDEIO::filesize_t totalSize() { return m_iTotalSize; }
|
||
15 years ago
|
unsigned long totalFiles() { return m_iTotalFiles; }
|
||
12 years ago
|
TDEIO::filesize_t processedSize() { return m_iProcessedSize; }
|
||
15 years ago
|
unsigned long processedFiles() { return m_iProcessedFiles; }
|
||
|
unsigned long speed() { return m_iSpeed; }
|
||
|
unsigned int remainingSeconds() { return m_remainingSeconds; }
|
||
|
|
||
15 years ago
|
const TQString& fullLengthAddress() const {return m_fullLengthAddress;}
|
||
|
void setText(ListProgress::ListProgressFields field, const TQString& text);
|
||
15 years ago
|
public slots:
|
||
|
void slotShowDefaultProgress();
|
||
|
void slotToggleDefaultProgress();
|
||
|
|
||
|
protected slots:
|
||
|
void slotCanceled();
|
||
|
|
||
|
signals:
|
||
|
void jobCanceled( ProgressItem* );
|
||
|
|
||
|
protected:
|
||
|
void updateVisibility();
|
||
|
|
||
|
// ids that uniquely identify this progress item
|
||
15 years ago
|
TQCString m_sAppId;
|
||
15 years ago
|
int m_iJobId;
|
||
|
|
||
|
// whether shown or not (it is hidden if a rename dialog pops up for the same job)
|
||
|
bool m_visible;
|
||
|
bool m_defaultProgressVisible;
|
||
|
|
||
|
// parent listview
|
||
|
ListProgress *listProgress;
|
||
|
|
||
|
// associated default progress dialog
|
||
12 years ago
|
TDEIO::DefaultProgress *defaultProgress;
|
||
15 years ago
|
|
||
|
// we store these values for calculation of totals ( for statusbar )
|
||
12 years ago
|
TDEIO::filesize_t m_iTotalSize;
|
||
15 years ago
|
unsigned long m_iTotalFiles;
|
||
12 years ago
|
TDEIO::filesize_t m_iProcessedSize;
|
||
15 years ago
|
unsigned long m_iProcessedFiles;
|
||
|
unsigned long m_iSpeed;
|
||
|
int m_remainingSeconds;
|
||
15 years ago
|
TQTimer m_showTimer;
|
||
|
TQString m_fullLengthAddress;
|
||
15 years ago
|
};
|
||
|
|
||
14 years ago
|
class TQResizeEvent;
|
||
|
class TQHideEvent;
|
||
|
class TQShowEvent;
|
||
15 years ago
|
class ProgressConfigDialog;
|
||
14 years ago
|
class TQPopupMenu;
|
||
15 years ago
|
class UIServerSystemTray;
|
||
|
|
||
|
/**
|
||
|
* It's purpose is to show progress of IO operations.
|
||
|
* There is only one instance of this window for all jobs.
|
||
|
*
|
||
|
* All IO operations ( jobs ) are displayed in this window, one line per operation.
|
||
|
* User can cancel operations with Cancel button on toolbar.
|
||
|
*
|
||
|
* Double clicking an item in the list opens a small download window ( DefaultProgress ).
|
||
|
*
|
||
|
* @short Graphical server for progress information with an optional all-in-one progress window.
|
||
|
* @author David Faure <faure@kde.org>
|
||
|
* @author Matej Koss <koss@miesto.sk>
|
||
|
*
|
||
|
* @internal
|
||
|
*/
|
||
12 years ago
|
class TDEIO_EXPORT UIServer : public KMainWindow, public DCOPObject {
|
||
15 years ago
|
|
||
|
K_DCOP
|
||
|
Q_OBJECT
|
||
|
|
||
|
UIServer();
|
||
|
virtual ~UIServer();
|
||
|
|
||
|
public:
|
||
|
static UIServer* createInstance();
|
||
|
|
||
|
k_dcop:
|
||
|
|
||
|
/**
|
||
|
* Signal a new job
|
||
|
* @param appId the DCOP application id of the job's parent application
|
||
12 years ago
|
* @see TDEIO::Observer::newJob
|
||
15 years ago
|
* @param showProgress whether to popup the progress for the job.
|
||
12 years ago
|
* Usually true, but may be false when we use tdeio_uiserver for
|
||
15 years ago
|
* other things, like SSL dialogs.
|
||
|
* @return the job id
|
||
|
*/
|
||
15 years ago
|
int newJob( TQCString appId, bool showProgress );
|
||
15 years ago
|
|
||
|
ASYNC jobFinished( int id );
|
||
|
|
||
|
ASYNC totalSize( int id, unsigned long size );
|
||
12 years ago
|
ASYNC totalSize64( int id, TDEIO::filesize_t size );
|
||
15 years ago
|
ASYNC totalFiles( int id, unsigned long files );
|
||
|
ASYNC totalDirs( int id, unsigned long dirs );
|
||
|
|
||
|
ASYNC processedSize( int id, unsigned long bytes );
|
||
12 years ago
|
ASYNC processedSize64( int id, TDEIO::filesize_t bytes );
|
||
15 years ago
|
ASYNC processedFiles( int id, unsigned long files );
|
||
|
ASYNC processedDirs( int id, unsigned long dirs );
|
||
|
|
||
|
ASYNC percent( int id, unsigned long ipercent );
|
||
|
ASYNC speed( int id, unsigned long bytes_per_second );
|
||
15 years ago
|
ASYNC infoMessage( int id, const TQString & msg );
|
||
15 years ago
|
|
||
|
ASYNC copying( int id, KURL from, KURL to );
|
||
|
ASYNC moving( int id, KURL from, KURL to );
|
||
|
ASYNC deleting( int id, KURL url );
|
||
|
ASYNC transferring( int id, KURL url );
|
||
|
ASYNC creatingDir( int id, KURL dir );
|
||
|
ASYNC stating( int id, KURL url );
|
||
|
|
||
15 years ago
|
ASYNC mounting( int id, TQString dev, TQString point );
|
||
|
ASYNC unmounting( int id, TQString point );
|
||
15 years ago
|
|
||
|
ASYNC canResume( int id, unsigned long offset );
|
||
12 years ago
|
ASYNC canResume64( int id, TDEIO::filesize_t offset );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* @deprecated (it blocks other apps).
|
||
12 years ago
|
* Use TDEIO::PasswordDialog::getNameAndPassword instead.
|
||
15 years ago
|
* To be removed in KDE 4.0.
|
||
|
*/
|
||
12 years ago
|
TQByteArray openPassDlg( const TDEIO::AuthInfo &info );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Popup a message box.
|
||
|
* @param id The message identifier.
|
||
|
* @param type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel...
|
||
|
* This enum is defined in slavebase.h, it currently is:
|
||
|
* QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3,
|
||
|
* WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6
|
||
|
* @param text Message string. May contain newlines.
|
||
|
* @param caption Message box title.
|
||
|
* @param buttonYes The text for the first button.
|
||
|
* The default is i18n("&Yes").
|
||
|
* @param buttonNo The text for the second button.
|
||
|
* The default is i18n("&No").
|
||
|
* Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused.
|
||
|
* and for Information, none is used.
|
||
|
* @return a button code, as defined in KMessageBox, or 0 on communication error.
|
||
|
*/
|
||
15 years ago
|
int messageBox( int id, int type, const TQString &text, const TQString &caption,
|
||
|
const TQString &buttonYes, const TQString &buttonNo );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* @deprecated (it blocks other apps).
|
||
12 years ago
|
* Use TDEIO::open_RenameDlg instead.
|
||
15 years ago
|
* To be removed in KDE 4.0.
|
||
|
*/
|
||
15 years ago
|
TQByteArray open_RenameDlg64( int id,
|
||
|
const TQString & caption,
|
||
|
const TQString& src, const TQString & dest,
|
||
12 years ago
|
int /* TDEIO::RenameDlg_Mode */ mode,
|
||
|
TDEIO::filesize_t sizeSrc,
|
||
|
TDEIO::filesize_t sizeDest,
|
||
15 years ago
|
unsigned long /* time_t */ ctimeSrc,
|
||
|
unsigned long /* time_t */ ctimeDest,
|
||
|
unsigned long /* time_t */ mtimeSrc,
|
||
|
unsigned long /* time_t */ mtimeDest
|
||
|
);
|
||
|
/**
|
||
|
* @deprecated (it blocks other apps).
|
||
12 years ago
|
* Use TDEIO::open_RenameDlg instead.
|
||
15 years ago
|
* To be removed in KDE 4.0.
|
||
|
*/
|
||
15 years ago
|
TQByteArray open_RenameDlg( int id,
|
||
|
const TQString & caption,
|
||
|
const TQString& src, const TQString & dest,
|
||
12 years ago
|
int /* TDEIO::RenameDlg_Mode */ mode,
|
||
15 years ago
|
unsigned long sizeSrc,
|
||
|
unsigned long sizeDest,
|
||
|
unsigned long /* time_t */ ctimeSrc,
|
||
|
unsigned long /* time_t */ ctimeDest,
|
||
|
unsigned long /* time_t */ mtimeSrc,
|
||
|
unsigned long /* time_t */ mtimeDest
|
||
|
);
|
||
|
|
||
|
/**
|
||
|
* @deprecated (it blocks other apps).
|
||
12 years ago
|
* Use TDEIO::open_SkipDlg instead.
|
||
15 years ago
|
* To be removed in KDE 4.0.
|
||
|
*/
|
||
|
int open_SkipDlg( int id,
|
||
|
int /*bool*/ multi,
|
||
15 years ago
|
const TQString & error_text );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Switch to or from list mode - called by the kcontrol module
|
||
|
*/
|
||
|
void setListMode( bool list );
|
||
|
|
||
|
/**
|
||
|
* Hide or show a job. Typically, we hide a job while a "skip" or "rename" dialog
|
||
|
* is being shown for this job. This prevents killing it from the uiserver.
|
||
|
*/
|
||
|
void setJobVisible( int id, bool visible );
|
||
|
|
||
|
/**
|
||
|
* Show a SSL Information Dialog
|
||
|
*/
|
||
12 years ago
|
void showSSLInfoDialog(const TQString &url, const TDEIO::MetaData &data, int mainwindow);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* @deprecated
|
||
|
*/
|
||
12 years ago
|
void showSSLInfoDialog(const TQString &url, const TDEIO::MetaData &data);
|
||
15 years ago
|
|
||
|
/*
|
||
|
* Show an SSL Certificate Selection Dialog
|
||
|
*/
|
||
15 years ago
|
KSSLCertDlgRet showSSLCertDialog(const TQString& host, const TQStringList& certList, int mainwindow);
|
||
15 years ago
|
|
||
|
/*
|
||
|
* @deprecated
|
||
|
*/
|
||
15 years ago
|
KSSLCertDlgRet showSSLCertDialog(const TQString& host, const TQStringList& certList);
|
||
15 years ago
|
|
||
|
public slots:
|
||
|
void slotConfigure();
|
||
|
void slotRemoveSystemTrayIcon();
|
||
|
protected slots:
|
||
|
|
||
|
void slotUpdate();
|
||
|
void slotQuit();
|
||
|
|
||
|
void slotCancelCurrent();
|
||
|
|
||
15 years ago
|
void slotToggleDefaultProgress( TQListViewItem * );
|
||
15 years ago
|
void slotSelection();
|
||
|
|
||
|
void slotJobCanceled( ProgressItem * );
|
||
|
void slotApplyConfig();
|
||
15 years ago
|
void slotShowContextMenu(KListView*, TQListViewItem *item, const TQPoint& pos);
|
||
15 years ago
|
|
||
|
protected:
|
||
|
|
||
14 years ago
|
ProgressItem* findItem( int id );
|
||
15 years ago
|
|
||
15 years ago
|
virtual void resizeEvent(TQResizeEvent* e);
|
||
15 years ago
|
virtual bool queryClose();
|
||
|
|
||
|
void setItemVisible( ProgressItem * item, bool visible );
|
||
|
|
||
15 years ago
|
TQTimer* updateTimer;
|
||
15 years ago
|
ListProgress* listProgress;
|
||
|
|
||
|
KToolBar::BarPosition toolbarPos;
|
||
15 years ago
|
TQString properties;
|
||
15 years ago
|
|
||
|
void applySettings();
|
||
|
void readSettings();
|
||
|
void writeSettings();
|
||
|
private:
|
||
|
|
||
15 years ago
|
void killJob( TQCString observerAppId, int progressId );
|
||
15 years ago
|
|
||
|
int m_initWidth;
|
||
|
int m_initHeight;
|
||
|
int m_idCancelItem;
|
||
|
bool m_bShowList;
|
||
|
bool m_showStatusBar;
|
||
|
bool m_showToolBar;
|
||
|
bool m_keepListOpen;
|
||
|
bool m_showSystemTray;
|
||
|
bool m_shuttingDown;
|
||
|
|
||
|
// true if there's a new job that hasn't been shown yet.
|
||
|
bool m_bUpdateNewJob;
|
||
|
ProgressConfigDialog *m_configDialog;
|
||
15 years ago
|
TQPopupMenu* m_contextMenu;
|
||
15 years ago
|
UIServerSystemTray *m_systemTray;
|
||
|
|
||
|
static int s_jobId;
|
||
|
friend class no_bogus_warning_from_gcc;
|
||
|
};
|
||
|
|
||
|
// -*- mode: c++; c-basic-offset: 2 -*-
|
||
|
#endif
|