示例#1
0
//*******************************************************************
// 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();
}
示例#2
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 );
}