Esempio n. 1
0
//*******************************************************************
// access_permissions                                        PRIVATE
//*******************************************************************
void QBtView::access_permissions()
{
   SelectionsSet data = get_selected_items();
   if( data.empty() ) {
      if( QBtShared::is_regular_file( selected_file_full_name() ) ) {
         const QFileInfo fi( selected_file_path() );
         data.insert( fi.absoluteFilePath() );
      }
   }
   if( data.empty() ) return;

   QBtAttrDialog dialog( this, data );
   if( QDialog::Accepted ==  dialog.exec() ) refresh();
}
Esempio n. 2
0
//*******************************************************************
// remove_selected                                           PRIVATE
//-------------------------------------------------------------------
// Funkcja wywolywana po nacisnieciu klawiszy Delete lub F8.
// Usuwa z dysku zaznaczone /lub aktualny plik.
//*******************************************************************
void QBtView::remove_selected()
{
   SelectionsSet data = get_selected_items();
   if( data.empty() ) {
      if( QBtShared::is_regular_file( selected_file_full_name() ) ) {
         const QFileInfo fi( selected_file_path() );
         data.insert( fi.absoluteFilePath() );
      }
   }
   if( data.empty() ) return;
   
   QBtDeleteQuest quest( this );
   quest.set_files( data );
   if( quest.exec() != QDialog::Accepted ) return;
   const bool wipe = quest.to_wipe();
   
   QBtDeleter deleter( this );
   deleter.set_data( data, wipe );
   if( QDialog::Accepted == deleter.exec() ) refresh();
}
Esempio n. 3
0
//*******************************************************************
// join_files                                                PRIVATE
//*******************************************************************
void QBtWorkspace::join_files()
{
    QBtView* src = 0;
    QBtView* dst = 0;
    if( !src_and_dst_view( src, dst ) ) return;

    // aby moc cos laczyc musza byc zaznaczone co najmniej 1 plik.
    SelectionsSet data = SelectionsSet();
    get_selections( src, data );
    if( data.empty() ) return;

    // uzytkownik musi miec uprawnienia do zapisu w docelowym katalogu
    QString dst_dir = dst->current_path();
    const QFileInfo dst_dir_fi( dst_dir );
    if( !dst_dir_fi.isWritable() ) {
        QMessageBox::critical( this, tr( FilesJoining ), tr( NoWritableDir ).arg( dst_dir ) );
        return;
    }

    // uzytkownik musi podac nazwe pliku wynikowego
    bool ok;
    const QString fname = QInputDialog::getText( this,
                                                 tr( FilesJoining ),
                                                 tr( EnterFileName ),
                                                 QLineEdit::Normal,
                                                 QString(),
                                                 &ok );
    if( !ok || fname.trimmed().isEmpty() ) return;

    // Absolutna sciezka do pliku wynikowego.
    if( !dst_dir.endsWith( '/' ) ) dst_dir += '/';
    const QString dst_fpath = dst_dir + fname;

    // jesli plik juz istnieje uzytkownik musi podjac decyzje co z tym fantem zrobic
    const QFileInfo dst_fi( dst_fpath );
    if( dst_fi.exists() ) {
        const int answer = QMessageBox::question( this,
                                                  tr( FilesJoining ),
                                                  tr( CanOverwrite ).arg( dst_fpath ),
                                                  QMessageBox::Yes,
                                                  QMessageBox::No );
        if( QMessageBox::No == answer ) return;
    }

    // wykonaj laczenie plikow
    QBtFileJoiner dialog( this, data, dst_fpath );
    if( QDialog::Accepted == dialog.exec() ) {
        // odswiez pokazywana zawartosc i ustaw sie na tym pliku.
        dst->refresh( QFileInfo( dst_fpath ).fileName() );
        if( src->current_path() == dst->current_path() ) src->refresh();
    }
}
Esempio n. 4
0
//*******************************************************************
// get_selections                                            PRIVATE
//*******************************************************************
bool QBtWorkspace::get_selections( QBtView* const in_view, SelectionsSet& out_data ) const
{
    out_data = in_view->get_selected_items();
    return !out_data.empty();
}