mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +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>
|
#include <lib/placetreemodel.h>
|
||||||
#define MODEL_CLASS PlaceTreeModel
|
#define MODEL_CLASS PlaceTreeModel
|
||||||
#else
|
#else
|
||||||
#include <KDirLister>
|
|
||||||
#include <lib/semanticinfo/sorteddirmodel.h>
|
#include <lib/semanticinfo/sorteddirmodel.h>
|
||||||
#define MODEL_CLASS SortedDirModel
|
#define MODEL_CLASS SortedDirModel
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,8 +46,8 @@ DocumentDirFinder::DocumentDirFinder(const KUrl& rootUrl)
|
||||||
{
|
{
|
||||||
d->mRootUrl = rootUrl;
|
d->mRootUrl = rootUrl;
|
||||||
d->mDirLister = new KDirLister(this);
|
d->mDirLister = new KDirLister(this);
|
||||||
connect(d->mDirLister, SIGNAL(itemsAdded(KUrl,KFileItemList)),
|
connect(d->mDirLister, SIGNAL(itemsAdded(KFileItemList)),
|
||||||
SLOT(slotItemsAdded(KUrl,KFileItemList)));
|
SLOT(slotItemsAdded(KFileItemList)));
|
||||||
connect(d->mDirLister, SIGNAL(completed()),
|
connect(d->mDirLister, SIGNAL(completed()),
|
||||||
SLOT(slotCompleted()));
|
SLOT(slotCompleted()));
|
||||||
d->mDirLister->openUrl(rootUrl);
|
d->mDirLister->openUrl(rootUrl);
|
||||||
|
@ -63,8 +63,9 @@ void DocumentDirFinder::start()
|
||||||
d->mDirLister->openUrl(d->mRootUrl);
|
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) {
|
Q_FOREACH(const KFileItem & item, list) {
|
||||||
MimeTypeUtils::Kind kind = MimeTypeUtils::fileItemKind(item);
|
MimeTypeUtils::Kind kind = MimeTypeUtils::fileItemKind(item);
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ Q_SIGNALS:
|
||||||
void done(const KUrl&, DocumentDirFinder::Status);
|
void done(const KUrl&, DocumentDirFinder::Status);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void slotItemsAdded(const KUrl&, const KFileItemList&);
|
void slotItemsAdded(const KFileItemList&);
|
||||||
void slotCompleted();
|
void slotCompleted();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -85,16 +85,14 @@ RecursiveDirModel::RecursiveDirModel(QObject* parent)
|
||||||
, d(new RecursiveDirModelPrivate)
|
, d(new RecursiveDirModelPrivate)
|
||||||
{
|
{
|
||||||
d->mDirLister = new KDirLister(this);
|
d->mDirLister = new KDirLister(this);
|
||||||
connect(d->mDirLister, SIGNAL(itemsAdded(KUrl, KFileItemList)),
|
connect(d->mDirLister, SIGNAL(itemsAdded(KFileItemList)),
|
||||||
SLOT(slotItemsAdded(KUrl, KFileItemList)));
|
SLOT(slotItemsAdded(KFileItemList)));
|
||||||
connect(d->mDirLister, SIGNAL(itemsDeleted(KFileItemList)),
|
connect(d->mDirLister, SIGNAL(itemsDeleted(KFileItemList)),
|
||||||
SLOT(slotItemsDeleted(KFileItemList)));
|
SLOT(slotItemsDeleted(KFileItemList)));
|
||||||
connect(d->mDirLister, SIGNAL(completed()),
|
connect(d->mDirLister, SIGNAL(completed()),
|
||||||
SIGNAL(completed()));
|
SIGNAL(completed()));
|
||||||
connect(d->mDirLister, SIGNAL(clear()),
|
connect(d->mDirLister, SIGNAL(clear()),
|
||||||
SLOT(slotCleared()));
|
SLOT(slotCleared()));
|
||||||
connect(d->mDirLister, SIGNAL(clear(KUrl)),
|
|
||||||
SLOT(slotDirCleared(KUrl)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RecursiveDirModel::~RecursiveDirModel()
|
RecursiveDirModel::~RecursiveDirModel()
|
||||||
|
@ -148,7 +146,7 @@ QVariant RecursiveDirModel::data(const QModelIndex& index, int role) const
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecursiveDirModel::slotItemsAdded(const KUrl&, const KFileItemList& newList)
|
void RecursiveDirModel::slotItemsAdded(const KFileItemList& newList)
|
||||||
{
|
{
|
||||||
QList<KUrl> dirUrls;
|
QList<KUrl> dirUrls;
|
||||||
KFileItemList fileList;
|
KFileItemList fileList;
|
||||||
|
@ -203,17 +201,4 @@ void RecursiveDirModel::slotCleared()
|
||||||
endResetModel();
|
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
|
} // namespace
|
||||||
|
|
|
@ -56,9 +56,8 @@ Q_SIGNALS:
|
||||||
void completed();
|
void completed();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void slotItemsAdded(const KUrl& dirUrl, const KFileItemList&);
|
void slotItemsAdded(const KFileItemList&);
|
||||||
void slotItemsDeleted(const KFileItemList&);
|
void slotItemsDeleted(const KFileItemList&);
|
||||||
void slotDirCleared(const KUrl&);
|
|
||||||
void slotCleared();
|
void slotCleared();
|
||||||
private:
|
private:
|
||||||
RecursiveDirModelPrivate* const d;
|
RecursiveDirModelPrivate* const d;
|
||||||
|
|
|
@ -119,7 +119,7 @@ KDirLister* SortedDirModel::dirLister() const
|
||||||
|
|
||||||
void SortedDirModel::reload()
|
void SortedDirModel::reload()
|
||||||
{
|
{
|
||||||
dirLister()->updateDirectory(dirLister()->url());
|
dirLister()->updateDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SortedDirModel::setBlackListedExtensions(const QStringList& list)
|
void SortedDirModel::setBlackListedExtensions(const QStringList& list)
|
||||||
|
|
|
@ -65,7 +65,7 @@ void ContextManagerTest::testRemove()
|
||||||
|
|
||||||
// Remove "b", `manager` should select "c"
|
// Remove "b", `manager` should select "c"
|
||||||
sandBox.remove("b");
|
sandBox.remove("b");
|
||||||
dirModel.dirLister()->updateDirectory(dirUrl);
|
dirModel.dirLister()->updateDirectory();
|
||||||
while (dirModel.rowCount() == 3) {
|
while (dirModel.rowCount() == 3) {
|
||||||
QTest::qWait(100);
|
QTest::qWait(100);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void ContextManagerTest::testRemove()
|
||||||
|
|
||||||
// Remove "c", `manager` should select "a"
|
// Remove "c", `manager` should select "a"
|
||||||
sandBox.remove("c");
|
sandBox.remove("c");
|
||||||
dirModel.dirLister()->updateDirectory(dirUrl);
|
dirModel.dirLister()->updateDirectory();
|
||||||
while (dirModel.rowCount() == 2) {
|
while (dirModel.rowCount() == 2) {
|
||||||
QTest::qWait(100);
|
QTest::qWait(100);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue