########### next target ###############
set(dolphinprivate_LIB_SRCS
- kitemviews/kfileitemclipboard.cpp
kitemviews/kfileitemlistgroupheader.cpp
kitemviews/kfileitemlistview.cpp
kitemviews/kfileitemlistwidget.cpp
kitemviews/kfileitemmodel.cpp
- kitemviews/kfileitemmodelsortalgorithm.cpp
- kitemviews/kfileitemmodelfilter.cpp
kitemviews/kfileitemmodelrolesupdater.cpp
kitemviews/kitemlistcontainer.cpp
kitemviews/kitemlistcontroller.cpp
kitemviews/kitemlistgroupheader.cpp
kitemviews/kitemlistheader.cpp
- kitemviews/kitemlistheaderwidget.cpp
- kitemviews/kitemlistkeyboardsearchmanager.cpp
- kitemviews/kitemlistrubberband.cpp
kitemviews/kitemlistselectionmanager.cpp
- kitemviews/kitemlistselectiontoggle.cpp
- kitemviews/kitemlistsizehintresolver.cpp
- kitemviews/kitemlistsmoothscroller.cpp
kitemviews/kitemliststyleoption.cpp
kitemviews/kitemlistview.cpp
- kitemviews/kitemlistviewanimation.cpp
- kitemviews/kitemlistviewlayouter.cpp
kitemviews/kitemlistwidget.cpp
kitemviews/kitemmodelbase.cpp
- kitemviews/kpixmapmodifier.cpp
+ kitemviews/private/kfileitemclipboard.cpp
+ kitemviews/private/kfileitemmodeldirlister.cpp
+ kitemviews/private/kfileitemmodelsortalgorithm.cpp
+ kitemviews/private/kfileitemmodelfilter.cpp
+ kitemviews/private/kitemlistheaderwidget.cpp
+ kitemviews/private/kitemlistkeyboardsearchmanager.cpp
+ kitemviews/private/kitemlistrubberband.cpp
+ kitemviews/private/kitemlistselectiontoggle.cpp
+ kitemviews/private/kitemlistsizehintresolver.cpp
+ kitemviews/private/kitemlistsmoothscroller.cpp
+ kitemviews/private/kitemlistviewanimation.cpp
+ kitemviews/private/kitemlistviewlayouter.cpp
+ kitemviews/private/kpixmapmodifier.cpp
settings/additionalinfodialog.cpp
settings/applyviewpropsjob.cpp
settings/viewmodes/viewmodesettings.cpp
settings/viewpropertiesdialog.cpp
settings/viewpropsprogressinfo.cpp
- views/dolphindirlister.cpp
views/dolphinfileitemlistwidget.cpp
views/dolphinitemlistcontainer.cpp
views/dolphinnewfilemenuobserver.cpp
if (Nepomuk_FOUND)
set(dolphinprivate_LIB_SRCS
${dolphinprivate_LIB_SRCS}
- kitemviews/knepomukrolesprovider.cpp
+ kitemviews/private/knepomukrolesprovider.cpp
)
endif (Nepomuk_FOUND)
this, SLOT(openNewTab(KUrl)));
connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
- connect(view, SIGNAL(startedPathLoading(KUrl)),
+ connect(view, SIGNAL(startedDirLoading(KUrl)),
this, SLOT(enableStopAction()));
- connect(view, SIGNAL(finishedPathLoading(KUrl)),
+ connect(view, SIGNAL(finishedDirLoading(KUrl)),
this, SLOT(disableStopAction()));
connect(view, SIGNAL(goBackRequested()),
this, SLOT(goBack()));
#include "views/dolphinviewactionhandler.h"
#include "views/dolphinnewfilemenuobserver.h"
#include "views/dolphinremoteencoding.h"
-#include "views/dolphindirlister.h"
#include <QActionGroup>
#include <QApplication>
#include <QClipboard>
+#include <QDir>
K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
m_view->setTabsForFilesEnabled(true);
setWidget(m_view);
- connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotCompleted(KUrl)));
- connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateProgress(int)));
+ connect(m_view, SIGNAL(finishedDirLoading(KUrl)), this, SLOT(slotCompleted(KUrl)));
+ connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateProgress(int)));
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
setXMLFile("dolphinpart.rc");
connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus()));
m_view = new DolphinView(url, this);
- connect(m_view, SIGNAL(urlChanged(KUrl)), m_urlNavigator, SLOT(setUrl(KUrl)));
- connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool)));
- connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem)));
- connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
- connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
- connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
- connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
- connect(m_view, SIGNAL(startedPathLoading(KUrl)), this, SLOT(slotStartedPathLoading()));
- connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotFinishedPathLoading()));
- connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
- connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateLoadingProgress(int)));
- connect(m_view, SIGNAL(sortProgress(int)), this, SLOT(updateSortProgress(int)));
- connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
- connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
- connect(m_view, SIGNAL(urlIsFileError(KUrl)), this, SLOT(openFile(KUrl)));
+ connect(m_view, SIGNAL(urlChanged(KUrl)), m_urlNavigator, SLOT(setUrl(KUrl)));
+ connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool)));
+ connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem)));
+ connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
+ connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
+ connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
+ connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
+ connect(m_view, SIGNAL(startedDirLoading(KUrl)), this, SLOT(slotStartedDirLoading()));
+ connect(m_view, SIGNAL(finishedDirLoading(KUrl)), this, SLOT(slotFinishedDirLoading()));
+ connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
+ connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateDirLoadingProgress(int)));
+ connect(m_view, SIGNAL(dirSortingProgress(int)), this, SLOT(updateSortingProgress(int)));
+ connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
+ connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
connect(m_view, SIGNAL(operationCompletedMessage(QString)), this, SLOT(showOperationCompletedMessage(QString)));
connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
}
}
-void DolphinViewContainer::updateLoadingProgress(int percent)
+void DolphinViewContainer::updateDirLoadingProgress(int percent)
{
if (m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
m_statusBar->setProgress(percent);
}
-void DolphinViewContainer::updateSortProgress(int percent)
+void DolphinViewContainer::updateSortingProgress(int percent)
{
if (m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(i18nc("@info:progress", "Sorting..."));
m_statusBar->setProgress(percent);
}
-void DolphinViewContainer::slotStartedPathLoading()
+void DolphinViewContainer::slotStartedDirLoading()
{
if (isSearchUrl(url())) {
// Search KIO-slaves usually don't provide any progress information. Give
// Trigger an undetermined progress indication. The progress
// information in percent will be triggered by the percent() signal
// of the directory lister later.
- updateLoadingProgress(-1);
+ updateDirLoadingProgress(-1);
}
}
-void DolphinViewContainer::slotFinishedPathLoading()
+void DolphinViewContainer::slotFinishedDirLoading()
{
if (!m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(QString());
m_statusBar->setProgress(100);
}
- if (isSearchUrl(url()) && m_view->items().isEmpty()) {
+ if (isSearchUrl(url()) && m_view->itemsCount() == 0) {
// The dir lister has been completed on a Nepomuk-URI and no items have been found. Instead
// of showing the default status bar information ("0 items") a more helpful information is given:
m_statusBar->setMessage(i18nc("@info:status", "No items found."), DolphinStatusBar::Information);
item.run();
}
-void DolphinViewContainer::openFile(const KUrl& url)
-{
- const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
- slotItemActivated(item);
-}
-
void DolphinViewContainer::showItemInfo(const KFileItem& item)
{
if (item.isNull()) {
*/
void updateStatusBar();
- void updateLoadingProgress(int percent);
+ void updateDirLoadingProgress(int percent);
- void updateSortProgress(int percent);
+ void updateSortingProgress(int percent);
/**
* Updates the statusbar to show an undetermined progress with the correct
* context information whether a searching or a directory loading is done.
*/
- void slotStartedPathLoading();
+ void slotStartedDirLoading();
/**
* Assures that the viewport position is restored and updates the
* statusbar to reflect the current content.
*/
- void slotFinishedPathLoading();
+ void slotFinishedDirLoading();
/**
* Handles clicking on an item. If the item is a directory, the
*/
void slotItemActivated(const KFileItem& item);
- /**
- * Opens a the file \a url by opening the corresponding application.
- * Is connected with the signal urlIsFile() from DolphinDirLister and will
- * get invoked if the user manually has entered a file into the URL navigator.
- */
- void openFile(const KUrl& url);
-
/**
* Shows the information for the item \a item inside the statusbar. If the
* item is null, the default statusbar information is shown.
#include "kfileitemmodelrolesupdater.h"
#include "kfileitemlistwidget.h"
#include "kfileitemmodel.h"
-#include "kpixmapmodifier_p.h"
#include <KLocale>
#include <KStringHandler>
+#include "private/kpixmapmodifier.h"
#include <KDebug>
#include <KIcon>
#include "kfileitemlistwidget.h"
-#include "kfileitemclipboard_p.h"
#include "kfileitemlistview.h"
#include "kfileitemmodel.h"
-#include "kpixmapmodifier_p.h"
#include <KIcon>
#include <KIconEffect>
#include <KStringHandler>
#include <KDebug>
+#include "private/kfileitemclipboard.h"
+#include "private/kpixmapmodifier.h"
+
#include <QFontMetricsF>
#include <QGraphicsSceneResizeEvent>
#include <QPainter>
QRectF KFileItemListWidget::textFocusRect() const
{
+ // In the compact- and details-layout a larger textRect() is returned to be aligned
+ // with the iconRect(). This is useful to have a larger selection/hover-area
+ // when having a quite large icon size but only one line of text. Still the
+ // focus rectangle should be shown as narrow as possible around the text.
+
const_cast<KFileItemListWidget*>(this)->triggerCacheRefreshing();
- if (m_layout == CompactLayout) {
- // In the compact layout a larger textRect() is returned to be aligned
- // with the iconRect(). This is useful to have a larger selection/hover-area
- // when having a quite large icon size but only one line of text. Still the
- // focus rectangle should be shown as narrow as possible around the text.
+
+ switch (m_layout) {
+ case CompactLayout: {
QRectF rect = m_textRect;
const TextInfo* topText = m_textInfo.value(m_sortedVisibleRoles.first());
const TextInfo* bottomText = m_textInfo.value(m_sortedVisibleRoles.last());
rect.setBottom(bottomText->pos.y() + bottomText->staticText.size().height());
return rect;
}
+
+ case DetailsLayout: {
+ QRectF rect = m_textRect;
+ const TextInfo* textInfo = m_textInfo.value(m_sortedVisibleRoles.first());
+ rect.setTop(textInfo->pos.y());
+ rect.setBottom(textInfo->pos.y() + textInfo->staticText.size().height());
+ return rect;
+ }
+
+ default:
+ break;
+ }
+
return m_textRect;
}
#include "kfileitemmodel.h"
-#include <KDirLister>
#include <KDirModel>
-#include "kfileitemmodelsortalgorithm_p.h"
#include <KGlobalSettings>
#include <KLocale>
#include <KStringHandler>
#include <KDebug>
+#include "private/kfileitemmodelsortalgorithm.h"
+#include "private/kfileitemmodeldirlister.h"
+
#include <QMimeData>
#include <QTimer>
// #define KFILEITEMMODEL_DEBUG
-KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
+KFileItemModel::KFileItemModel(QObject* parent) :
KItemModelBase("name", parent),
- m_dirLister(dirLister),
+ m_dirLister(0),
m_naturalSorting(KGlobalSettings::naturalSorting()),
m_sortFoldersFirst(true),
m_sortRole(NameRole),
- m_sortProgressPercent(-1),
+ m_sortingProgressPercent(-1),
m_roles(),
m_caseSensitivity(Qt::CaseInsensitive),
m_itemData(),
m_expandedUrls(),
m_urlsToExpand()
{
+ m_dirLister = new KFileItemModelDirLister(this);
+ m_dirLister->setAutoUpdate(true);
+ m_dirLister->setDelayedMimeTypes(true);
+
+ connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(dirLoadingStarted()));
+ connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled()));
+ connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted()));
+ connect(m_dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(slotNewItems(KFileItemList)));
+ connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(slotItemsDeleted(KFileItemList)));
+ connect(m_dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)), this, SLOT(slotRefreshItems(QList<QPair<KFileItem,KFileItem> >)));
+ connect(m_dirLister, SIGNAL(clear()), this, SLOT(slotClear()));
+ connect(m_dirLister, SIGNAL(clear(KUrl)), this, SLOT(slotClear(KUrl)));
+ connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
+ connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
+ connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(redirection(KUrl,KUrl)));
+
// Apply default roles that should be determined
resetRoles();
m_requestRole[NameRole] = true;
m_roles.insert("name");
m_roles.insert("isDir");
- Q_ASSERT(dirLister);
-
- connect(dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled()));
- connect(dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted()));
- connect(dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(slotNewItems(KFileItemList)));
- connect(dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(slotItemsDeleted(KFileItemList)));
- connect(dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)), this, SLOT(slotRefreshItems(QList<QPair<KFileItem,KFileItem> >)));
- connect(dirLister, SIGNAL(clear()), this, SLOT(slotClear()));
- connect(dirLister, SIGNAL(clear(KUrl)), this, SLOT(slotClear(KUrl)));
-
// For slow KIO-slaves like used for searching it makes sense to show results periodically even
// before the completed() or canceled() signal has been emitted.
m_maximumUpdateIntervalTimer = new QTimer(this);
m_itemData.clear();
}
+void KFileItemModel::loadDir(const KUrl& url)
+{
+ m_dirLister->openUrl(url);
+}
+
+void KFileItemModel::refreshDir(const KUrl& url)
+{
+ m_dirLister->openUrl(url, KDirLister::Reload);
+}
+
+KUrl KFileItemModel::dir() const
+{
+ return m_dirLister->url();
+}
+
int KFileItemModel::count() const
{
return m_itemData.count();
void KFileItemModel::setShowHiddenFiles(bool show)
{
- KDirLister* dirLister = m_dirLister.data();
- if (dirLister) {
- dirLister->setShowingDotFiles(show);
- dirLister->emitChanges();
- if (show) {
- slotCompleted();
- }
+ m_dirLister->setShowingDotFiles(show);
+ m_dirLister->emitChanges();
+ if (show) {
+ slotCompleted();
}
}
bool KFileItemModel::showHiddenFiles() const
{
- const KDirLister* dirLister = m_dirLister.data();
- return dirLister ? dirLister->showingDotFiles() : false;
+ return m_dirLister->showingDotFiles();
}
void KFileItemModel::setShowFoldersOnly(bool enabled)
{
- KDirLister* dirLister = m_dirLister.data();
- if (dirLister) {
- dirLister->setDirOnlyMode(enabled);
- }
+ m_dirLister->setDirOnlyMode(enabled);
}
bool KFileItemModel::showFoldersOnly() const
{
- KDirLister* dirLister = m_dirLister.data();
- return dirLister ? dirLister->dirOnlyMode() : false;
+ return m_dirLister->dirOnlyMode();
}
QMimeData* KFileItemModel::createMimeData(const QSet<int>& indexes) const
KFileItem KFileItemModel::rootItem() const
{
- const KDirLister* dirLister = m_dirLister.data();
- if (dirLister) {
- return dirLister->rootItem();
- }
- return KFileItem();
+ return m_dirLister->rootItem();
}
void KFileItemModel::clear()
return false;
}
- KDirLister* dirLister = m_dirLister.data();
const KUrl url = m_itemData.at(index)->item.url();
if (expanded) {
m_expandedUrls.insert(url);
-
- if (dirLister) {
- dirLister->openUrl(url, KDirLister::Keep);
- return true;
- }
+ m_dirLister->openUrl(url, KDirLister::Keep);
} else {
m_expandedUrls.remove(url);
+ m_dirLister->stop(url);
- if (dirLister) {
- dirLister->stop(url);
- }
KFileItemList itemsToRemove;
const int expandedParentsCount = data(index)["expandedParentsCount"].toInt();
++index;
}
removeItems(itemsToRemove);
- return true;
}
- return false;
+ return true;
}
bool KFileItemModel::isExpanded(int index) const
void KFileItemModel::expandParentItems(const KUrl& url)
{
- const KDirLister* dirLister = m_dirLister.data();
- if (!dirLister) {
- return;
- }
-
- const int pos = dirLister->url().path().length();
+ const int pos = m_dirLister->url().path().length();
// Assure that each sub-path of the URL that should be
// expanded is added to m_urlsToExpand. KDirLister
// does not care whether the parent-URL has already been
// expanded.
- KUrl urlToExpand = dirLister->url();
+ KUrl urlToExpand = m_dirLister->url();
const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
for (int i = 0; i < subDirs.count() - 1; ++i) {
urlToExpand.addPath(subDirs.at(i));
return m_filter.pattern();
}
+void KFileItemModel::cancelDirLoading()
+{
+ m_dirLister->stop();
+}
+
QList<KFileItemModel::RoleInfo> KFileItemModel::rolesInformation()
{
static QList<RoleInfo> rolesInfo;
m_urlsToExpand.clear();
}
- emit loadingCompleted();
+ emit dirLoadingCompleted();
}
void KFileItemModel::slotCanceled()
}
if (m_requestRole[ExpandedParentsCountRole]) {
- if (m_expandedParentsCountRoot == UninitializedExpandedParentsCountRoot && m_dirLister.data()) {
- const KUrl rootUrl = m_dirLister.data()->url();
+ if (m_expandedParentsCountRoot == UninitializedExpandedParentsCountRoot) {
+ const KUrl rootUrl = m_dirLister->url();
const QString protocol = rootUrl.protocol();
const bool forceExpandedParentsCountRoot = (protocol == QLatin1String("trash") ||
protocol == QLatin1String("nepomuk") ||
bool KFileItemModel::useMaximumUpdateInterval() const
{
- const KDirLister* dirLister = m_dirLister.data();
- return dirLister && !dirLister->url().isLocalFile();
+ return !m_dirLister->url().isLocalFile();
}
QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const
const int itemCount = count();
if (resolvedCount >= itemCount) {
- m_sortProgressPercent = -1;
+ m_sortingProgressPercent = -1;
if (m_resortAllItemsTimer->isActive()) {
m_resortAllItemsTimer->stop();
resortAllItems();
}
- emit sortProgress(100);
+ emit dirSortingProgress(100);
} else if (itemCount > 0) {
resolvedCount = qBound(0, resolvedCount, itemCount);
const int progress = resolvedCount * 100 / itemCount;
- if (m_sortProgressPercent != progress) {
- m_sortProgressPercent = progress;
- emit sortProgress(progress);
+ if (m_sortingProgressPercent != progress) {
+ m_sortingProgressPercent = progress;
+ emit dirSortingProgress(progress);
}
}
}
#include <libdolphin_export.h>
#include <KFileItemList>
#include <KUrl>
-#include <kitemviews/kfileitemmodelfilter_p.h>
#include <kitemviews/kitemmodelbase.h>
+#include <kitemviews/private/kfileitemmodelfilter.h>
#include <QHash>
-class KDirLister;
+class KFileItemModelDirLister;
class QTimer;
/**
*
* Also the recursive expansion of sub-directories is supported by
* KFileItemModel::setExpanded().
- *
- * TODO: In the longterm instead of passing a KDirLister just an URL should
- * be passed and a KDirLister used internally. This solves the following issues:
- * - The user of the API does not need to decide whether he listens to KDirLister
- * or KFileItemModel.
- * - It resolves minor conceptual differences between KDirLister and KFileItemModel.
- * E.g. there is no way for KFileItemModel to check whether a completed() signal
- * will be emitted after newItems() will be send by KDirLister or not (in the case
- * of setShowingDotFiles() no completed() signal will get emitted).
*/
class LIBDOLPHINPRIVATE_EXPORT KFileItemModel : public KItemModelBase
{
Q_OBJECT
public:
- explicit KFileItemModel(KDirLister* dirLister, QObject* parent = 0);
+ explicit KFileItemModel(QObject* parent = 0);
virtual ~KFileItemModel();
+ /**
+ * Loads the directory specified by \a url. The signals
+ * dirLoadingStarted(), dirLoadingProgress() and dirLoadingCompleted()
+ * indicate the current state of the loading process. The items
+ * of the directory are added after the loading has been completed.
+ */
+ void loadDir(const KUrl& url);
+
+ /**
+ * Throws away all currently loaded items and refreshes the directory
+ * by reloading all items again.
+ */
+ void refreshDir(const KUrl& url);
+
+ /**
+ * @return Parent directory of the items that are shown. In case
+ * if a directory tree is shown, KFileItemModel::dir() returns
+ * the root-parent of all items.
+ * @see rootItem()
+ */
+ KUrl dir() const;
+
virtual int count() const;
virtual QHash<QByteArray, QVariant> data(int index) const;
virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
int index(const KUrl& url) const;
/**
- * @return Root item of all items.
+ * @return Root item of all items representing the item
+ * for KFileItemModel::dir().
*/
KFileItem rootItem() const;
void setNameFilter(const QString& nameFilter);
QString nameFilter() const;
+ void cancelDirLoading();
+
struct RoleInfo
{ QByteArray role;
QString translation;
static QList<RoleInfo> rolesInformation();
signals:
+ /**
+ * Is emitted if the loading of a directory has been started. It is
+ * assured that a signal dirLoadingCompleted() will be send after
+ * the loading has been finished. For tracking the loading progress
+ * the signal dirLoadingProgress() gets emitted in between.
+ */
+ void dirLoadingStarted();
+
/**
* Is emitted after the loading of a directory has been completed or new
* items have been inserted to an already loaded directory. Usually
* (the only exception is loading an empty directory, where only a
* loadingCompleted() signal gets emitted).
*/
- void loadingCompleted();
+ void dirLoadingCompleted();
+
+ /**
+ * Informs about the progress in percent when loading a directory. It is assured
+ * that the signal dirLoadingStarted() has been emitted before.
+ */
+ void dirLoadingProgress(int percent);
/**
* Is emitted if the sort-role gets resolved asynchronously and provides
* the progress-information of the sorting in percent. It is assured
* that the last sortProgress-signal contains 100 as value.
*/
- void sortProgress(int percent);
+ void dirSortingProgress(int percent);
+
+ /**
+ * Is emitted if an information message (e.g. "Connecting to host...")
+ * should be shown.
+ */
+ void infoMessage(const QString& message);
+
+ /**
+ * Is emitted if an error message (e.g. "Unknown location")
+ * should be shown.
+ */
+ void errorMessage(const QString& message);
+
+ /**
+ * Is emitted if a redirection from the current URL \a oldUrl
+ * to the new URL \a newUrl has been done.
+ */
+ void redirection(const KUrl& oldUrl, const KUrl& newUrl);
protected:
virtual void onGroupedSortingChanged(bool current);
static void determineMimeTypes(const KFileItemList& items, int timeout);
private:
- QWeakPointer<KDirLister> m_dirLister;
+ KFileItemModelDirLister* m_dirLister;
bool m_naturalSorting;
bool m_sortFoldersFirst;
RoleType m_sortRole;
- int m_sortProgressPercent; // Value of sortProgress() signal
+ int m_sortingProgressPercent; // Value of dirSortingProgress() signal
QSet<QByteArray> m_roles;
Qt::CaseSensitivity m_caseSensitivity;
#include "kfileitemmodelrolesupdater.h"
#include "kfileitemmodel.h"
-#include "kpixmapmodifier_p.h"
#include <KConfig>
#include <KConfigGroup>
#include <KFileItem>
#include <KGlobal>
#include <KIO/PreviewJob>
+
+#include "private/kpixmapmodifier.h"
+
#include <QPainter>
#include <QPixmap>
#include <QElapsedTimer>
#include <QTimer>
#ifdef HAVE_NEPOMUK
- #include "knepomukrolesprovider_p.h"
- #include "knepomukresourcewatcher_p.h"
+ #include "private/knepomukrolesprovider.h"
+ #include "private/knepomukresourcewatcher.h"
#endif
// Required includes for subItemsCount():
m_previewShown(false),
m_enlargeSmallPreviews(true),
m_clearPreviews(false),
- m_sortProgress(-1),
+ m_sortingProgress(-1),
m_model(model),
m_iconSize(),
m_firstVisibleIndex(0),
void KFileItemModelRolesUpdater::applySortProgressToModel()
{
- if (m_sortProgress < 0) {
+ if (m_sortingProgress < 0) {
return;
}
if (resolvedCount > 0) {
m_model->emitSortProgress(resolvedCount);
if (resolvedCount == m_model->count()) {
- m_sortProgress = -1;
+ m_sortingProgress = -1;
}
}
}
? hasUnknownMimeTypes()
: m_resolvableRoles.contains(sortRole);
- if (m_sortProgress >= 0) {
+ if (m_sortingProgress >= 0) {
// Mark the current sorting as finished
m_model->emitSortProgress(m_model->count());
}
- m_sortProgress = showProgress ? 0 : -1;
+ m_sortingProgress = showProgress ? 0 : -1;
}
bool KFileItemModelRolesUpdater::hasUnknownMimeTypes() const
// during the roles-updater has been paused by setPaused().
bool m_clearPreviews;
- int m_sortProgress;
+ int m_sortingProgress;
KFileItemModel* m_model;
QSize m_iconSize;
#include "kitemlistcontainer.h"
#include "kitemlistcontroller.h"
-#include "kitemlistsmoothscroller_p.h"
#include "kitemlistview.h"
#include "kitemmodelbase.h"
+#include "private/kitemlistsmoothscroller.h"
+
#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include "kitemlistcontroller.h"
+#include <KGlobalSettings>
+#include <KDebug>
+
#include "kitemlistview.h"
-#include "kitemlistrubberband_p.h"
#include "kitemlistselectionmanager.h"
-#include "kitemlistkeyboardsearchmanager_p.h"
+
+#include "private/kitemlistrubberband.h"
+#include "private/kitemlistkeyboardsearchmanager.h"
#include <QApplication>
#include <QDrag>
#include <QMimeData>
#include <QTimer>
-#include <KGlobalSettings>
-#include <KDebug>
-
KItemListController::KItemListController(QObject* parent) :
QObject(parent),
m_singleClickActivation(KGlobalSettings::singleClick()),
***************************************************************************/
#include "kitemlistheader.h"
-#include "kitemlistheaderwidget_p.h"
#include "kitemlistview.h"
+#include "private/kitemlistheaderwidget.h"
+
KItemListHeader::~KItemListHeader()
{
}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2011 by Tirtha Chatterjee <tirtha.p.chatterjee@gmail.com> *
- * *
- * Based on the Itemviews NG project from Trolltech Labs: *
- * http://qt.gitorious.org/qt-labs/itemviews-ng *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#ifndef KITEMLISTKEYBOARDMANAGER_H
-#define KITEMLISTKEYBOARDMANAGER_H
-
-#include <libdolphin_export.h>
-
-#include <QObject>
-#include <QString>
-#include <QElapsedTimer>
-
-/**
- * @brief Controls the keyboard searching ability for a KItemListController.
- *
- * @see KItemListController
- * @see KItemModelBase
- */
-class LIBDOLPHINPRIVATE_EXPORT KItemListKeyboardSearchManager : public QObject
-{
- Q_OBJECT
-
-public:
-
- KItemListKeyboardSearchManager(QObject* parent = 0);
- virtual ~KItemListKeyboardSearchManager();
-
- /**
- * Add \a keys to the text buffer used for searching.
- */
- void addKeys(const QString& keys);
-
- /**
- * Sets the delay after which the search is cancelled to \a milliseconds.
- * If the time interval between two calls of addKeys(const QString&) is
- * larger than this, the second call will start a new search, rather than
- * combining the keys received from both calls to a single search string.
- */
- void setTimeout(qint64 milliseconds);
- qint64 timeout() const;
-
-signals:
- /**
- * Is emitted if the current item should be changed corresponding
- * to \a text.
- * @param searchFromNextItem If true start searching from item next to the
- * current item. Otherwise, search from the
- * current item.
- */
- // TODO: Think about getting rid of the bool parameter
- // (see http://doc.qt.nokia.com/qq/qq13-apis.html#thebooleanparametertrap)
- void changeCurrentItem(const QString& string, bool searchFromNextItem);
-
-private:
- QString m_searchedString;
- QElapsedTimer m_keyboardInputTime;
- qint64 m_timeout;
-};
-
-#endif
-
-
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#ifndef KITEMLISTRUBBERBAND_H
-#define KITEMLISTRUBBERBAND_H
-
-#include <libdolphin_export.h>
-#include <QObject>
-#include <QPointF>
-
-/**
- * @brief Manages the rubberband when selecting items.
- */
-class LIBDOLPHINPRIVATE_EXPORT KItemListRubberBand : public QObject
-{
- Q_OBJECT
-
-public:
- explicit KItemListRubberBand(QObject* parent = 0);
- virtual ~KItemListRubberBand();
-
- void setStartPosition(const QPointF& pos);
- QPointF startPosition() const;
-
- void setEndPosition(const QPointF& pos);
- QPointF endPosition() const;
-
- void setActive(bool active);
- bool isActive() const;
-
-signals:
- void activationChanged(bool active);
- void startPositionChanged(const QPointF& current, const QPointF& previous);
- void endPositionChanged(const QPointF& current, const QPointF& previous);
-
-private:
- bool m_active;
- QPointF m_startPos;
- QPointF m_endPos;
-};
-
-#endif
-
-
#include "kitemlistcontroller.h"
#include "kitemlistheader.h"
-#include "kitemlistheaderwidget_p.h"
-#include "kitemlistrubberband_p.h"
#include "kitemlistselectionmanager.h"
-#include "kitemlistsizehintresolver_p.h"
-#include "kitemlistviewlayouter_p.h"
-#include "kitemlistviewanimation_p.h"
#include "kitemlistwidget.h"
+#include "private/kitemlistheaderwidget.h"
+#include "private/kitemlistrubberband.h"
+#include "private/kitemlistsizehintresolver.h"
+#include "private/kitemlistviewlayouter.h"
+#include "private/kitemlistviewanimation.h"
+
#include <KDebug>
#include <QCursor>
#include <kitemviews/kitemlistgroupheader.h>
#include <kitemviews/kitemliststyleoption.h>
-#include <kitemviews/kitemlistviewanimation_p.h>
#include <kitemviews/kitemlistwidget.h>
#include <kitemviews/kitemmodelbase.h>
+#include <kitemviews/private/kitemlistviewanimation.h>
#include <QGraphicsWidget>
#include <QSet>
#include "kitemlistwidget.h"
-#include "kitemlistselectiontoggle_p.h"
#include "kitemlistview.h"
#include "kitemmodelbase.h"
+#include "private/kitemlistselectiontoggle.h"
+
#include <KDebug>
#include <KGlobalSettings>
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kfileitemclipboard_p.h"
+#include "kfileitemclipboard.h"
#include <KGlobal>
#include <QApplication>
this, SLOT(updateCutItems()));
}
-#include "kfileitemclipboard_p.moc"
+#include "kfileitemclipboard.moc"
/***************************************************************************
- * Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com> *
+ * Copyright (C) 2006-2012 by Peter Penz <peter.penz19@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "dolphindirlister.h"
+#include "kfileitemmodeldirlister.h"
#include <KLocale>
#include <KIO/JobClasses>
-DolphinDirLister::DolphinDirLister(QObject* parent) :
+KFileItemModelDirLister::KFileItemModelDirLister(QObject* parent) :
KDirLister(parent)
{
setAutoErrorHandlingEnabled(false, 0);
}
-DolphinDirLister::~DolphinDirLister()
+KFileItemModelDirLister::~KFileItemModelDirLister()
{
}
-void DolphinDirLister::handleError(KIO::Job* job)
+void KFileItemModelDirLister::handleError(KIO::Job* job)
{
- if (job->error() == KIO::ERR_IS_FILE) {
- emit urlIsFileError(url());
+ const QString errorString = job->errorString();
+ if (errorString.isEmpty()) {
+ emit errorMessage(i18nc("@info:status", "Unknown error."));
} else {
- const QString errorString = job->errorString();
- if (errorString.isEmpty()) {
- emit errorMessage(i18nc("@info:status", "Unknown error."));
- } else {
- emit errorMessage(errorString);
- }
+ emit errorMessage(errorString);
}
}
-#include "dolphindirlister.moc"
+#include "kfileitemmodeldirlister.moc"
/***************************************************************************
- * Copyright (C) 2006-2009 by Peter Penz <peter.penz19@gmail.com> *
+ * Copyright (C) 2006-2012 by Peter Penz <peter.penz19@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#ifndef DOLPHINDIRLISTER_H
-#define DOLPHINDIRLISTER_H
+#ifndef KFILEITEMMODELDIRLISTER_H
+#define KFILEITEMMODELDIRLISTER_H
#include <libdolphin_export.h>
#include <KDirLister>
/**
* @brief Extends the class KDirLister by emitting a signal when an
* error occurred instead of showing an error dialog.
+ * KDirLister::autoErrorHandlingEnabled() is set to false.
*/
-class LIBDOLPHINPRIVATE_EXPORT DolphinDirLister : public KDirLister
+class LIBDOLPHINPRIVATE_EXPORT KFileItemModelDirLister : public KDirLister
{
Q_OBJECT
public:
- DolphinDirLister(QObject* parent = 0);
- virtual ~DolphinDirLister();
+ KFileItemModelDirLister(QObject* parent = 0);
+ virtual ~KFileItemModelDirLister();
signals:
/** Is emitted whenever an error has occurred. */
void errorMessage(const QString& msg);
- /** Is emitted when the URL of the directory lister represents a file. */
- void urlIsFileError(const KUrl& url);
-
protected:
virtual void handleError(KIO::Job* job);
};
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kfileitemmodelfilter_p.h"
+#include "kfileitemmodelfilter.h"
#include <KFileItem>
#include <QRegExp>
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kfileitemmodelsortalgorithm_p.h"
+#include "kfileitemmodelsortalgorithm.h"
void KFileItemModelSortAlgorithm::sort(KFileItemModel* model,
QList<KFileItemModel::ItemData*>::iterator begin,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistheaderwidget_p.h"
+#include "kitemlistheaderwidget.h"
#include <KAction>
#include <KMenu>
-#include "kitemmodelbase.h"
+#include <kitemviews/kitemmodelbase.h>
#include <QApplication>
#include <QGraphicsSceneHoverEvent>
return -1;
}
-#include "kitemlistheaderwidget_p.moc"
+#include "kitemlistheaderwidget.moc"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistkeyboardsearchmanager_p.h"
+#include "kitemlistkeyboardsearchmanager.h"
#include <QApplication>
#include <QElapsedTimer>
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistrubberband_p.h"
+#include "kitemlistrubberband.h"
KItemListRubberBand::KItemListRubberBand(QObject* parent) :
QObject(parent),
return m_active;
}
-#include "kitemlistrubberband_p.moc"
+#include "kitemlistrubberband.moc"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistselectiontoggle_p.h"
+#include "kitemlistselectiontoggle.h"
#include <KIconEffect>
#include <KIconLoader>
}
}
-#include "kitemlistselectiontoggle_p.moc"
+#include "kitemlistselectiontoggle.moc"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistsizehintresolver_p.h"
+#include "kitemlistsizehintresolver.h"
#include <kitemviews/kitemlistview.h>
#include <KDebug>
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistsmoothscroller_p.h"
+#include "kitemlistsmoothscroller.h"
#include <KGlobalSettings>
#include <QEvent>
event->accept();
}
-#include "kitemlistsmoothscroller_p.moc"
+#include "kitemlistsmoothscroller.moc"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistviewanimation_p.h"
+#include "kitemlistviewanimation.h"
-#include "kitemlistview.h"
+#include <kitemviews/kitemlistview.h>
#include <KDebug>
#include <KGlobalSettings>
Q_ASSERT(false);
}
-#include "kitemlistviewanimation_p.moc"
+#include "kitemlistviewanimation.moc"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "kitemlistviewlayouter_p.h"
+#include "kitemlistviewlayouter.h"
-#include "kitemmodelbase.h"
-#include "kitemlistsizehintresolver_p.h"
+#include <kitemviews/kitemmodelbase.h>
+#include "kitemlistsizehintresolver.h"
#include <KDebug>
return 100;
}
-#include "kitemlistviewlayouter_p.moc"
+#include "kitemlistviewlayouter.moc"
#include <QtDBus/QDBusVariant>
#include <QtCore/QVariant>
-#include "knepomukdatamanagement_export_p.h"
+#include "knepomukdatamanagement_export.h"
namespace Nepomuk {
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "knepomukrolesprovider_p.h"
+#include "knepomukrolesprovider.h"
#include <KDebug>
#include <KGlobal>
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "kpixmapmodifier_p.h"
+#include "kpixmapmodifier.h"
#include <QImage>
#include <QPainter>
#include <kitemviews/kitemlistcontroller.h>
#include <kitemviews/kfileitemmodel.h>
-#include <KDirLister>
#include <KFileItem>
#include <konq_operations.h>
FoldersPanel::FoldersPanel(QWidget* parent) :
Panel(parent),
m_updateCurrentItem(false),
- m_dirLister(0),
m_controller(0)
{
setLayoutDirection(Qt::LeftToRight);
m_controller->setView(0);
delete view;
}
-
- delete m_dirLister;
- m_dirLister = 0;
}
void FoldersPanel::setShowHiddenFiles(bool show)
return false;
}
- if (m_dirLister) {
+ if (m_controller) {
loadTree(url());
}
return;
}
- if (!m_dirLister) {
+ if (!m_controller) {
// Postpone the creating of the dir lister to the first show event.
// This assures that no performance and memory overhead is given when the TreeView is not
// used at all (see FoldersPanel::setUrl()).
- m_dirLister = new KDirLister();
- m_dirLister->setAutoUpdate(true);
- m_dirLister->setMainWindow(window());
- m_dirLister->setDelayedMimeTypes(true);
- m_dirLister->setAutoErrorHandlingEnabled(false, this);
-
KFileItemListView* view = new KFileItemListView();
view->setWidgetCreator(new KItemListWidgetCreator<KFileItemListWidget>());
// opening the folders panel.
view->setOpacity(0);
- KFileItemModel* model = new KFileItemModel(m_dirLister, this);
+ KFileItemModel* model = new KFileItemModel(this);
model->setShowFoldersOnly(true);
model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown());
// Use a QueuedConnection to give the view the possibility to react first on the
// finished loading.
- connect(model, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection);
+ connect(model, SIGNAL(dirLoadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection);
KItemListContainer* container = new KItemListContainer(this);
m_controller = container->controller();
void FoldersPanel::loadTree(const KUrl& url)
{
- Q_ASSERT(m_dirLister);
+ Q_ASSERT(m_controller);
m_updateCurrentItem = false;
baseUrl.setPath(QString('/'));
}
- if (m_dirLister->url() != baseUrl) {
+ KFileItemModel* model = fileItemModel();
+ if (model->dir() != baseUrl) {
m_updateCurrentItem = true;
- m_dirLister->stop();
- m_dirLister->openUrl(baseUrl, KDirLister::Reload);
+ model->refreshDir(baseUrl);
}
- KFileItemModel* model = fileItemModel();
const int index = model->index(url);
if (index >= 0) {
updateCurrentItem(index);
#include <KUrl>
#include <panels/panel.h>
-class KDirLister;
class KFileItemModel;
class KItemListController;
class QGraphicsSceneDragDropEvent;
private:
bool m_updateCurrentItem;
- KDirLister* m_dirLister;
KItemListController* m_controller;
};
# KItemListKeyboardSearchManagerTest
set(kitemlistkeyboardsearchmanagertest_SRCS
kitemlistkeyboardsearchmanagertest.cpp
- ../kitemviews/kitemlistkeyboardsearchmanager.cpp
+ ../kitemviews/private/kitemlistkeyboardsearchmanager.cpp
)
kde4_add_unit_test(kitemlistkeyboardsearchmanagertest TEST ${kitemlistkeyboardsearchmanagertest_SRCS})
target_link_libraries(kitemlistkeyboardsearchmanagertest ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY})
#include <KDirLister>
#include "kitemviews/kfileitemmodel.h"
+#include "kitemviews/private/kfileitemmodeldirlister.h"
#include "testdir.h"
void myMessageOutput(QtMsgType type, const char* msg)
void testDefaultGroupedSorting();
void testNewItems();
void testRemoveItems();
- void testLoadingCompleted();
+ void testDirLoadingCompleted();
void testSetData();
void testSetDataWithModifiedSortRole_data();
void testSetDataWithModifiedSortRole();
private:
KFileItemModel* m_model;
- KDirLister* m_dirLister;
TestDir* m_testDir;
};
qRegisterMetaType<KFileItemList>("KFileItemList");
m_testDir = new TestDir();
- m_dirLister = new KDirLister();
- m_dirLister->setAutoUpdate(false);
- m_model = new KFileItemModel(m_dirLister);
+ m_model = new KFileItemModel();
+ m_model->m_dirLister->setAutoUpdate(false);
}
void KFileItemModelTest::cleanup()
delete m_model;
m_model = 0;
- delete m_dirLister;
- m_dirLister = 0;
-
delete m_testDir;
m_testDir = 0;
}
m_testDir->createFiles(files);
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 3);
files << "a.txt" << "b.txt" << "c.txt";
m_testDir->createFiles(files);
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 3);
{
m_testDir->createFile("a.txt");
m_testDir->createFile("b.txt");
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 2);
QVERIFY(isModelConsistent());
m_testDir->removeFile("a.txt");
- m_dirLister->updateDirectory(m_testDir->url());
+ m_model->m_dirLister->updateDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsRemoved(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 1);
QVERIFY(isModelConsistent());
}
-void KFileItemModelTest::testLoadingCompleted()
+void KFileItemModelTest::testDirLoadingCompleted()
{
- QSignalSpy loadingCompletedSpy(m_model, SIGNAL(loadingCompleted()));
+ QSignalSpy loadingCompletedSpy(m_model, SIGNAL(dirLoadingCompleted()));
QSignalSpy itemsInsertedSpy(m_model, SIGNAL(itemsInserted(KItemRangeList)));
QSignalSpy itemsRemovedSpy(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
m_testDir->createFiles(QStringList() << "a.txt" << "b.txt" << "c.txt");
- m_dirLister->openUrl(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ m_model->loadDir(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
QCOMPARE(loadingCompletedSpy.count(), 1);
QCOMPARE(itemsInsertedSpy.count(), 1);
QCOMPARE(itemsRemovedSpy.count(), 0);
QCOMPARE(m_model->count(), 3);
m_testDir->createFiles(QStringList() << "d.txt" << "e.txt");
- m_dirLister->updateDirectory(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ m_model->m_dirLister->updateDirectory(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
QCOMPARE(loadingCompletedSpy.count(), 2);
QCOMPARE(itemsInsertedSpy.count(), 2);
QCOMPARE(itemsRemovedSpy.count(), 0);
m_testDir->removeFile("a.txt");
m_testDir->createFile("f.txt");
- m_dirLister->updateDirectory(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ m_model->m_dirLister->updateDirectory(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
QCOMPARE(loadingCompletedSpy.count(), 3);
QCOMPARE(itemsInsertedSpy.count(), 3);
QCOMPARE(itemsRemovedSpy.count(), 1);
QCOMPARE(m_model->count(), 5);
m_testDir->removeFile("b.txt");
- m_dirLister->updateDirectory(m_testDir->url());
+ m_model->m_dirLister->updateDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsRemoved(KItemRangeList)), DefaultTimeout));
QCOMPARE(loadingCompletedSpy.count(), 4);
QCOMPARE(itemsInsertedSpy.count(), 3);
{
m_testDir->createFile("a.txt");
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QHash<QByteArray, QVariant> values;
files << "a.txt" << "b.txt" << "c.txt";
m_testDir->createFiles(files);
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// Fill the "rating" role of each file:
// KFileItemModel to do a lot of insert operation and hence decrease
// the timeout to 1 millisecond.
m_testDir->createFile("1");
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 1);
m_testDir->createFile(QString::number(itemName));
}
- m_dirLister->updateDirectory(m_testDir->url());
+ m_model->m_dirLister->updateDirectory(m_testDir->url());
if (spy.count() == 0) {
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
}
// Due to inserting the 3 items one item-range with index == 0 and
// count == 3 must be given
QSignalSpy spy1(m_model, SIGNAL(itemsInserted(KItemRangeList)));
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(spy1.count(), 1);
m_testDir->createFiles(files);
QSignalSpy spy2(m_model, SIGNAL(itemsInserted(KItemRangeList)));
- m_dirLister->updateDirectory(m_testDir->url());
+ m_model->m_dirLister->updateDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(spy2.count(), 1);
QSet<KUrl> allFolders;
allFolders << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1");
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// So far, the model contains only "a/"
QCOMPARE(m_model->count(), 0);
QVERIFY(m_model->expandedUrls().empty());
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
m_model->restoreExpandedUrls(allFolders);
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 5); // 5 items: "a/", "a/a/", "a/a/1", "a/a-1/", "a/a-1/1"
QVERIFY(m_model->isExpanded(0));
QVERIFY(m_model->isExpanded(1));
// Move to a sub folder, then call restoreExpandedFolders() *before* going back.
// This is how DolphinView restores the expanded folders when navigating in history.
- m_dirLister->openUrl(KUrl(m_testDir->name() + "a/a/"));
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ m_model->loadDir(KUrl(m_testDir->name() + "a/a/"));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 1); // 1 item: "1"
m_model->restoreExpandedUrls(allFolders);
- m_dirLister->openUrl(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ m_model->loadDir(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 5); // 5 items: "a/", "a/a/", "a/a/1", "a/a-1/", "a/a-1/1"
QCOMPARE(m_model->expandedUrls(), allFolders);
}
files << "a 1/b1/c1/file.txt" << "a2/b2/c2/d2/file.txt"; // missing folders are created automatically
m_testDir->createFiles(files);
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// So far, the model contains only "a 1/" and "a2/".
// Expand the parents of "a2/b2/c2".
m_model->expandParentItems(KUrl(m_testDir->name() + "a2/b2/c2"));
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
// The model should now contain "a 1/", "a2/", "a2/b2/", and "a2/b2/c2/".
// It's important that only the parents of "a1/b1/c1" are expanded.
// Expand the parents of "a 1/b1".
m_model->expandParentItems(KUrl(m_testDir->name() + "a 1/b1"));
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
// The model should now contain "a 1/", "a 1/b1/", "a2/", "a2/b2", and "a2/b2/c2/".
// It's important that only the parents of "a 1/b1/" and "a2/b2/c2/" are expanded.
m_testDir->createFile("e", "An even larger file", now.addDays(-4));
m_testDir->createFile(".f");
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
int index = m_model->index(KUrl(m_testDir->url().url() + "c"));
files << "a" << "aa" << "Image.jpg" << "Image.png" << "Text" << "Text1" << "Text2" << "Text11";
m_testDir->createFiles(files);
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// Search from index 0
files << "A1" << "A2" << "Abc" << "Bcd" << "Cde";
m_testDir->createFiles(files);
- m_dirLister->openUrl(m_testDir->url());
+ m_model->loadDir(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
m_model->setNameFilter("A"); // Shows A1, A2 and Abc
#include <qtestmouse.h>
#include <qtestkeyboard.h>
-#include <KDirLister>
#include "kitemviews/kitemlistcontainer.h"
#include "kitemviews/kfileitemlistview.h"
#include "kitemviews/kfileitemmodel.h"
#include "kitemviews/kitemlistcontroller.h"
#include "kitemviews/kitemlistselectionmanager.h"
-#include "kitemviews/kitemlistviewlayouter_p.h"
+#include "kitemviews/private/kitemlistviewlayouter.h"
#include "testdir.h"
namespace {
KItemListController* m_controller;
KItemListSelectionManager* m_selectionManager;
KFileItemModel* m_model;
- KDirLister* m_dirLister;
TestDir* m_testDir;
KItemListContainer* m_container;
};
qRegisterMetaType<QSet<int> >("QSet<int>");
m_testDir = new TestDir();
- m_dirLister = new KDirLister();
- m_model = new KFileItemModel(m_dirLister);
+ m_model = new KFileItemModel();
m_container = new KItemListContainer();
m_controller = m_container->controller();
m_controller->setSelectionBehavior(KItemListController::MultiSelection);
<< "e1" << "e2" << "e3" << "e4" << "e5" << "e6" << "e7";
m_testDir->createFiles(files);
- m_dirLister->openUrl(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+ m_model->loadDir(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
m_container->show();
QTest::qWaitForWindowShown(m_container);
delete m_model;
m_model = 0;
- delete m_dirLister;
- m_dirLister = 0;
-
delete m_testDir;
m_testDir = 0;
}
#include <qtest_kde.h>
-#include "kitemviews/kitemlistkeyboardsearchmanager_p.h"
+#include "kitemviews/private/kitemlistkeyboardsearchmanager.h"
class KItemListKeyboardSearchManagerTest : public QObject
{
#include <kitemviews/kitemlistcontroller.h>
#include <kitemviews/kitemliststyleoption.h>
-#include <KDirLister>
#include <KGlobalSettings>
#include <views/viewmodecontroller.h>
#include "zoomlevelinfo.h"
-DolphinItemListContainer::DolphinItemListContainer(KDirLister* dirLister,
- QWidget* parent) :
+DolphinItemListContainer::DolphinItemListContainer(QWidget* parent) :
KItemListContainer(parent),
m_zoomLevel(0),
m_fileItemListView(0)
{
- controller()->setModel(new KFileItemModel(dirLister, this));
+ controller()->setModel(new KFileItemModel(this));
m_fileItemListView = new KFileItemListView();
controller()->setView(m_fileItemListView);
#include <libdolphin_export.h>
-class KDirLister;
class KFileItemListView;
/**
Q_OBJECT
public:
- explicit DolphinItemListContainer(KDirLister* dirLister,
- QWidget* parent = 0);
+ explicit DolphinItemListContainer(QWidget* parent = 0);
virtual ~DolphinItemListContainer();
#include <KActionCollection>
#include <KColorScheme>
-#include <KDirLister>
#include <KDirModel>
#include <KIconEffect>
#include <KFileItem>
#include <KToggleAction>
#include <KUrl>
-#include "dolphindirlister.h"
#include "dolphinnewfilemenuobserver.h"
#include "dolphin_detailsmodesettings.h"
#include "dolphin_generalsettings.h"
m_mode(DolphinView::IconsView),
m_visibleRoles(),
m_topLayout(0),
- m_dirLister(0),
m_container(0),
m_toolTipManager(0),
m_selectionChangedTimer(0),
connect(m_selectionChangedTimer, SIGNAL(timeout()),
this, SLOT(emitSelectionChangedSignal()));
- m_dirLister = new DolphinDirLister(this);
- m_dirLister->setAutoUpdate(true);
- m_dirLister->setDelayedMimeTypes(true);
-
- connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(slotRedirection(KUrl,KUrl)));
- connect(m_dirLister, SIGNAL(started(KUrl)), this, SLOT(slotDirListerStarted(KUrl)));
- connect(m_dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)),
- this, SLOT(slotRefreshItems()));
-
- connect(m_dirLister, SIGNAL(clear()), this, SIGNAL(itemCountChanged()));
- connect(m_dirLister, SIGNAL(newItems(KFileItemList)), this, SIGNAL(itemCountChanged()));
- connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
- connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(infoMessage(QString)));
- connect(m_dirLister, SIGNAL(percent(int)), this, SIGNAL(pathLoadingProgress(int)));
- connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
- connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SIGNAL(itemCountChanged()));
-
- m_container = new DolphinItemListContainer(m_dirLister, this);
+ m_container = new DolphinItemListContainer(this);
m_container->setVisibleRoles(QList<QByteArray>() << "name");
m_container->installEventFilter(this);
setFocusProxy(m_container);
connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
KFileItemModel* model = fileItemModel();
- if (model) {
- connect(model, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
- connect(model, SIGNAL(sortProgress(int)), this, SIGNAL(sortProgress(int)));
- }
+ connect(model, SIGNAL(dirLoadingStarted()), this, SLOT(slotDirLoadingStarted()));
+ connect(model, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
+ connect(model, SIGNAL(dirLoadingProgress(int)), this, SIGNAL(dirLoadingProgress(int)));
+ connect(model, SIGNAL(dirSortingProgress(int)), this, SIGNAL(dirSortingProgress(int)));
+ connect(model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
+ this, SLOT(slotItemsChanged()));
+ connect(model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged()));
+ connect(model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged()));
+ connect(model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
+ connect(model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
+ connect(model, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(slotRedirection(KUrl,KUrl)));
KItemListView* view = controller->view();
view->installEventFilter(this);
void DolphinView::setHiddenFilesShown(bool show)
{
- if (m_dirLister->showingDotFiles() == show) {
+ KFileItemModel* model = fileItemModel();
+ if (model->showHiddenFiles() == show) {
return;
}
ViewProperties props(url());
props.setHiddenFilesShown(show);
- fileItemModel()->setShowHiddenFiles(show);
+ model->setShowHiddenFiles(show);
emit hiddenFilesShownChanged(show);
}
bool DolphinView::hiddenFilesShown() const
{
- return m_dirLister->showingDotFiles();
+ return fileItemModel()->showHiddenFiles();
}
void DolphinView::setGroupedSorting(bool grouped)
KFileItemList DolphinView::items() const
{
- return m_dirLister->items();
+ KFileItemList list;
+ const KFileItemModel* model = fileItemModel();
+ const int itemCount = model->count();
+ list.reserve(itemCount);
+
+ for (int i = 0; i < itemCount; ++i) {
+ list.append(model->fileItem(i));
+ }
+
+ return list;
+}
+
+int DolphinView::itemsCount() const
+{
+ return fileItemModel()->count();
}
KFileItemList DolphinView::selectedItems() const
void DolphinView::stopLoading()
{
- m_dirLister->stop();
+ fileItemModel()->cancelDirLoading();
}
void DolphinView::readSettings()
int& folderCount,
KIO::filesize_t& totalFileSize) const
{
- foreach (const KFileItem& item, m_dirLister->items()) {
+ const KFileItemModel* model = fileItemModel();
+ const int itemCount = model->count();
+ for (int i = 0; i < itemCount; ++i) {
+ const KFileItem item = model->fileItem(i);
if (item.isDir()) {
++folderCount;
} else {
dialog->activateWindow();
//}
- // assure that the current index remains visible when KDirLister
- // will notify the view about changed items
+ // Assure that the current index remains visible when KFileItemModel
+ // will notify the view about changed items (which might result in
+ // a changed sorting).
m_assureVisibleCurrentIndex = true;
}
void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
{
if (previous != 0) {
- disconnect(previous, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
+ disconnect(previous, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
}
Q_ASSERT(qobject_cast<KFileItemModel*>(current));
- connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
+ connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
m_versionControlObserver->setModel(fileItemModel);
KFileItem DolphinView::rootItem() const
{
- return m_dirLister->rootItem();
+ return fileItemModel()->rootItem();
}
void DolphinView::observeCreatedItem(const KUrl& url)
}
}
-void DolphinView::slotDirListerStarted(const KUrl& url)
+void DolphinView::slotDirLoadingStarted()
{
// Disable the writestate temporary until it can be determined in a fast way
// in DolphinView::slotLoadingCompleted()
emit writeStateChanged(m_isFolderWritable);
}
- emit startedPathLoading(url);
+ emit startedDirLoading(url());
}
-void DolphinView::slotLoadingCompleted()
+void DolphinView::slotDirLoadingCompleted()
{
// Update the view-state. This has to be done using a Qt::QueuedConnection
// because the view might not be in its final state yet.
QTimer::singleShot(0, this, SLOT(updateViewState()));
- emit finishedPathLoading(url());
+ emit finishedDirLoading(url());
updateWritableState();
}
-void DolphinView::slotRefreshItems()
+void DolphinView::slotItemsChanged()
{
- if (m_assureVisibleCurrentIndex) {
- m_assureVisibleCurrentIndex = false;
- //QAbstractItemView* view = m_viewAccessor.itemView();
- //if (view) {
- // m_viewAccessor.itemView()->scrollTo(m_viewAccessor.itemView()->currentIndex());
- //}
- }
+ m_assureVisibleCurrentIndex = false;
}
void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous)
return;
}
- m_dirLister->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
+ KFileItemModel* model = fileItemModel();
+ if (reload) {
+ model->refreshDir(url);
+ } else {
+ model->loadDir(url);
+ }
}
void DolphinView::applyViewProperties()
const bool wasFolderWritable = m_isFolderWritable;
m_isFolderWritable = true;
- const KFileItem item = m_dirLister->rootItem();
+ const KFileItem item = fileItemModel()->rootItem();
if (!item.isNull()) {
KFileItemListProperties capabilities(KFileItemList() << item);
m_isFolderWritable = capabilities.supportsWriting();
typedef KIO::FileUndoManager::CommandType CommandType;
-class DolphinDirLister;
class DolphinItemListContainer;
class KAction;
class KActionCollection;
*/
KFileItemList items() const;
+ /**
+ * @return The number of items. itemsCount() is faster in comparison
+ * to items().count().
+ */
+ int itemsCount() const;
+
/**
* Returns the selected items. The list is empty if no item has been
* selected.
/**
* Is emitted after DolphinView::setUrl() has been invoked and
- * the path \a url is currently loaded. If this signal is emitted,
+ * the directory \a url is currently loaded. If this signal is emitted,
* it is assured that the view contains already the correct root
* URL and property settings.
*/
- void startedPathLoading(const KUrl& url);
+ void startedDirLoading(const KUrl& url);
/**
- * Is emitted after the path triggered by DolphinView::setUrl()
+ * Is emitted after the directory triggered by DolphinView::setUrl()
* has been loaded.
*/
- void finishedPathLoading(const KUrl& url);
+ void finishedDirLoading(const KUrl& url);
/**
* Is emitted after DolphinView::setUrl() has been invoked and provides
- * the information how much percent of the current path have been loaded.
+ * the information how much percent of the current directory have been loaded.
*/
- void pathLoadingProgress(int percent);
+ void dirLoadingProgress(int percent);
- void sortProgress(int percent);
+ /**
+ * Is emitted if the sorting is done asynchronously and provides the
+ * progress information of the sorting.
+ */
+ void dirSortingProgress(int percent);
/**
* Is emitted if the DolphinView::setUrl() is invoked but the URL is not
void urlIsFileError(const KUrl& file);
/**
- * Emitted when KDirLister emits redirection.
+ * Emitted when the file-item-model emits redirection.
* Testcase: fish://localhost
*/
void redirection(const KUrl& oldUrl, const KUrl& newUrl);
void slotDeleteFileFinished(KJob* job);
/**
- * Invoked when the directory lister has been started the
- * loading of \a url.
+ * Invoked when the file item model has started the loading
+ * of the directory specified by DolphinView::url().
*/
- void slotDirListerStarted(const KUrl& url);
+ void slotDirLoadingStarted();
/**
- * Invoked when the file item model indicates that the directory lister has completed the loading
- * of items, and that expanded folders have been restored (if the view mode is 'Details', and the
- * view state is restored after navigating back or forward in history). Assures that pasted items
- * and renamed items get seleced.
+ * Invoked when the file item model indicates that the loading of a directory has
+ * been completed. Assures that pasted items and renamed items get seleced.
*/
- void slotLoadingCompleted();
+ void slotDirLoadingCompleted();
/**
- * Is invoked when the KDirLister indicates refreshed items.
+ * Is invoked when items of KFileItemModel have been changed.
*/
- void slotRefreshItems();
+ void slotItemsChanged();
/**
* Is invoked when the sort order has been changed by the user by clicking
QVBoxLayout* m_topLayout;
- DolphinDirLister* m_dirLister;
DolphinItemListContainer* m_container;
ToolTipManager* m_toolTipManager;
#include "dolphin_versioncontrolsettings.h"
-#include <KDirLister>
#include <KLocale>
#include <KService>
#include <KServiceTypeTrader>
#include "updateitemstatesthread.h"
+#include <QFile>
#include <QMutexLocker>
#include <QTimer>
// Verify whether the current directory contains revision information
// like .svn, .git, ...
foreach (KVersionControlPlugin* plugin, plugins) {
- // Use the KDirLister cache to check for .svn, .git, ... files
const QString fileName = directory.path(KUrl::AddTrailingSlash) + plugin->fileName();
if (QFile::exists(fileName)) {
return plugin;