Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MainWindow::onDirectoryChanged( const QString& path )
- {
- foreach( const QFileInfo& fileInfo, QDir( path ).entryInfoList( QDir::NoDotAndDotDot | QDir::Files ) )
- {
- bool is_success_copy = false;
- for( int row = 0; row != ui->copyPathList->count(); ++row )
- {
- QString dest_dir_path = ui->copyPathList->item( row )->text();
- if( !QFileInfo( dest_dir_path ).exists() )
- {
- ui->copyPathList->item( row )->setBackgroundColor( Qt::red );
- continue;
- }
- else
- {
- is_success_copy = true;
- ui->copyPathList->item( row )->setBackgroundColor( Qt::color0 );
- }
- QString from_path = fileInfo.filePath();
- QString to_path = QString( "%1/%2" ).arg( dest_dir_path, fileInfo.fileName() );
- QFile::copy( from_path, to_path );
- }
- if( is_success_copy )
- QFile::remove( fileInfo.absoluteFilePath() );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement