mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00
gwenview: adjust to KDirLister changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4387400a88
commit
3ea4bbd312
7 changed files with 12 additions and 28 deletions
|
@ -41,7 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include <lib/placetreemodel.h>
|
||||
#define MODEL_CLASS PlaceTreeModel
|
||||
#else
|
||||
#include <KDirLister>
|
||||
#include <lib/semanticinfo/sorteddirmodel.h>
|
||||
#define MODEL_CLASS SortedDirModel
|
||||
#endif
|
||||
|
|
|
@ -46,8 +46,8 @@ DocumentDirFinder::DocumentDirFinder(const KUrl& rootUrl)
|
|||
{
|
||||
d->mRootUrl = rootUrl;
|
||||
d->mDirLister = new KDirLister(this);
|
||||
connect(d->mDirLister, SIGNAL(itemsAdded(KUrl,KFileItemList)),
|
||||
SLOT(slotItemsAdded(KUrl,KFileItemList)));
|
||||
connect(d->mDirLister, SIGNAL(itemsAdded(KFileItemList)),
|
||||
SLOT(slotItemsAdded(KFileItemList)));
|
||||
connect(d->mDirLister, SIGNAL(completed()),
|
||||
SLOT(slotCompleted()));
|
||||
d->mDirLister->openUrl(rootUrl);
|
||||
|
@ -63,8 +63,9 @@ void DocumentDirFinder::start()
|
|||
d->mDirLister->openUrl(d->mRootUrl);
|
||||
}
|
||||
|
||||
void DocumentDirFinder::slotItemsAdded(const KUrl& dir, const KFileItemList& list)
|
||||
void DocumentDirFinder::slotItemsAdded(const KFileItemList& list)
|
||||
{
|
||||
const KUrl dir = d->mDirLister->url();
|
||||
Q_FOREACH(const KFileItem & item, list) {
|
||||
MimeTypeUtils::Kind kind = MimeTypeUtils::fileItemKind(item);
|
||||
switch (kind) {
|
||||
|
|
|
@ -64,7 +64,7 @@ Q_SIGNALS:
|
|||
void done(const KUrl&, DocumentDirFinder::Status);
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotItemsAdded(const KUrl&, const KFileItemList&);
|
||||
void slotItemsAdded(const KFileItemList&);
|
||||
void slotCompleted();
|
||||
|
||||
private:
|
||||
|
|
|
@ -85,16 +85,14 @@ RecursiveDirModel::RecursiveDirModel(QObject* parent)
|
|||
, d(new RecursiveDirModelPrivate)
|
||||
{
|
||||
d->mDirLister = new KDirLister(this);
|
||||
connect(d->mDirLister, SIGNAL(itemsAdded(KUrl, KFileItemList)),
|
||||
SLOT(slotItemsAdded(KUrl, KFileItemList)));
|
||||
connect(d->mDirLister, SIGNAL(itemsAdded(KFileItemList)),
|
||||
SLOT(slotItemsAdded(KFileItemList)));
|
||||
connect(d->mDirLister, SIGNAL(itemsDeleted(KFileItemList)),
|
||||
SLOT(slotItemsDeleted(KFileItemList)));
|
||||
connect(d->mDirLister, SIGNAL(completed()),
|
||||
SIGNAL(completed()));
|
||||
connect(d->mDirLister, SIGNAL(clear()),
|
||||
SLOT(slotCleared()));
|
||||
connect(d->mDirLister, SIGNAL(clear(KUrl)),
|
||||
SLOT(slotDirCleared(KUrl)));
|
||||
}
|
||||
|
||||
RecursiveDirModel::~RecursiveDirModel()
|
||||
|
@ -148,7 +146,7 @@ QVariant RecursiveDirModel::data(const QModelIndex& index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
void RecursiveDirModel::slotItemsAdded(const KUrl&, const KFileItemList& newList)
|
||||
void RecursiveDirModel::slotItemsAdded(const KFileItemList& newList)
|
||||
{
|
||||
QList<KUrl> dirUrls;
|
||||
KFileItemList fileList;
|
||||
|
@ -203,17 +201,4 @@ void RecursiveDirModel::slotCleared()
|
|||
endResetModel();
|
||||
}
|
||||
|
||||
void RecursiveDirModel::slotDirCleared(const KUrl& dirUrl)
|
||||
{
|
||||
int row;
|
||||
for (row = d->list().count() - 1; row >= 0; --row) {
|
||||
const KUrl url = d->list().at(row).url();
|
||||
if (dirUrl.isParentOf(url)) {
|
||||
beginRemoveRows(QModelIndex(), row, row);
|
||||
d->removeAt(row);
|
||||
endRemoveRows();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -56,9 +56,8 @@ Q_SIGNALS:
|
|||
void completed();
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotItemsAdded(const KUrl& dirUrl, const KFileItemList&);
|
||||
void slotItemsAdded(const KFileItemList&);
|
||||
void slotItemsDeleted(const KFileItemList&);
|
||||
void slotDirCleared(const KUrl&);
|
||||
void slotCleared();
|
||||
private:
|
||||
RecursiveDirModelPrivate* const d;
|
||||
|
|
|
@ -119,7 +119,7 @@ KDirLister* SortedDirModel::dirLister() const
|
|||
|
||||
void SortedDirModel::reload()
|
||||
{
|
||||
dirLister()->updateDirectory(dirLister()->url());
|
||||
dirLister()->updateDirectory();
|
||||
}
|
||||
|
||||
void SortedDirModel::setBlackListedExtensions(const QStringList& list)
|
||||
|
|
|
@ -65,7 +65,7 @@ void ContextManagerTest::testRemove()
|
|||
|
||||
// Remove "b", `manager` should select "c"
|
||||
sandBox.remove("b");
|
||||
dirModel.dirLister()->updateDirectory(dirUrl);
|
||||
dirModel.dirLister()->updateDirectory();
|
||||
while (dirModel.rowCount() == 3) {
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void ContextManagerTest::testRemove()
|
|||
|
||||
// Remove "c", `manager` should select "a"
|
||||
sandBox.remove("c");
|
||||
dirModel.dirLister()->updateDirectory(dirUrl);
|
||||
dirModel.dirLister()->updateDirectory();
|
||||
while (dirModel.rowCount() == 2) {
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue