void QtFileIconView::readDir( const QDir &dir ) { if ( !dir.isReadable() ) return; if ( isRoot( dir.absPath() ) ) emit disableUp(); else emit enableUp(); clear(); emit directoryChanged( dir.absPath() ); const QFileInfoList *filist = dir.entryInfoList( QDir::DefaultFilter, QDir::DirsFirst | QDir::Name ); emit startReadDir( filist->count() ); QFileInfoListIterator it( *filist ); QFileInfo *fi; bool allowRename = FALSE, allowRenameSet = FALSE; while ( ( fi = it.current() ) != 0 ) { ++it; if ( fi && fi->fileName() == ".." && ( fi->dirPath() == "/" || fi->dirPath().isEmpty() ) ) continue; emit readNextDir(); QtFileIconViewItem *item = new QtFileIconViewItem( this, new QFileInfo( *fi ) ); if ( fi->isDir() ) item->setKey( QString( "000000%1" ).arg( fi->fileName() ) ); else item->setKey( fi->fileName() ); if ( !allowRenameSet ) { if ( !QFileInfo( fi->absFilePath() ).isWritable() || item->text() == "." || item->text() == ".." ) allowRename = FALSE; else allowRename = TRUE; if ( item->text() == "." || item->text() == ".." ) allowRenameSet = FALSE; else allowRenameSet = TRUE; } item->setRenameEnabled( allowRename ); } if ( !QFileInfo( dir.absPath() ).isWritable() ) emit disableMkdir(); else emit enableMkdir(); emit readDirDone(); }
bool QtFileIconView::qt_emit( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->signalOffset() ) { case 0: directoryChanged((const QString&)static_QUType_QString.get(_o+1)); break; case 1: startReadDir((int)static_QUType_int.get(_o+1)); break; case 2: readNextDir(); break; case 3: readDirDone(); break; case 4: enableUp(); break; case 5: disableUp(); break; case 6: enableMkdir(); break; case 7: disableMkdir(); break; default: return QIconView::qt_emit(_id,_o); } return TRUE; }