|
|
|
@ -48,6 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
#include <kurldrag.h>
|
|
|
|
|
#include <tdeio/job.h>
|
|
|
|
|
#include <tdeio/file.h>
|
|
|
|
|
#include <tdeio/metainfojob.h>
|
|
|
|
|
|
|
|
|
|
// Local
|
|
|
|
|
#include "archive.h"
|
|
|
|
@ -188,6 +189,9 @@ public:
|
|
|
|
|
TQComboBox* mFilterComboBox;
|
|
|
|
|
TQCheckBox* mShowFilterBarCheckBox;
|
|
|
|
|
|
|
|
|
|
TDEIO::MetaInfoJob* mMetaInfoJob;
|
|
|
|
|
KFileItemList mMetaInfoTodo;
|
|
|
|
|
|
|
|
|
|
void initFilterBar() {
|
|
|
|
|
mFilterBar=new FilterBar(that);
|
|
|
|
|
mFilterBar->setSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Fixed);
|
|
|
|
@ -266,6 +270,7 @@ FileViewController::FileViewController(TQWidget* parent,TDEActionCollection* act
|
|
|
|
|
d->initFilterBar();
|
|
|
|
|
d->initFilterCombo();
|
|
|
|
|
d->mStack=new TQWidgetStack(this);
|
|
|
|
|
d->mMetaInfoJob=NULL;
|
|
|
|
|
|
|
|
|
|
TQVBoxLayout *layout=new TQVBoxLayout(this);
|
|
|
|
|
layout->addWidget(d->mToolBar);
|
|
|
|
@ -470,6 +475,7 @@ FileViewController::~FileViewController() {
|
|
|
|
|
FileViewConfig::setToDateFilter(d->mFilterBar->mToDateEdit->date());
|
|
|
|
|
|
|
|
|
|
FileViewConfig::writeConfig();
|
|
|
|
|
stopMetaInfoUpdate();
|
|
|
|
|
delete mDirLister;
|
|
|
|
|
delete d;
|
|
|
|
|
}
|
|
|
|
@ -1022,6 +1028,12 @@ void FileViewController::dirListerDeleteItem(KFileItem* item) {
|
|
|
|
|
if (!newShownItem) newShownItem=findPreviousImage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove item from metadata todo list and job's pending update lists
|
|
|
|
|
d->mMetaInfoTodo.remove(item);
|
|
|
|
|
if (d->mMetaInfoJob) {
|
|
|
|
|
d->mMetaInfoJob->removeItem(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentFileView()->removeItem(item);
|
|
|
|
|
|
|
|
|
|
if (shownItem==item) {
|
|
|
|
@ -1040,21 +1052,24 @@ void FileViewController::dirListerNewItems(const KFileItemList& items) {
|
|
|
|
|
LOG("");
|
|
|
|
|
mThumbnailsNeedUpdate=true;
|
|
|
|
|
currentFileView()->addItemList(items);
|
|
|
|
|
loadMetaInfo(items);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FileViewController::dirListerRefreshItems(const KFileItemList& list) {
|
|
|
|
|
LOG("");
|
|
|
|
|
const KFileItem* item=currentFileView()->shownFileItem();
|
|
|
|
|
KFileItemListIterator it(list);
|
|
|
|
|
for (; *it!=0L; ++it) {
|
|
|
|
|
currentFileView()->updateView(*it);
|
|
|
|
|
if (*it==item) {
|
|
|
|
|
emit shownFileItemRefreshed(item);
|
|
|
|
|
}
|
|
|
|
|
updateViewItem(*it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FileViewController::updateViewItem(const KFileItem *item) {
|
|
|
|
|
currentFileView()->updateView(item);
|
|
|
|
|
if (item==currentFileView()->shownFileItem()) {
|
|
|
|
|
emit shownFileItemRefreshed(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FileViewController::refreshItems(const KURL::List& urls) {
|
|
|
|
|
LOG("");
|
|
|
|
@ -1145,6 +1160,7 @@ void FileViewController::dirListerCanceled() {
|
|
|
|
|
if (mMode!=FILE_LIST) {
|
|
|
|
|
mFileThumbnailView->stopThumbnailUpdate();
|
|
|
|
|
}
|
|
|
|
|
stopMetaInfoUpdate();
|
|
|
|
|
|
|
|
|
|
browseToFileNameToSelect();
|
|
|
|
|
}
|
|
|
|
@ -1316,5 +1332,45 @@ KFileItem* FileViewController::findItemByFileName(const TQString& fileName) cons
|
|
|
|
|
return 0L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// MetaInfo loading
|
|
|
|
|
//
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
void FileViewController::loadMetaInfo(const KFileItemList& items) {
|
|
|
|
|
if(d->mMetaInfoTodo.isEmpty()) {
|
|
|
|
|
d->mMetaInfoTodo = items;
|
|
|
|
|
} else {
|
|
|
|
|
for(const auto& item: items) {
|
|
|
|
|
d->mMetaInfoTodo.append(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!d->mMetaInfoJob) {
|
|
|
|
|
nextMetaInfoJob();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FileViewController::nextMetaInfoJob() {
|
|
|
|
|
if( !d->mMetaInfoTodo.isEmpty() ) {
|
|
|
|
|
d->mMetaInfoJob = new TDEIO::MetaInfoJob(d->mMetaInfoTodo);
|
|
|
|
|
connect( d->mMetaInfoJob, TQ_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
|
this, TQ_SLOT(nextMetaInfoJob()) );
|
|
|
|
|
connect( d->mMetaInfoJob, TQ_SIGNAL( gotMetaInfo(const KFileItem *)),
|
|
|
|
|
this, TQ_SLOT(updateViewItem(const KFileItem *)) );
|
|
|
|
|
d->mMetaInfoTodo.clear();
|
|
|
|
|
} else {
|
|
|
|
|
d->mMetaInfoJob = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FileViewController::stopMetaInfoUpdate() {
|
|
|
|
|
d->mMetaInfoTodo.clear();
|
|
|
|
|
if(d->mMetaInfoJob) {
|
|
|
|
|
d->mMetaInfoJob->kill();
|
|
|
|
|
d->mMetaInfoJob = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|