~ubuntu-branches/ubuntu/trusty/krusader/trusty

« back to all changes in this revision

Viewing changes to krusader/Panel/krinterview.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-08-08 13:47:36 UTC
  • mfrom: (1.2.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20110808134736-8e630ivgd2c3sgg5
Tags: 1:2.4.0~beta1-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "krpreviews.h"
27
27
#include "../VFS/vfilecontainer.h"
28
28
 
29
 
KrInterView::KrInterView(KrViewInstance &instance, const bool &left, KConfig *cfg,
 
29
KrInterView::KrInterView(KrViewInstance &instance, KConfig *cfg,
30
30
                         QAbstractItemView *itemView) :
31
 
        KrView(instance, left, cfg), _itemView(itemView), _mouseHandler(0)
 
31
        KrView(instance, cfg), _itemView(itemView), _mouseHandler(0)
32
32
{
33
33
    _model = new KrVfsModel(this);
34
34
 
84
84
        i2->setSelected(select);
85
85
}
86
86
 
87
 
uint KrInterView::intSetSelected(const vfile* vf, bool select)
 
87
void KrInterView::intSetSelected(const vfile* vf, bool select)
88
88
{
89
89
    if(select)
90
90
        _selection.insert(vf);
91
91
    else
92
92
        _selection.remove(vf);
93
 
 
94
 
    return _selection.count();
95
93
}
96
94
 
97
95
bool KrInterView::isSelected(const QModelIndex &ndx)
326
324
    KrView::sortModeUpdated(static_cast<KrViewProperties::ColumnType>(column),
327
325
                            order == Qt::DescendingOrder);
328
326
}
 
327
 
 
328
KIO::filesize_t KrInterView::calcSize()
 
329
{
 
330
    KIO::filesize_t size = 0;
 
331
    foreach(vfile *vf, _model->vfiles()) {
 
332
        size += vf->vfile_getSize();
 
333
    }
 
334
    return size;
 
335
}
 
336
 
 
337
KIO::filesize_t KrInterView::calcSelectedSize()
 
338
{
 
339
    KIO::filesize_t size = 0;
 
340
    foreach(const vfile *vf, _selection) {
 
341
        size += vf->vfile_getSize();
 
342
    }
 
343
    return size;
 
344
}
 
345
 
 
346
KUrl::List KrInterView::selectedUrls()
 
347
{
 
348
    KUrl::List list;
 
349
    foreach(const vfile *vf, _selection) {
 
350
        list << vf->vfile_getUrl();
 
351
    }
 
352
    return list;
 
353
}
 
354
 
 
355
void KrInterView::setSelection(const KUrl::List urls)
 
356
{
 
357
    op()->setMassSelectionUpdate(true);
 
358
 
 
359
    _selection.clear();
 
360
 
 
361
    foreach(const KUrl &url, urls) {
 
362
        QModelIndex idx = _model->indexFromUrl(url);
 
363
        if(idx.isValid())
 
364
            setSelected(_model->vfileAt(idx), true);
 
365
    }
 
366
 
 
367
    op()->setMassSelectionUpdate(false);
 
368
}