Beispiel #1
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 );
}
//*******************************************************************
// load_file                                                 PRIVATE
//*******************************************************************
void QBtFileEditor::load_file()
{
   static const QString cmd = "file -b -i \"%1\"";

   QApplication::setOverrideCursor( Qt::WaitCursor );      
   QBtSystemCall syscall;
   syscall.run( cmd.arg( path_ ) );
   const QString marker = syscall.result();

   const bool is_text = marker.startsWith( "text" ) ||
                        marker.contains( "script" ) ||
                        marker.contains( "perl" );
   
   if( is_text ) reload_file();
   QApplication::restoreOverrideCursor();

   if( !is_text ) {
      QMessageBox::information( this, tr( CAPTION ), tr( NOTEXT_FILE ).arg( path_ ) );
   }
}