Esempio n. 1
0
void MainWindow::updateActions()
{
    bool reading = _dirTreeModel->tree()->isBusy();

    _ui->actionStopReading->setEnabled( reading );
    _ui->actionRefreshAll->setEnabled	( ! reading );
    _ui->actionAskReadCache->setEnabled ( ! reading );
    _ui->actionAskWriteCache->setEnabled( ! reading );

    bool haveCurrentItem = ( _selectionModel->currentItem() != 0 );
    bool treeNotEmpty	 = ( _dirTreeModel->tree()->firstToplevel() != 0 );

    _ui->actionCopyUrlToClipboard->setEnabled( haveCurrentItem );
    _ui->actionGoUp->setEnabled( haveCurrentItem );
    _ui->actionGoToToplevel->setEnabled( treeNotEmpty );

    FileInfoSet selectedItems = _selectionModel->selectedItems();
    FileInfo * sel = selectedItems.first();
    bool oneDirSelected = ( selectedItems.size() == 1 ) && ( sel->isDir() );

    _ui->actionMoveToTrash->setEnabled( sel && ! sel->isDotEntry() );
    _ui->actionRefreshSelected->setEnabled( oneDirSelected && ! sel->isExcluded() && ! sel->isMountPoint() );
    _ui->actionContinueReadingAtMountPoint->setEnabled( oneDirSelected && sel->isMountPoint() );
    _ui->actionReadExcludedDirectory->setEnabled      ( oneDirSelected && sel->isExcluded()   );

    bool showingTreemap = _ui->treemapView->isVisible();

    _ui->actionTreemapZoomIn->setEnabled   ( showingTreemap && _ui->treemapView->canZoomIn() );
    _ui->actionTreemapZoomOut->setEnabled  ( showingTreemap && _ui->treemapView->canZoomOut() );
    _ui->actionResetTreemapZoom->setEnabled( showingTreemap && _ui->treemapView->canZoomOut() );
    _ui->actionTreemapRebuild->setEnabled  ( showingTreemap );
}
Esempio n. 2
0
void SelectionModel::setSelectedItems( const FileInfoSet & selectedItems )
{
    if ( _verbose )
	logDebug() << "Selecting " << selectedItems.size() << " items" << endl;

    QItemSelection sel;

    foreach ( FileInfo * item, selectedItems )
    {
	QModelIndex index = _dirTreeModel->modelIndex( item, 0 );

	if ( index.isValid() )
	     sel.merge( QItemSelection( index, index ), Select );
    }
Esempio n. 3
0
void MainWindow::showSummary()
{
    FileInfoSet sel = _selectionModel->selectedItems();
    int count = sel.size();

    if ( count <= 1 )
	showCurrent( _selectionModel->currentItem() );
    else
    {
	sel = sel.normalized();

	_ui->statusBar->showMessage( tr( "%1 items selected (%2 total)" )
				     .arg( count )
				     .arg( formatSize( sel.totalSize() ) ) );
    }
}