diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:25:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:25:18 +0000 |
commit | aa3a1ca934bc541bddd3fa136a85f106f7da266e (patch) | |
tree | 9ad0b795aed8fa4ac30c2fe0fd1aacb8175714c0 /kdat/Node.cpp | |
parent | b10cf7066791a2f362495890cd50c984e8025412 (diff) | |
download | tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.tar.gz tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1157635 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdat/Node.cpp')
-rw-r--r-- | kdat/Node.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/kdat/Node.cpp b/kdat/Node.cpp index 828ad69..7e42855 100644 --- a/kdat/Node.cpp +++ b/kdat/Node.cpp @@ -20,9 +20,9 @@ #include <sys/stat.h> #include <unistd.h> -#include <qdir.h> -#include <qpainter.h> -#include <qstyle.h> +#include <tqdir.h> +#include <tqpainter.h> +#include <tqstyle.h> #include <kapplication.h> #include <kdebug.h> @@ -40,7 +40,7 @@ #include "Node.moc" -Node::Node( int type, const QString & text, const QPixmap& pixmap ) +Node::Node( int type, const TQString & text, const TQPixmap& pixmap ) : KTreeViewItem( text, pixmap ), _type( type ) { @@ -132,7 +132,7 @@ void Node::selected() KDatMainWindow::getInstance()->hideInfo(); } -void Node::popupMenu( const QPoint& ) +void Node::popupMenu( const TQPoint& ) { } @@ -160,7 +160,7 @@ bool TapeNode::validate() } // Add/update existing archives. - QPtrListIterator<Archive> i( _tape->getChildren() ); + TQPtrListIterator<Archive> i( _tape->getChildren() ); ArchiveNode* n; for ( ; i.current(); ++i ) { n = findArchiveNode( i.current() ); @@ -215,7 +215,7 @@ void TapeNode::expanding( bool expand ) return; } - QPtrListIterator<Archive> f( _tape->getChildren() ); + TQPtrListIterator<Archive> f( _tape->getChildren() ); for ( ; f.current(); ++f ) { insertNode( new ArchiveNode( f.current() ) ); } @@ -226,7 +226,7 @@ void TapeNode::selected() KDatMainWindow::getInstance()->showTapeInfo( _tape ); } -void TapeNode::popupMenu( const QPoint& p ) +void TapeNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupTapeMenu( p ); } @@ -284,7 +284,7 @@ void ArchiveNode::expanding( bool expand ) return; } - QPtrListIterator<File> f( _archive->getChildren() ); + TQPtrListIterator<File> f( _archive->getChildren() ); for ( ; f.current(); ++f ) { if ( f.current()->getName()[f.current()->getName().length()-1] == '/' ) { insertNode( new TapeDirectoryNode( f.current() ) ); @@ -299,7 +299,7 @@ void ArchiveNode::selected() KDatMainWindow::getInstance()->showArchiveInfo( _archive ); } -void ArchiveNode::popupMenu( const QPoint& p ) +void ArchiveNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupArchiveMenu( p ); } @@ -342,7 +342,7 @@ void TapeDirectoryNode::expanding( bool expand ) return; } - QPtrListIterator<File> f( _file->getChildren() ); + TQPtrListIterator<File> f( _file->getChildren() ); for ( ; f.current(); ++f ) { if ( f.current()->getName()[f.current()->getName().length()-1] == '/' ) { insertNode( new TapeDirectoryNode( f.current() ) ); @@ -399,7 +399,7 @@ void TapeFileNode::selected() KDatMainWindow::getInstance()->showTapeFileInfo( _file ); } -SelectableNode::SelectableNode( int type, const QString & text, const QPixmap& pixmap, int state ) +SelectableNode::SelectableNode( int type, const TQString & text, const TQPixmap& pixmap, int state ) : Node( type, text, pixmap ), _state( state ) { @@ -463,7 +463,7 @@ void SelectableNode::doSetSelected( bool select ) } } -const QPixmap* SelectableNode::getSelectPixmap() const +const TQPixmap* SelectableNode::getSelectPixmap() const { switch ( _state ) { case SelAll: @@ -480,7 +480,7 @@ const QPixmap* SelectableNode::getSelectPixmap() const } } -bool SelectableNode::mousePressEvent( const QPoint& point ) +bool SelectableNode::mousePressEvent( const TQPoint& point ) { if ( _selectRect.contains( point ) ) { switch ( _state ) { @@ -502,7 +502,7 @@ bool SelectableNode::mousePressEvent( const QPoint& point ) } } -void SelectableNode::paint( QPainter* p, int indent, const QColorGroup& cg, +void SelectableNode::paint( TQPainter* p, int indent, const TQColorGroup& cg, bool highlighted ) const { assert(getParent() != 0); /* can't paint root item */ @@ -526,7 +526,7 @@ void SelectableNode::paint( QPainter* p, int indent, const QColorGroup& cg, paintExpandButton(p, indent, cellHeight); } - const QPixmap* pm = getSelectPixmap(); + const TQPixmap* pm = getSelectPixmap(); p->drawPixmap( indent, ( height() - pm->height() ) / 2, *pm ); _selectRect.setRect( indent, ( height() - pm->height() ) / 2, 12, 12 ); @@ -541,15 +541,15 @@ void SelectableNode::paint( QPainter* p, int indent, const QColorGroup& cg, p->restore(); } -void SelectableNode::paintText( QPainter* p, int indent, int cellHeight, - const QColorGroup& cg, bool highlighted ) const +void SelectableNode::paintText( TQPainter* p, int indent, int cellHeight, + const TQColorGroup& cg, bool highlighted ) const { int textX = indent + 12 + 4 + pixmap.width() + 4; int textY = cellHeight - ((cellHeight - p->fontMetrics().ascent() - p->fontMetrics().leading()) / 2); if (highlighted) { paintHighlight(p, indent, cg, owner->hasFocus(), - (Qt::GUIStyle)owner->style().styleHint(QStyle::SH_GUIStyle)); // Qt3 doesn't make this easy ;) + (Qt::GUIStyle)owner->style().styleHint(TQStyle::SH_GUIStyle)); // Qt3 doesn't make this easy ;) p->setPen(cg.base()); p->setBackgroundColor(cg.text()); } @@ -560,22 +560,22 @@ void SelectableNode::paintText( QPainter* p, int indent, int cellHeight, p->drawText(textX, textY, text); } -int SelectableNode::width( int indent, const QFontMetrics& fm ) const +int SelectableNode::width( int indent, const TQFontMetrics& fm ) const { int maxWidth = pixmap.width(); maxWidth += (4 + 12 + 4 + fm.width(text)); return maxWidth == 0 ? -1 : indent + maxWidth + 3; } -QRect SelectableNode::textBoundingRect(int indent) const +TQRect SelectableNode::textBoundingRect(int indent) const { - const QFontMetrics& fm = owner->fontMetrics(); + const TQFontMetrics& fm = owner->fontMetrics(); int cellHeight = height(fm); int rectX = indent + 12 + 4 + pixmap.width() + 3; int rectY = (cellHeight - fm.ascent() - fm.leading()) / 2 + 2; int rectW = fm.width(text) + 1; int rectH = fm.ascent() + fm.leading(); - return QRect(rectX, rectY, rectW, rectH); + return TQRect(rectX, rectY, rectW, rectH); } bool SelectableNode::isType( int type ) @@ -610,7 +610,7 @@ void SelectableNode::setSelected( bool select ) KDatMainWindow::getInstance()->configureUI( TapeManager::instance()->getMountedTape() ); } -RangeableNode::RangeableNode( int type, const QString & text, const QPixmap& pixmap, int state ) +RangeableNode::RangeableNode( int type, const TQString & text, const TQPixmap& pixmap, int state ) : SelectableNode( type, text, pixmap, state ) { } @@ -636,7 +636,7 @@ Archive* MountedArchiveNode::getArchive() return _archive; } -const QPtrList<Range>& MountedArchiveNode::getRanges() +const TQPtrList<Range>& MountedArchiveNode::getRanges() { return _archive->getRanges(); } @@ -684,7 +684,7 @@ void MountedArchiveNode::expanding( bool expand ) return; } - QPtrListIterator<File> f( _archive->getChildren() ); + TQPtrListIterator<File> f( _archive->getChildren() ); for ( ; f.current(); ++f ) { if ( f.current()->getName()[f.current()->getName().length()-1] == '/' ) { insertNode( new MountedTapeDirectoryNode( f.current(), _state == SelSome ? SelNone : _state ) ); @@ -699,7 +699,7 @@ void MountedArchiveNode::selected() KDatMainWindow::getInstance()->showArchiveInfo( _archive ); } -void MountedArchiveNode::popupMenu( const QPoint& p ) +void MountedArchiveNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupMountedArchiveMenu( p ); } @@ -726,7 +726,7 @@ File* MountedTapeDirectoryNode::getFile() return _file; } -QString MountedTapeDirectoryNode::getFullPath() +TQString MountedTapeDirectoryNode::getFullPath() { if ( _fullPath.length() == 0 ) { _fullPath = getText() + "/"; @@ -739,7 +739,7 @@ QString MountedTapeDirectoryNode::getFullPath() return _fullPath; } -const QPtrList<Range>& MountedTapeDirectoryNode::getRanges() +const TQPtrList<Range>& MountedTapeDirectoryNode::getRanges() { return _file->getRanges(); } @@ -784,7 +784,7 @@ void MountedTapeDirectoryNode::expanding( bool expand ) return; } - QPtrListIterator<File> f( _file->getChildren() ); + TQPtrListIterator<File> f( _file->getChildren() ); for ( ; f.current(); ++f ) { if ( f.current()->getName()[f.current()->getName().length()-1] == '/' ) { insertNode( new MountedTapeDirectoryNode( f.current(), _state == SelSome ? SelNone : _state ) ); @@ -809,7 +809,7 @@ void MountedTapeDirectoryNode::selected() KDatMainWindow::getInstance()->showTapeFileInfo( _file ); } -void MountedTapeDirectoryNode::popupMenu( const QPoint& p ) +void MountedTapeDirectoryNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupMountedTapeFileMenu( p ); } @@ -832,7 +832,7 @@ File* MountedTapeFileNode::getFile() return _file; } -QString MountedTapeFileNode::getFullPath() +TQString MountedTapeFileNode::getFullPath() { if ( _fullPath.length() == 0 ) { _fullPath = getText(); @@ -845,7 +845,7 @@ QString MountedTapeFileNode::getFullPath() return _fullPath; } -const QPtrList<Range>& MountedTapeFileNode::getRanges() +const TQPtrList<Range>& MountedTapeFileNode::getRanges() { return _file->getRanges(); } @@ -886,12 +886,12 @@ void MountedTapeFileNode::selected() KDatMainWindow::getInstance()->showTapeFileInfo( _file ); } -void MountedTapeFileNode::popupMenu( const QPoint& p ) +void MountedTapeFileNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupMountedTapeFileMenu( p ); } -ArchiveableNode::ArchiveableNode( int type, const QString & text, const QPixmap& pixmap, int state ) +ArchiveableNode::ArchiveableNode( int type, const TQString & text, const TQPixmap& pixmap, int state ) : SelectableNode( type, text, pixmap, state ) { } @@ -912,7 +912,7 @@ RootNode::RootNode() setDelayedExpanding( TRUE ); } -QString RootNode::getFullPath() +TQString RootNode::getFullPath() { if ( _fullPath.length() == 0 ) { _fullPath = "/"; @@ -967,7 +967,7 @@ void RootNode::expanding( bool expand ) _mtime = statinfo.st_mtime; } - QDir dir( "/" ); + TQDir dir( "/" ); if ( dir.exists() ) { // Make sure we can read the directory. if ( !dir.isReadable() ) { @@ -976,7 +976,7 @@ void RootNode::expanding( bool expand ) } // Fill in the child's children. - const QFileInfoList* list = dir.entryInfoList( QDir::Hidden | QDir::Files | QDir::Dirs, QDir::Name | QDir::DirsFirst ); + const QFileInfoList* list = dir.entryInfoList( TQDir::Hidden | TQDir::Files | TQDir::Dirs, TQDir::Name | TQDir::DirsFirst ); if ( list ) { QFileInfoListIterator it( *list ); for ( ; it.current(); ++it ) { @@ -1007,19 +1007,19 @@ void RootNode::selected() KDatMainWindow::getInstance()->showFileInfo( "/" ); } -void RootNode::popupMenu( const QPoint& p ) +void RootNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupLocalFileMenu( p ); } -DirectoryNode::DirectoryNode( const QString & text, int state ) +DirectoryNode::DirectoryNode( const TQString & text, int state ) : ArchiveableNode( DirectoryNodeType, text, *ImageCache::instance()->getFolderClosed(), state ), _mtime( -1 ) { setDelayedExpanding( TRUE ); } -QString DirectoryNode::getFullPath() +TQString DirectoryNode::getFullPath() { if ( _fullPath.isEmpty() ) { _fullPath = ((ArchiveableNode*)getParent())->getFullPath() + getText() + "/"; @@ -1042,7 +1042,7 @@ void DirectoryNode::expanding( bool expand ) expand = TRUE; // Construct the full path. - QString path; + TQString path; Node* n; for ( n = this; n->getType() != RootNodeType; n = (Node*)n->getParent() ) { path.prepend( "/" ); @@ -1053,7 +1053,7 @@ void DirectoryNode::expanding( bool expand ) // If we already have some children, check to see if the directory has been modified. if ( childCount() > 0 ) { struct stat statinfo; - if ( stat( QFile::encodeName(path), &statinfo ) < 0 ) { + if ( stat( TQFile::encodeName(path), &statinfo ) < 0 ) { kdError() << "Can't stat " << path << endl; expand = FALSE; return; @@ -1074,7 +1074,7 @@ void DirectoryNode::expanding( bool expand ) } } else { struct stat statinfo; - if ( stat( QFile::encodeName(path), &statinfo ) < 0 ) { + if ( stat( TQFile::encodeName(path), &statinfo ) < 0 ) { kdError() << "Can't stat " << path << endl; expand = FALSE; return; @@ -1083,7 +1083,7 @@ void DirectoryNode::expanding( bool expand ) _mtime = statinfo.st_mtime; } - QDir dir( path ); + TQDir dir( path ); if ( dir.exists() ) { // Make sure we can read the directory. if ( !dir.isReadable() ) { @@ -1092,7 +1092,7 @@ void DirectoryNode::expanding( bool expand ) } // Fill in the child's children. - const QFileInfoList* list = dir.entryInfoList( QDir::Hidden | QDir::Files | QDir::Dirs, QDir::Name | QDir::DirsFirst ); + const QFileInfoList* list = dir.entryInfoList( TQDir::Hidden | TQDir::Files | TQDir::Dirs, TQDir::Name | TQDir::DirsFirst ); if ( list ) { QFileInfoListIterator it( *list ); for ( ; it.current(); ++it ) { @@ -1121,7 +1121,7 @@ void DirectoryNode::collapsed() void DirectoryNode::selected() { // Construct the full path. - QString path; + TQString path; Node* n; for ( n = this; n->getType() != RootNodeType; n = (Node*)n->getParent() ) { path.prepend( "/" ); @@ -1133,17 +1133,17 @@ void DirectoryNode::selected() KDatMainWindow::getInstance()->showFileInfo( path ); } -void DirectoryNode::popupMenu( const QPoint& p ) +void DirectoryNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupLocalFileMenu( p ); } -FileNode::FileNode( const QString & text, int state ) +FileNode::FileNode( const TQString & text, int state ) : ArchiveableNode( FileNodeType, text, *ImageCache::instance()->getFile(), state ) { } -QString FileNode::getFullPath() +TQString FileNode::getFullPath() { if ( _fullPath.isEmpty() ) { _fullPath = ((ArchiveableNode*)getParent())->getFullPath() + getText(); @@ -1164,7 +1164,7 @@ bool FileNode::isType( int type ) void FileNode::selected() { // Construct the full path. - QString path; + TQString path; Node* n; for ( n = this; n->getType() != RootNodeType; n = (Node*)n->getParent() ) { path.prepend( "/" ); @@ -1176,7 +1176,7 @@ void FileNode::selected() KDatMainWindow::getInstance()->showFileInfo( path ); } -void FileNode::popupMenu( const QPoint& p ) +void FileNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupLocalFileMenu( p ); } @@ -1186,9 +1186,9 @@ TapeDriveNode::TapeDriveNode() { setDelayedExpanding( TRUE ); - connect( TapeManager::instance(), SIGNAL( sigTapeMounted() ) , this, SLOT( slotTapeMounted() ) ); - connect( TapeManager::instance(), SIGNAL( sigTapeUnmounted() ) , this, SLOT( slotTapeUnmounted() ) ); - connect( TapeManager::instance(), SIGNAL( sigTapeModified( Tape* ) ), this, SLOT( slotTapeModified( Tape* ) ) ); + connect( TapeManager::instance(), TQT_SIGNAL( sigTapeMounted() ) , this, TQT_SLOT( slotTapeMounted() ) ); + connect( TapeManager::instance(), TQT_SIGNAL( sigTapeUnmounted() ) , this, TQT_SLOT( slotTapeUnmounted() ) ); + connect( TapeManager::instance(), TQT_SIGNAL( sigTapeModified( Tape* ) ), this, TQT_SLOT( slotTapeModified( Tape* ) ) ); } bool TapeDriveNode::isType( int type ) @@ -1214,7 +1214,7 @@ void TapeDriveNode::expanding( bool expand ) return; } - QPtrListIterator<Archive> f( TapeManager::instance()->getMountedTape()->getChildren() ); + TQPtrListIterator<Archive> f( TapeManager::instance()->getMountedTape()->getChildren() ); for ( ; f.current(); ++f ) { insertNode( new MountedArchiveNode( f.current() ) ); } @@ -1229,7 +1229,7 @@ void TapeDriveNode::selected() } } -void TapeDriveNode::popupMenu( const QPoint& p ) +void TapeDriveNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupTapeDriveMenu( p ); } @@ -1283,7 +1283,7 @@ void TapeDriveNode::slotTapeModified( Tape* tape ) } // Add/update existing archives. - QPtrListIterator<Archive> i( tape->getChildren() ); + TQPtrListIterator<Archive> i( tape->getChildren() ); MountedArchiveNode* n; for ( ; i.current(); ++i ) { n = findArchiveNode( i.current() ); @@ -1336,9 +1336,9 @@ TapeIndexRootNode::TapeIndexRootNode() { setDelayedExpanding( TRUE ); - connect( TapeManager::instance(), SIGNAL( sigTapeAdded( Tape* ) ) , this, SLOT( slotTapeAdded( Tape* ) ) ); - connect( TapeManager::instance(), SIGNAL( sigTapeRemoved( Tape* ) ) , this, SLOT( slotTapeRemoved( Tape* ) ) ); - connect( TapeManager::instance(), SIGNAL( sigTapeModified( Tape* ) ), this, SLOT( slotTapeModified( Tape* ) ) ); + connect( TapeManager::instance(), TQT_SIGNAL( sigTapeAdded( Tape* ) ) , this, TQT_SLOT( slotTapeAdded( Tape* ) ) ); + connect( TapeManager::instance(), TQT_SIGNAL( sigTapeRemoved( Tape* ) ) , this, TQT_SLOT( slotTapeRemoved( Tape* ) ) ); + connect( TapeManager::instance(), TQT_SIGNAL( sigTapeModified( Tape* ) ), this, TQT_SLOT( slotTapeModified( Tape* ) ) ); } bool TapeIndexRootNode::isType( int type ) @@ -1358,8 +1358,8 @@ void TapeIndexRootNode::expanding( bool expand ) return; } - QStringList list = TapeManager::instance()->getTapeIDs(); - QStringList::Iterator i = list.begin(); + TQStringList list = TapeManager::instance()->getTapeIDs(); + TQStringList::Iterator i = list.begin(); for ( ; i != list.end(); ++i ) { Tape* tape = TapeManager::instance()->findTape( *i ); if ( tape ) { @@ -1461,7 +1461,7 @@ void BackupProfileNode::selected() KDatMainWindow::getInstance()->showBackupProfileInfo( _backupProfile ); } -void BackupProfileNode::popupMenu( const QPoint& p ) +void BackupProfileNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupBackupProfileMenu( p ); } @@ -1471,12 +1471,12 @@ BackupProfileRootNode::BackupProfileRootNode() { setDelayedExpanding( TRUE ); - connect( BackupProfileManager::instance(), SIGNAL( sigBackupProfileAdded( BackupProfile* ) ) , - this, SLOT( slotBackupProfileAdded( BackupProfile* ) ) ); - connect( BackupProfileManager::instance(), SIGNAL( sigBackupProfileRemoved( BackupProfile* ) ) , - this, SLOT( slotBackupProfileRemoved( BackupProfile* ) ) ); - connect( BackupProfileManager::instance(), SIGNAL( sigBackupProfileModified( BackupProfile* ) ), - this, SLOT( slotBackupProfileModified( BackupProfile* ) ) ); + connect( BackupProfileManager::instance(), TQT_SIGNAL( sigBackupProfileAdded( BackupProfile* ) ) , + this, TQT_SLOT( slotBackupProfileAdded( BackupProfile* ) ) ); + connect( BackupProfileManager::instance(), TQT_SIGNAL( sigBackupProfileRemoved( BackupProfile* ) ) , + this, TQT_SLOT( slotBackupProfileRemoved( BackupProfile* ) ) ); + connect( BackupProfileManager::instance(), TQT_SIGNAL( sigBackupProfileModified( BackupProfile* ) ), + this, TQT_SLOT( slotBackupProfileModified( BackupProfile* ) ) ); } void BackupProfileRootNode::setSelected( BackupProfile* pBackupProfile ) @@ -1512,8 +1512,8 @@ void BackupProfileRootNode::expanding( bool expand ) return; } - QStringList list = BackupProfileManager::instance()->getBackupProfileNames(); - QStringList::Iterator i = list.begin(); + TQStringList list = BackupProfileManager::instance()->getBackupProfileNames(); + TQStringList::Iterator i = list.begin(); for ( ; i != list.end(); ++i ) { BackupProfile* backupProfile = BackupProfileManager::instance()->findBackupProfile( *i ); if ( backupProfile ) { @@ -1532,7 +1532,7 @@ void BackupProfileRootNode::collapsed() setPixmap( *ImageCache::instance()->getFolderClosed() ); } -void BackupProfileRootNode::popupMenu( const QPoint& p ) +void BackupProfileRootNode::popupMenu( const TQPoint& p ) { KDatMainWindow::getInstance()->popupBackupProfileRootMenu( p ); } |