Source Code (Use browser search to find items of interest.)
Class Index
kdat'TapeDriveNode (./kdeadmin/kdat/Node.h:817)
class TapeDriveNode : public QObject, public Node {
Q_OBJECT
MountedArchiveNode* findArchiveNode( Archive* archive );
public:
/**
* Create a tape drive node.
*/
TapeDriveNode();
/**
* Determine whether the node is an instance of the given node type.
*
* @param type The type to compare against.
*/
virtual bool isType( int type );
/**
* Create child nodes for each archive in the tape index.
*
* @param expand This will always be set to TRUE.
*/
virtual void expanding( bool expand=TRUE );
/**
* This method is called immediately after the node has been selected.
*/
virtual void selected();
/**
* This method is called when the user right-clicks the mouse over the
* node.
*/
virtual void popupMenu( const QPoint& p );
public slots:
/**
* This slot is called when the tape is mounted.
*/
void slotTapeMounted();
/**
* This slot is called when the tape is unmounted.
*/
void slotTapeUnmounted();
/**
* Locate the child associated with the modified tape index, and make sure
* that the displayed information (including all children) is updated.
*
* @param tape A pointer to the tape index that was modified.
*/
void slotTapeModified( Tape* tape );
};
/**
* @short This node represents the root of the tape index subtree.
*/
kdat'TapeDriveNode::TapeDriveNode() (./kdeadmin/kdat/Node.cpp:1181)
TapeDriveNode::TapeDriveNode()
: Node( TapeDriveNodeType, i18n( "<no tape>" ), *ImageCache::instance()->getTapeUnmounted() )
{
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* ) ) );
}
kdat'TapeDriveNode::isType() (./kdeadmin/kdat/Node.cpp:1191)
bool TapeDriveNode::isType( int type )
{
if ( type == TapeDriveNodeType ) {
return TRUE;
} else {
return Node::isType( type );
}
}
kdat'TapeDriveNode::expanding() (./kdeadmin/kdat/Node.cpp:1200)
void TapeDriveNode::expanding( bool expand )
{
if ( !TapeManager::instance()->getMountedTape() ) {
expand = FALSE;
return;
}
expand = TRUE;
if ( childCount() > 0 ) {
// We already have the children added
return;
}
QListIterator<Archive> f( TapeManager::instance()->getMountedTape()->getChildren() );
for ( ; f.current(); ++f ) {
insertNode( new MountedArchiveNode( f.current() ) );
}
}
kdat'TapeDriveNode::selected() (./kdeadmin/kdat/Node.cpp:1220)
void TapeDriveNode::selected()
{
if ( TapeManager::instance()->getMountedTape() ) {
KDat::getInstance()->showTapeInfo( TapeManager::instance()->getMountedTape() );
} else {
KDat::getInstance()->hideInfo();
}
}
kdat'TapeDriveNode::popupMenu() (./kdeadmin/kdat/Node.cpp:1229)
void TapeDriveNode::popupMenu( const QPoint& p )
{
KDat::getInstance()->popupTapeDriveMenu( p );
}
kdat'TapeDriveNode::slotTapeMounted() (./kdeadmin/kdat/Node.cpp:1234)
void TapeDriveNode::slotTapeMounted()
{
setPixmap( *ImageCache::instance()->getTapeMounted() );
setText( TapeManager::instance()->getMountedTape()->getName() );
if ( this == owner->getCurrentItem() ) {
KDat::getInstance()->showTapeInfo( TapeManager::instance()->getMountedTape() );
}
if ( isExpanded() ) {
bool dummy = TRUE;
expanding( dummy );
}
}
kdat'TapeDriveNode::slotTapeUnmounted() (./kdeadmin/kdat/Node.cpp:1249)
void TapeDriveNode::slotTapeUnmounted()
{
setPixmap( *ImageCache::instance()->getTapeUnmounted() );
setText( i18n( "<no tape>" ) );
// Remove all the children.
Node* n;
while ( ( n = (Node*)getChild() ) ) {
Node::removeChild( n );
delete n;
}
if ( this == owner->getCurrentItem() ) {
KDat::getInstance()->hideInfo();
}
}
kdat'TapeDriveNode::slotTapeModified() (./kdeadmin/kdat/Node.cpp:1266)
void TapeDriveNode::slotTapeModified( Tape* tape )
{
if ( TapeManager::instance()->getMountedTape() != tape ) {
return;
}
setText( tape->getName() );
if ( owner->getCurrentItem() == this ) {
KDat::getInstance()->showTapeInfo( TapeManager::instance()->getMountedTape() );
}
if ( ( childCount() == 0 ) && ( !isExpanded() ) ) {
return;
}
// Add/update existing archives.
QListIterator<Archive> i( tape->getChildren() );
MountedArchiveNode* n;
for ( ; i.current(); ++i ) {
n = findArchiveNode( i.current() );
if ( n ) {
if ( n->validate() ) {
bool select = ( owner->getCurrentItem() == n );
Node::removeChild( n );
insertNode( n );
if ( select ) {
owner->setCurrentItem( owner->itemRow( n ) );
}
}
} else {
insertNode( new MountedArchiveNode( i.current() ) );
}
}
// Remove deleted archives.
Archive* a;
for ( uint j = 0; j < childCount(); ) {
a = ((MountedArchiveNode*)childAt( j ))->getArchive();
for ( i.toFirst(); i.current(); ++i ) {
if ( i.current() == a ) {
break;
}
}
if ( !i.current() ) {
Node::removeChild( childAt( j ) );
} else {
j++;
}
}
}
kdat'TapeDriveNode::findArchiveNode() (./kdeadmin/kdat/Node.cpp:1318)
MountedArchiveNode* TapeDriveNode::findArchiveNode( Archive* archive )
{
MountedArchiveNode* n = 0;
for ( uint i = 0; i < childCount(); i++ ) {
if ( ((MountedArchiveNode*)childAt( i ))->getArchive() == archive ) {
n = (MountedArchiveNode*)childAt( i );
break;
}
}
return n;
}