Skip to content

Commit

Permalink
itemsync: Fix copying files into list
Browse files Browse the repository at this point in the history
Fixes #769
  • Loading branch information
hluk committed Aug 23, 2017
1 parent e236200 commit 44c091d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions plugins/itemsync/filewatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ void FileWatcher::updateIndexData(const QModelIndex &index, const QVariantMap &i
}
}

QList<QModelIndex> FileWatcher::indexList(int first, int last)
QList<QPersistentModelIndex> FileWatcher::indexList(int first, int last)
{
QList<QModelIndex> indexList;
QList<QPersistentModelIndex> indexList;
indexList.reserve(last - first + 1);
for (int i = first; i <= last; ++i)
indexList.append( m_model->index(i, 0) );
Expand All @@ -558,7 +558,7 @@ void FileWatcher::saveItems(int first, int last)
if ( !lock() )
return;

const QList<QModelIndex> indexList = this->indexList(first, last);
const auto indexList = this->indexList(first, last);

// Create path if doesn't exist.
QDir dir(m_path);
Expand Down Expand Up @@ -686,7 +686,7 @@ bool FileWatcher::renameToUnique(const QDir &dir, const QStringList &baseNames,
return true;
}

bool FileWatcher::renameMoveCopy(const QDir &dir, const QList<QModelIndex> &indexList)
bool FileWatcher::renameMoveCopy(const QDir &dir, const QList<QPersistentModelIndex> &indexList)
{
QStringList baseNames;

Expand Down
4 changes: 2 additions & 2 deletions plugins/itemsync/filewatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ private slots:

void updateIndexData(const QModelIndex &index, const QVariantMap &itemData);

QList<QModelIndex> indexList(int first, int last);
QList<QPersistentModelIndex> indexList(int first, int last);

void saveItems(int first, int last);

bool renameToUnique(const QDir &dir, const QStringList &baseNames, QString *name);

bool renameMoveCopy(const QDir &dir, const QList<QModelIndex> &indexList);
bool renameMoveCopy(const QDir &dir, const QList<QPersistentModelIndex> &indexList);

void updateDataAndWatchFile(
const QDir &dir, const BaseNameExtensions &baseNameWithExts,
Expand Down

0 comments on commit 44c091d

Please sign in to comment.