//******************************************************************* // md5_create PRIVATE //******************************************************************* void QBtWorkspace::md5_create() { QBtView* src = 0; QBtView* dst = 0; if( !src_and_dst_view( src, dst ) ) return; SelectionsSet data = SelectionsSet(); get_selections( src, data ); if( data.size() != 1 ) return; const QString src_fpath = *data.begin(); const QString src_dir = src->current_path(); const QString dst_fpath = src_fpath + ".md5sum"; if( QFileInfo( dst_fpath ).exists() ) QFile::remove( dst_fpath ); if( QFileInfo( src_fpath ).isDir() ) { return; } if( !QFileInfo( src_dir ).isWritable() ) { QMessageBox::critical( this, tr( Md5 ), tr( NoWritableDir ).arg( src_dir ) ); return; } QBtShared::set_cursor( Qt::BusyCursor ); const QString cmd = Md5Create.arg( QBtShared::quoted_fpath( src_fpath ), QBtShared::quoted_fpath( dst_fpath ) ); system( cmd.toLocal8Bit() ); QBtShared::restore_cursor(); src->refresh( QFileInfo( dst_fpath).fileName() ); if( src->current_path() == dst->current_path() ) dst->refresh(); }
//******************************************************************* // set_files PUBLIC //******************************************************************* void QBtDeleteQuest::set_files( const SelectionsSet& in_data ) { SelectionsSet::const_iterator it = in_data.begin(); const SelectionsSet::const_iterator end = in_data.end(); while( it != end ) { QTreeWidgetItem* const itm = new QTreeWidgetItem( view_ ); itm->setText( 0, QFileInfo( *it ).fileName() ); ++it; } view_->resizeColumnToContents( 0 ); }
//******************************************************************* // md5_check PRIVATE //******************************************************************* void QBtWorkspace::md5_check() { QBtView* src = 0; QBtView* dst = 0; if( !src_and_dst_view( src, dst ) ) return; SelectionsSet data = SelectionsSet(); get_selections( src, data ); if( data.size() != 1 ) return; const QString src_fpath = *data.begin(); QBtSystemCall sc; sc.run( Md5Check.arg( QBtShared::quoted_fpath( src_fpath ) ) ); const QString msg = sc.result(); QMessageBox::information( this, tr( Md5 ), msg ); }