mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 00:11:21 +00:00
KItemViews: Internal directory restructuration
- Move all private headers from the kitemviews-directory into the 'private' subdirectory. - Get rid of DolphinDirLister and just use a directory-lister internally in KFileItemModel. - Minor interface-cleanups for signals
This commit is contained in:
parent
d9dbd3398a
commit
6c3d9acbc2
|
@ -18,38 +18,38 @@ add_subdirectory(tests)
|
||||||
########### next target ###############
|
########### next target ###############
|
||||||
|
|
||||||
set(dolphinprivate_LIB_SRCS
|
set(dolphinprivate_LIB_SRCS
|
||||||
kitemviews/kfileitemclipboard.cpp
|
|
||||||
kitemviews/kfileitemlistgroupheader.cpp
|
kitemviews/kfileitemlistgroupheader.cpp
|
||||||
kitemviews/kfileitemlistview.cpp
|
kitemviews/kfileitemlistview.cpp
|
||||||
kitemviews/kfileitemlistwidget.cpp
|
kitemviews/kfileitemlistwidget.cpp
|
||||||
kitemviews/kfileitemmodel.cpp
|
kitemviews/kfileitemmodel.cpp
|
||||||
kitemviews/kfileitemmodelsortalgorithm.cpp
|
|
||||||
kitemviews/kfileitemmodelfilter.cpp
|
|
||||||
kitemviews/kfileitemmodelrolesupdater.cpp
|
kitemviews/kfileitemmodelrolesupdater.cpp
|
||||||
kitemviews/kitemlistcontainer.cpp
|
kitemviews/kitemlistcontainer.cpp
|
||||||
kitemviews/kitemlistcontroller.cpp
|
kitemviews/kitemlistcontroller.cpp
|
||||||
kitemviews/kitemlistgroupheader.cpp
|
kitemviews/kitemlistgroupheader.cpp
|
||||||
kitemviews/kitemlistheader.cpp
|
kitemviews/kitemlistheader.cpp
|
||||||
kitemviews/kitemlistheaderwidget.cpp
|
|
||||||
kitemviews/kitemlistkeyboardsearchmanager.cpp
|
|
||||||
kitemviews/kitemlistrubberband.cpp
|
|
||||||
kitemviews/kitemlistselectionmanager.cpp
|
kitemviews/kitemlistselectionmanager.cpp
|
||||||
kitemviews/kitemlistselectiontoggle.cpp
|
|
||||||
kitemviews/kitemlistsizehintresolver.cpp
|
|
||||||
kitemviews/kitemlistsmoothscroller.cpp
|
|
||||||
kitemviews/kitemliststyleoption.cpp
|
kitemviews/kitemliststyleoption.cpp
|
||||||
kitemviews/kitemlistview.cpp
|
kitemviews/kitemlistview.cpp
|
||||||
kitemviews/kitemlistviewanimation.cpp
|
|
||||||
kitemviews/kitemlistviewlayouter.cpp
|
|
||||||
kitemviews/kitemlistwidget.cpp
|
kitemviews/kitemlistwidget.cpp
|
||||||
kitemviews/kitemmodelbase.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/additionalinfodialog.cpp
|
||||||
settings/applyviewpropsjob.cpp
|
settings/applyviewpropsjob.cpp
|
||||||
settings/viewmodes/viewmodesettings.cpp
|
settings/viewmodes/viewmodesettings.cpp
|
||||||
settings/viewpropertiesdialog.cpp
|
settings/viewpropertiesdialog.cpp
|
||||||
settings/viewpropsprogressinfo.cpp
|
settings/viewpropsprogressinfo.cpp
|
||||||
views/dolphindirlister.cpp
|
|
||||||
views/dolphinfileitemlistwidget.cpp
|
views/dolphinfileitemlistwidget.cpp
|
||||||
views/dolphinitemlistcontainer.cpp
|
views/dolphinitemlistcontainer.cpp
|
||||||
views/dolphinnewfilemenuobserver.cpp
|
views/dolphinnewfilemenuobserver.cpp
|
||||||
|
@ -71,7 +71,7 @@ set(dolphinprivate_LIB_SRCS
|
||||||
if (Nepomuk_FOUND)
|
if (Nepomuk_FOUND)
|
||||||
set(dolphinprivate_LIB_SRCS
|
set(dolphinprivate_LIB_SRCS
|
||||||
${dolphinprivate_LIB_SRCS}
|
${dolphinprivate_LIB_SRCS}
|
||||||
kitemviews/knepomukrolesprovider.cpp
|
kitemviews/private/knepomukrolesprovider.cpp
|
||||||
)
|
)
|
||||||
endif (Nepomuk_FOUND)
|
endif (Nepomuk_FOUND)
|
||||||
|
|
||||||
|
|
|
@ -2088,9 +2088,9 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
|
||||||
this, SLOT(openNewTab(KUrl)));
|
this, SLOT(openNewTab(KUrl)));
|
||||||
connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
|
connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
|
||||||
this, SLOT(openContextMenu(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()));
|
this, SLOT(enableStopAction()));
|
||||||
connect(view, SIGNAL(finishedPathLoading(KUrl)),
|
connect(view, SIGNAL(finishedDirLoading(KUrl)),
|
||||||
this, SLOT(disableStopAction()));
|
this, SLOT(disableStopAction()));
|
||||||
connect(view, SIGNAL(goBackRequested()),
|
connect(view, SIGNAL(goBackRequested()),
|
||||||
this, SLOT(goBack()));
|
this, SLOT(goBack()));
|
||||||
|
|
|
@ -45,11 +45,11 @@
|
||||||
#include "views/dolphinviewactionhandler.h"
|
#include "views/dolphinviewactionhandler.h"
|
||||||
#include "views/dolphinnewfilemenuobserver.h"
|
#include "views/dolphinnewfilemenuobserver.h"
|
||||||
#include "views/dolphinremoteencoding.h"
|
#include "views/dolphinremoteencoding.h"
|
||||||
#include "views/dolphindirlister.h"
|
|
||||||
|
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
|
K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
|
||||||
K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
|
K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
|
||||||
|
@ -69,8 +69,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
|
||||||
m_view->setTabsForFilesEnabled(true);
|
m_view->setTabsForFilesEnabled(true);
|
||||||
setWidget(m_view);
|
setWidget(m_view);
|
||||||
|
|
||||||
connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotCompleted(KUrl)));
|
connect(m_view, SIGNAL(finishedDirLoading(KUrl)), this, SLOT(slotCompleted(KUrl)));
|
||||||
connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateProgress(int)));
|
connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateProgress(int)));
|
||||||
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
|
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
|
||||||
|
|
||||||
setXMLFile("dolphinpart.rc");
|
setXMLFile("dolphinpart.rc");
|
||||||
|
|
|
@ -99,14 +99,13 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
|
||||||
connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(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(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
|
||||||
connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
|
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(startedDirLoading(KUrl)), this, SLOT(slotStartedDirLoading()));
|
||||||
connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotFinishedPathLoading()));
|
connect(m_view, SIGNAL(finishedDirLoading(KUrl)), this, SLOT(slotFinishedDirLoading()));
|
||||||
connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
|
connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
|
||||||
connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateLoadingProgress(int)));
|
connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateDirLoadingProgress(int)));
|
||||||
connect(m_view, SIGNAL(sortProgress(int)), this, SLOT(updateSortProgress(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(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
|
||||||
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(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(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
|
connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
|
||||||
connect(m_view, SIGNAL(operationCompletedMessage(QString)), this, SLOT(showOperationCompletedMessage(QString)));
|
connect(m_view, SIGNAL(operationCompletedMessage(QString)), this, SLOT(showOperationCompletedMessage(QString)));
|
||||||
connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
|
connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
|
||||||
|
@ -333,7 +332,7 @@ void DolphinViewContainer::updateStatusBar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::updateLoadingProgress(int percent)
|
void DolphinViewContainer::updateDirLoadingProgress(int percent)
|
||||||
{
|
{
|
||||||
if (m_statusBar->progressText().isEmpty()) {
|
if (m_statusBar->progressText().isEmpty()) {
|
||||||
m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
|
m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
|
||||||
|
@ -341,7 +340,7 @@ void DolphinViewContainer::updateLoadingProgress(int percent)
|
||||||
m_statusBar->setProgress(percent);
|
m_statusBar->setProgress(percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::updateSortProgress(int percent)
|
void DolphinViewContainer::updateSortingProgress(int percent)
|
||||||
{
|
{
|
||||||
if (m_statusBar->progressText().isEmpty()) {
|
if (m_statusBar->progressText().isEmpty()) {
|
||||||
m_statusBar->setProgressText(i18nc("@info:progress", "Sorting..."));
|
m_statusBar->setProgressText(i18nc("@info:progress", "Sorting..."));
|
||||||
|
@ -349,7 +348,7 @@ void DolphinViewContainer::updateSortProgress(int percent)
|
||||||
m_statusBar->setProgress(percent);
|
m_statusBar->setProgress(percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::slotStartedPathLoading()
|
void DolphinViewContainer::slotStartedDirLoading()
|
||||||
{
|
{
|
||||||
if (isSearchUrl(url())) {
|
if (isSearchUrl(url())) {
|
||||||
// Search KIO-slaves usually don't provide any progress information. Give
|
// Search KIO-slaves usually don't provide any progress information. Give
|
||||||
|
@ -361,18 +360,18 @@ void DolphinViewContainer::slotStartedPathLoading()
|
||||||
// Trigger an undetermined progress indication. The progress
|
// Trigger an undetermined progress indication. The progress
|
||||||
// information in percent will be triggered by the percent() signal
|
// information in percent will be triggered by the percent() signal
|
||||||
// of the directory lister later.
|
// of the directory lister later.
|
||||||
updateLoadingProgress(-1);
|
updateDirLoadingProgress(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::slotFinishedPathLoading()
|
void DolphinViewContainer::slotFinishedDirLoading()
|
||||||
{
|
{
|
||||||
if (!m_statusBar->progressText().isEmpty()) {
|
if (!m_statusBar->progressText().isEmpty()) {
|
||||||
m_statusBar->setProgressText(QString());
|
m_statusBar->setProgressText(QString());
|
||||||
m_statusBar->setProgress(100);
|
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
|
// 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:
|
// 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);
|
m_statusBar->setMessage(i18nc("@info:status", "No items found."), DolphinStatusBar::Information);
|
||||||
|
@ -422,12 +421,6 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item)
|
||||||
item.run();
|
item.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::openFile(const KUrl& url)
|
|
||||||
{
|
|
||||||
const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
|
|
||||||
slotItemActivated(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DolphinViewContainer::showItemInfo(const KFileItem& item)
|
void DolphinViewContainer::showItemInfo(const KFileItem& item)
|
||||||
{
|
{
|
||||||
if (item.isNull()) {
|
if (item.isNull()) {
|
||||||
|
|
|
@ -154,21 +154,21 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void updateStatusBar();
|
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
|
* Updates the statusbar to show an undetermined progress with the correct
|
||||||
* context information whether a searching or a directory loading is done.
|
* 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
|
* Assures that the viewport position is restored and updates the
|
||||||
* statusbar to reflect the current content.
|
* statusbar to reflect the current content.
|
||||||
*/
|
*/
|
||||||
void slotFinishedPathLoading();
|
void slotFinishedDirLoading();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles clicking on an item. If the item is a directory, the
|
* Handles clicking on an item. If the item is a directory, the
|
||||||
|
@ -177,13 +177,6 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void slotItemActivated(const KFileItem& item);
|
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
|
* Shows the information for the item \a item inside the statusbar. If the
|
||||||
* item is null, the default statusbar information is shown.
|
* item is null, the default statusbar information is shown.
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
#include "kfileitemmodelrolesupdater.h"
|
#include "kfileitemmodelrolesupdater.h"
|
||||||
#include "kfileitemlistwidget.h"
|
#include "kfileitemlistwidget.h"
|
||||||
#include "kfileitemmodel.h"
|
#include "kfileitemmodel.h"
|
||||||
#include "kpixmapmodifier_p.h"
|
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KStringHandler>
|
#include <KStringHandler>
|
||||||
|
#include "private/kpixmapmodifier.h"
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
|
|
|
@ -19,10 +19,8 @@
|
||||||
|
|
||||||
#include "kfileitemlistwidget.h"
|
#include "kfileitemlistwidget.h"
|
||||||
|
|
||||||
#include "kfileitemclipboard_p.h"
|
|
||||||
#include "kfileitemlistview.h"
|
#include "kfileitemlistview.h"
|
||||||
#include "kfileitemmodel.h"
|
#include "kfileitemmodel.h"
|
||||||
#include "kpixmapmodifier_p.h"
|
|
||||||
|
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KIconEffect>
|
#include <KIconEffect>
|
||||||
|
@ -32,6 +30,9 @@
|
||||||
#include <KStringHandler>
|
#include <KStringHandler>
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
|
||||||
|
#include "private/kfileitemclipboard.h"
|
||||||
|
#include "private/kpixmapmodifier.h"
|
||||||
|
|
||||||
#include <QFontMetricsF>
|
#include <QFontMetricsF>
|
||||||
#include <QGraphicsSceneResizeEvent>
|
#include <QGraphicsSceneResizeEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -193,12 +194,15 @@ QRectF KFileItemListWidget::textRect() const
|
||||||
|
|
||||||
QRectF KFileItemListWidget::textFocusRect() const
|
QRectF KFileItemListWidget::textFocusRect() const
|
||||||
{
|
{
|
||||||
const_cast<KFileItemListWidget*>(this)->triggerCacheRefreshing();
|
// In the compact- and details-layout a larger textRect() is returned to be aligned
|
||||||
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
|
// 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
|
// 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.
|
// focus rectangle should be shown as narrow as possible around the text.
|
||||||
|
|
||||||
|
const_cast<KFileItemListWidget*>(this)->triggerCacheRefreshing();
|
||||||
|
|
||||||
|
switch (m_layout) {
|
||||||
|
case CompactLayout: {
|
||||||
QRectF rect = m_textRect;
|
QRectF rect = m_textRect;
|
||||||
const TextInfo* topText = m_textInfo.value(m_sortedVisibleRoles.first());
|
const TextInfo* topText = m_textInfo.value(m_sortedVisibleRoles.first());
|
||||||
const TextInfo* bottomText = m_textInfo.value(m_sortedVisibleRoles.last());
|
const TextInfo* bottomText = m_textInfo.value(m_sortedVisibleRoles.last());
|
||||||
|
@ -206,6 +210,19 @@ QRectF KFileItemListWidget::textFocusRect() const
|
||||||
rect.setBottom(bottomText->pos.y() + bottomText->staticText.size().height());
|
rect.setBottom(bottomText->pos.y() + bottomText->staticText.size().height());
|
||||||
return rect;
|
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;
|
return m_textRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,26 +19,27 @@
|
||||||
|
|
||||||
#include "kfileitemmodel.h"
|
#include "kfileitemmodel.h"
|
||||||
|
|
||||||
#include <KDirLister>
|
|
||||||
#include <KDirModel>
|
#include <KDirModel>
|
||||||
#include "kfileitemmodelsortalgorithm_p.h"
|
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KStringHandler>
|
#include <KStringHandler>
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
|
||||||
|
#include "private/kfileitemmodelsortalgorithm.h"
|
||||||
|
#include "private/kfileitemmodeldirlister.h"
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
// #define KFILEITEMMODEL_DEBUG
|
// #define KFILEITEMMODEL_DEBUG
|
||||||
|
|
||||||
KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
|
KFileItemModel::KFileItemModel(QObject* parent) :
|
||||||
KItemModelBase("name", parent),
|
KItemModelBase("name", parent),
|
||||||
m_dirLister(dirLister),
|
m_dirLister(0),
|
||||||
m_naturalSorting(KGlobalSettings::naturalSorting()),
|
m_naturalSorting(KGlobalSettings::naturalSorting()),
|
||||||
m_sortFoldersFirst(true),
|
m_sortFoldersFirst(true),
|
||||||
m_sortRole(NameRole),
|
m_sortRole(NameRole),
|
||||||
m_sortProgressPercent(-1),
|
m_sortingProgressPercent(-1),
|
||||||
m_roles(),
|
m_roles(),
|
||||||
m_caseSensitivity(Qt::CaseInsensitive),
|
m_caseSensitivity(Qt::CaseInsensitive),
|
||||||
m_itemData(),
|
m_itemData(),
|
||||||
|
@ -54,6 +55,22 @@ KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
|
||||||
m_expandedUrls(),
|
m_expandedUrls(),
|
||||||
m_urlsToExpand()
|
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
|
// Apply default roles that should be determined
|
||||||
resetRoles();
|
resetRoles();
|
||||||
m_requestRole[NameRole] = true;
|
m_requestRole[NameRole] = true;
|
||||||
|
@ -61,16 +78,6 @@ KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
|
||||||
m_roles.insert("name");
|
m_roles.insert("name");
|
||||||
m_roles.insert("isDir");
|
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
|
// 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.
|
// before the completed() or canceled() signal has been emitted.
|
||||||
m_maximumUpdateIntervalTimer = new QTimer(this);
|
m_maximumUpdateIntervalTimer = new QTimer(this);
|
||||||
|
@ -96,6 +103,21 @@ KFileItemModel::~KFileItemModel()
|
||||||
m_itemData.clear();
|
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
|
int KFileItemModel::count() const
|
||||||
{
|
{
|
||||||
return m_itemData.count();
|
return m_itemData.count();
|
||||||
|
@ -160,34 +182,26 @@ bool KFileItemModel::sortFoldersFirst() const
|
||||||
|
|
||||||
void KFileItemModel::setShowHiddenFiles(bool show)
|
void KFileItemModel::setShowHiddenFiles(bool show)
|
||||||
{
|
{
|
||||||
KDirLister* dirLister = m_dirLister.data();
|
m_dirLister->setShowingDotFiles(show);
|
||||||
if (dirLister) {
|
m_dirLister->emitChanges();
|
||||||
dirLister->setShowingDotFiles(show);
|
|
||||||
dirLister->emitChanges();
|
|
||||||
if (show) {
|
if (show) {
|
||||||
slotCompleted();
|
slotCompleted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool KFileItemModel::showHiddenFiles() const
|
bool KFileItemModel::showHiddenFiles() const
|
||||||
{
|
{
|
||||||
const KDirLister* dirLister = m_dirLister.data();
|
return m_dirLister->showingDotFiles();
|
||||||
return dirLister ? dirLister->showingDotFiles() : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KFileItemModel::setShowFoldersOnly(bool enabled)
|
void KFileItemModel::setShowFoldersOnly(bool enabled)
|
||||||
{
|
{
|
||||||
KDirLister* dirLister = m_dirLister.data();
|
m_dirLister->setDirOnlyMode(enabled);
|
||||||
if (dirLister) {
|
|
||||||
dirLister->setDirOnlyMode(enabled);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KFileItemModel::showFoldersOnly() const
|
bool KFileItemModel::showFoldersOnly() const
|
||||||
{
|
{
|
||||||
KDirLister* dirLister = m_dirLister.data();
|
return m_dirLister->dirOnlyMode();
|
||||||
return dirLister ? dirLister->dirOnlyMode() : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData* KFileItemModel::createMimeData(const QSet<int>& indexes) const
|
QMimeData* KFileItemModel::createMimeData(const QSet<int>& indexes) const
|
||||||
|
@ -324,11 +338,7 @@ int KFileItemModel::index(const KUrl& url) const
|
||||||
|
|
||||||
KFileItem KFileItemModel::rootItem() const
|
KFileItem KFileItemModel::rootItem() const
|
||||||
{
|
{
|
||||||
const KDirLister* dirLister = m_dirLister.data();
|
return m_dirLister->rootItem();
|
||||||
if (dirLister) {
|
|
||||||
return dirLister->rootItem();
|
|
||||||
}
|
|
||||||
return KFileItem();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KFileItemModel::clear()
|
void KFileItemModel::clear()
|
||||||
|
@ -391,21 +401,14 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
KDirLister* dirLister = m_dirLister.data();
|
|
||||||
const KUrl url = m_itemData.at(index)->item.url();
|
const KUrl url = m_itemData.at(index)->item.url();
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
m_expandedUrls.insert(url);
|
m_expandedUrls.insert(url);
|
||||||
|
m_dirLister->openUrl(url, KDirLister::Keep);
|
||||||
if (dirLister) {
|
|
||||||
dirLister->openUrl(url, KDirLister::Keep);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
m_expandedUrls.remove(url);
|
m_expandedUrls.remove(url);
|
||||||
|
m_dirLister->stop(url);
|
||||||
|
|
||||||
if (dirLister) {
|
|
||||||
dirLister->stop(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
KFileItemList itemsToRemove;
|
KFileItemList itemsToRemove;
|
||||||
const int expandedParentsCount = data(index)["expandedParentsCount"].toInt();
|
const int expandedParentsCount = data(index)["expandedParentsCount"].toInt();
|
||||||
|
@ -415,10 +418,9 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
removeItems(itemsToRemove);
|
removeItems(itemsToRemove);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KFileItemModel::isExpanded(int index) const
|
bool KFileItemModel::isExpanded(int index) const
|
||||||
|
@ -460,18 +462,13 @@ void KFileItemModel::restoreExpandedUrls(const QSet<KUrl>& urls)
|
||||||
|
|
||||||
void KFileItemModel::expandParentItems(const KUrl& url)
|
void KFileItemModel::expandParentItems(const KUrl& url)
|
||||||
{
|
{
|
||||||
const KDirLister* dirLister = m_dirLister.data();
|
const int pos = m_dirLister->url().path().length();
|
||||||
if (!dirLister) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int pos = dirLister->url().path().length();
|
|
||||||
|
|
||||||
// Assure that each sub-path of the URL that should be
|
// Assure that each sub-path of the URL that should be
|
||||||
// expanded is added to m_urlsToExpand. KDirLister
|
// expanded is added to m_urlsToExpand. KDirLister
|
||||||
// does not care whether the parent-URL has already been
|
// does not care whether the parent-URL has already been
|
||||||
// expanded.
|
// expanded.
|
||||||
KUrl urlToExpand = dirLister->url();
|
KUrl urlToExpand = m_dirLister->url();
|
||||||
const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
|
const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
|
||||||
for (int i = 0; i < subDirs.count() - 1; ++i) {
|
for (int i = 0; i < subDirs.count() - 1; ++i) {
|
||||||
urlToExpand.addPath(subDirs.at(i));
|
urlToExpand.addPath(subDirs.at(i));
|
||||||
|
@ -537,6 +534,11 @@ QString KFileItemModel::nameFilter() const
|
||||||
return m_filter.pattern();
|
return m_filter.pattern();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KFileItemModel::cancelDirLoading()
|
||||||
|
{
|
||||||
|
m_dirLister->stop();
|
||||||
|
}
|
||||||
|
|
||||||
QList<KFileItemModel::RoleInfo> KFileItemModel::rolesInformation()
|
QList<KFileItemModel::RoleInfo> KFileItemModel::rolesInformation()
|
||||||
{
|
{
|
||||||
static QList<RoleInfo> rolesInfo;
|
static QList<RoleInfo> rolesInfo;
|
||||||
|
@ -666,7 +668,7 @@ void KFileItemModel::slotCompleted()
|
||||||
m_urlsToExpand.clear();
|
m_urlsToExpand.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit loadingCompleted();
|
emit dirLoadingCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KFileItemModel::slotCanceled()
|
void KFileItemModel::slotCanceled()
|
||||||
|
@ -1222,8 +1224,8 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_requestRole[ExpandedParentsCountRole]) {
|
if (m_requestRole[ExpandedParentsCountRole]) {
|
||||||
if (m_expandedParentsCountRoot == UninitializedExpandedParentsCountRoot && m_dirLister.data()) {
|
if (m_expandedParentsCountRoot == UninitializedExpandedParentsCountRoot) {
|
||||||
const KUrl rootUrl = m_dirLister.data()->url();
|
const KUrl rootUrl = m_dirLister->url();
|
||||||
const QString protocol = rootUrl.protocol();
|
const QString protocol = rootUrl.protocol();
|
||||||
const bool forceExpandedParentsCountRoot = (protocol == QLatin1String("trash") ||
|
const bool forceExpandedParentsCountRoot = (protocol == QLatin1String("trash") ||
|
||||||
protocol == QLatin1String("nepomuk") ||
|
protocol == QLatin1String("nepomuk") ||
|
||||||
|
@ -1501,8 +1503,7 @@ QString KFileItemModel::subPath(const KFileItem& item,
|
||||||
|
|
||||||
bool KFileItemModel::useMaximumUpdateInterval() const
|
bool KFileItemModel::useMaximumUpdateInterval() const
|
||||||
{
|
{
|
||||||
const KDirLister* dirLister = m_dirLister.data();
|
return !m_dirLister->url().isLocalFile();
|
||||||
return dirLister && !dirLister->url().isLocalFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const
|
QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const
|
||||||
|
@ -1847,20 +1848,20 @@ void KFileItemModel::emitSortProgress(int resolvedCount)
|
||||||
|
|
||||||
const int itemCount = count();
|
const int itemCount = count();
|
||||||
if (resolvedCount >= itemCount) {
|
if (resolvedCount >= itemCount) {
|
||||||
m_sortProgressPercent = -1;
|
m_sortingProgressPercent = -1;
|
||||||
if (m_resortAllItemsTimer->isActive()) {
|
if (m_resortAllItemsTimer->isActive()) {
|
||||||
m_resortAllItemsTimer->stop();
|
m_resortAllItemsTimer->stop();
|
||||||
resortAllItems();
|
resortAllItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sortProgress(100);
|
emit dirSortingProgress(100);
|
||||||
} else if (itemCount > 0) {
|
} else if (itemCount > 0) {
|
||||||
resolvedCount = qBound(0, resolvedCount, itemCount);
|
resolvedCount = qBound(0, resolvedCount, itemCount);
|
||||||
|
|
||||||
const int progress = resolvedCount * 100 / itemCount;
|
const int progress = resolvedCount * 100 / itemCount;
|
||||||
if (m_sortProgressPercent != progress) {
|
if (m_sortingProgressPercent != progress) {
|
||||||
m_sortProgressPercent = progress;
|
m_sortingProgressPercent = progress;
|
||||||
emit sortProgress(progress);
|
emit dirSortingProgress(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
#include <libdolphin_export.h>
|
#include <libdolphin_export.h>
|
||||||
#include <KFileItemList>
|
#include <KFileItemList>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
#include <kitemviews/kfileitemmodelfilter_p.h>
|
|
||||||
#include <kitemviews/kitemmodelbase.h>
|
#include <kitemviews/kitemmodelbase.h>
|
||||||
|
#include <kitemviews/private/kfileitemmodelfilter.h>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
class KDirLister;
|
class KFileItemModelDirLister;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,24 +42,37 @@ class QTimer;
|
||||||
*
|
*
|
||||||
* Also the recursive expansion of sub-directories is supported by
|
* Also the recursive expansion of sub-directories is supported by
|
||||||
* KFileItemModel::setExpanded().
|
* 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
|
class LIBDOLPHINPRIVATE_EXPORT KFileItemModel : public KItemModelBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KFileItemModel(KDirLister* dirLister, QObject* parent = 0);
|
explicit KFileItemModel(QObject* parent = 0);
|
||||||
virtual ~KFileItemModel();
|
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 int count() const;
|
||||||
virtual QHash<QByteArray, QVariant> data(int index) const;
|
virtual QHash<QByteArray, QVariant> data(int index) const;
|
||||||
virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
|
virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
|
||||||
|
@ -123,7 +136,8 @@ public:
|
||||||
int index(const KUrl& url) const;
|
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;
|
KFileItem rootItem() const;
|
||||||
|
|
||||||
|
@ -158,6 +172,8 @@ public:
|
||||||
void setNameFilter(const QString& nameFilter);
|
void setNameFilter(const QString& nameFilter);
|
||||||
QString nameFilter() const;
|
QString nameFilter() const;
|
||||||
|
|
||||||
|
void cancelDirLoading();
|
||||||
|
|
||||||
struct RoleInfo
|
struct RoleInfo
|
||||||
{ QByteArray role;
|
{ QByteArray role;
|
||||||
QString translation;
|
QString translation;
|
||||||
|
@ -175,6 +191,14 @@ public:
|
||||||
static QList<RoleInfo> rolesInformation();
|
static QList<RoleInfo> rolesInformation();
|
||||||
|
|
||||||
signals:
|
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
|
* Is emitted after the loading of a directory has been completed or new
|
||||||
* items have been inserted to an already loaded directory. Usually
|
* items have been inserted to an already loaded directory. Usually
|
||||||
|
@ -182,14 +206,38 @@ signals:
|
||||||
* (the only exception is loading an empty directory, where only a
|
* (the only exception is loading an empty directory, where only a
|
||||||
* loadingCompleted() signal gets emitted).
|
* 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
|
* Is emitted if the sort-role gets resolved asynchronously and provides
|
||||||
* the progress-information of the sorting in percent. It is assured
|
* the progress-information of the sorting in percent. It is assured
|
||||||
* that the last sortProgress-signal contains 100 as value.
|
* 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:
|
protected:
|
||||||
virtual void onGroupedSortingChanged(bool current);
|
virtual void onGroupedSortingChanged(bool current);
|
||||||
|
@ -357,13 +405,13 @@ private:
|
||||||
static void determineMimeTypes(const KFileItemList& items, int timeout);
|
static void determineMimeTypes(const KFileItemList& items, int timeout);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWeakPointer<KDirLister> m_dirLister;
|
KFileItemModelDirLister* m_dirLister;
|
||||||
|
|
||||||
bool m_naturalSorting;
|
bool m_naturalSorting;
|
||||||
bool m_sortFoldersFirst;
|
bool m_sortFoldersFirst;
|
||||||
|
|
||||||
RoleType m_sortRole;
|
RoleType m_sortRole;
|
||||||
int m_sortProgressPercent; // Value of sortProgress() signal
|
int m_sortingProgressPercent; // Value of dirSortingProgress() signal
|
||||||
QSet<QByteArray> m_roles;
|
QSet<QByteArray> m_roles;
|
||||||
Qt::CaseSensitivity m_caseSensitivity;
|
Qt::CaseSensitivity m_caseSensitivity;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "kfileitemmodelrolesupdater.h"
|
#include "kfileitemmodelrolesupdater.h"
|
||||||
|
|
||||||
#include "kfileitemmodel.h"
|
#include "kfileitemmodel.h"
|
||||||
#include "kpixmapmodifier_p.h"
|
|
||||||
|
|
||||||
#include <KConfig>
|
#include <KConfig>
|
||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
|
@ -28,14 +27,17 @@
|
||||||
#include <KFileItem>
|
#include <KFileItem>
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
#include <KIO/PreviewJob>
|
#include <KIO/PreviewJob>
|
||||||
|
|
||||||
|
#include "private/kpixmapmodifier.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#ifdef HAVE_NEPOMUK
|
#ifdef HAVE_NEPOMUK
|
||||||
#include "knepomukrolesprovider_p.h"
|
#include "private/knepomukrolesprovider.h"
|
||||||
#include "knepomukresourcewatcher_p.h"
|
#include "private/knepomukresourcewatcher.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Required includes for subItemsCount():
|
// Required includes for subItemsCount():
|
||||||
|
@ -69,7 +71,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
|
||||||
m_previewShown(false),
|
m_previewShown(false),
|
||||||
m_enlargeSmallPreviews(true),
|
m_enlargeSmallPreviews(true),
|
||||||
m_clearPreviews(false),
|
m_clearPreviews(false),
|
||||||
m_sortProgress(-1),
|
m_sortingProgress(-1),
|
||||||
m_model(model),
|
m_model(model),
|
||||||
m_iconSize(),
|
m_iconSize(),
|
||||||
m_firstVisibleIndex(0),
|
m_firstVisibleIndex(0),
|
||||||
|
@ -849,7 +851,7 @@ void KFileItemModelRolesUpdater::sortAndResolvePendingRoles()
|
||||||
|
|
||||||
void KFileItemModelRolesUpdater::applySortProgressToModel()
|
void KFileItemModelRolesUpdater::applySortProgressToModel()
|
||||||
{
|
{
|
||||||
if (m_sortProgress < 0) {
|
if (m_sortingProgress < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,7 +863,7 @@ void KFileItemModelRolesUpdater::applySortProgressToModel()
|
||||||
if (resolvedCount > 0) {
|
if (resolvedCount > 0) {
|
||||||
m_model->emitSortProgress(resolvedCount);
|
m_model->emitSortProgress(resolvedCount);
|
||||||
if (resolvedCount == m_model->count()) {
|
if (resolvedCount == m_model->count()) {
|
||||||
m_sortProgress = -1;
|
m_sortingProgress = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -877,11 +879,11 @@ void KFileItemModelRolesUpdater::updateSortProgress()
|
||||||
? hasUnknownMimeTypes()
|
? hasUnknownMimeTypes()
|
||||||
: m_resolvableRoles.contains(sortRole);
|
: m_resolvableRoles.contains(sortRole);
|
||||||
|
|
||||||
if (m_sortProgress >= 0) {
|
if (m_sortingProgress >= 0) {
|
||||||
// Mark the current sorting as finished
|
// Mark the current sorting as finished
|
||||||
m_model->emitSortProgress(m_model->count());
|
m_model->emitSortProgress(m_model->count());
|
||||||
}
|
}
|
||||||
m_sortProgress = showProgress ? 0 : -1;
|
m_sortingProgress = showProgress ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KFileItemModelRolesUpdater::hasUnknownMimeTypes() const
|
bool KFileItemModelRolesUpdater::hasUnknownMimeTypes() const
|
||||||
|
|
|
@ -240,7 +240,7 @@ private:
|
||||||
// during the roles-updater has been paused by setPaused().
|
// during the roles-updater has been paused by setPaused().
|
||||||
bool m_clearPreviews;
|
bool m_clearPreviews;
|
||||||
|
|
||||||
int m_sortProgress;
|
int m_sortingProgress;
|
||||||
|
|
||||||
KFileItemModel* m_model;
|
KFileItemModel* m_model;
|
||||||
QSize m_iconSize;
|
QSize m_iconSize;
|
||||||
|
|
|
@ -23,10 +23,11 @@
|
||||||
#include "kitemlistcontainer.h"
|
#include "kitemlistcontainer.h"
|
||||||
|
|
||||||
#include "kitemlistcontroller.h"
|
#include "kitemlistcontroller.h"
|
||||||
#include "kitemlistsmoothscroller_p.h"
|
|
||||||
#include "kitemlistview.h"
|
#include "kitemlistview.h"
|
||||||
#include "kitemmodelbase.h"
|
#include "kitemmodelbase.h"
|
||||||
|
|
||||||
|
#include "private/kitemlistsmoothscroller.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
|
|
|
@ -23,10 +23,14 @@
|
||||||
|
|
||||||
#include "kitemlistcontroller.h"
|
#include "kitemlistcontroller.h"
|
||||||
|
|
||||||
|
#include <KGlobalSettings>
|
||||||
|
#include <KDebug>
|
||||||
|
|
||||||
#include "kitemlistview.h"
|
#include "kitemlistview.h"
|
||||||
#include "kitemlistrubberband_p.h"
|
|
||||||
#include "kitemlistselectionmanager.h"
|
#include "kitemlistselectionmanager.h"
|
||||||
#include "kitemlistkeyboardsearchmanager_p.h"
|
|
||||||
|
#include "private/kitemlistrubberband.h"
|
||||||
|
#include "private/kitemlistkeyboardsearchmanager.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
|
@ -37,9 +41,6 @@
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include <KGlobalSettings>
|
|
||||||
#include <KDebug>
|
|
||||||
|
|
||||||
KItemListController::KItemListController(QObject* parent) :
|
KItemListController::KItemListController(QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_singleClickActivation(KGlobalSettings::singleClick()),
|
m_singleClickActivation(KGlobalSettings::singleClick()),
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistheader.h"
|
#include "kitemlistheader.h"
|
||||||
#include "kitemlistheaderwidget_p.h"
|
|
||||||
#include "kitemlistview.h"
|
#include "kitemlistview.h"
|
||||||
|
|
||||||
|
#include "private/kitemlistheaderwidget.h"
|
||||||
|
|
||||||
KItemListHeader::~KItemListHeader()
|
KItemListHeader::~KItemListHeader()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* 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
|
|
||||||
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* 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
|
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,15 @@
|
||||||
|
|
||||||
#include "kitemlistcontroller.h"
|
#include "kitemlistcontroller.h"
|
||||||
#include "kitemlistheader.h"
|
#include "kitemlistheader.h"
|
||||||
#include "kitemlistheaderwidget_p.h"
|
|
||||||
#include "kitemlistrubberband_p.h"
|
|
||||||
#include "kitemlistselectionmanager.h"
|
#include "kitemlistselectionmanager.h"
|
||||||
#include "kitemlistsizehintresolver_p.h"
|
|
||||||
#include "kitemlistviewlayouter_p.h"
|
|
||||||
#include "kitemlistviewanimation_p.h"
|
|
||||||
#include "kitemlistwidget.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 <KDebug>
|
||||||
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
|
|
||||||
#include <kitemviews/kitemlistgroupheader.h>
|
#include <kitemviews/kitemlistgroupheader.h>
|
||||||
#include <kitemviews/kitemliststyleoption.h>
|
#include <kitemviews/kitemliststyleoption.h>
|
||||||
#include <kitemviews/kitemlistviewanimation_p.h>
|
|
||||||
#include <kitemviews/kitemlistwidget.h>
|
#include <kitemviews/kitemlistwidget.h>
|
||||||
#include <kitemviews/kitemmodelbase.h>
|
#include <kitemviews/kitemmodelbase.h>
|
||||||
|
#include <kitemviews/private/kitemlistviewanimation.h>
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,11 @@
|
||||||
|
|
||||||
#include "kitemlistwidget.h"
|
#include "kitemlistwidget.h"
|
||||||
|
|
||||||
#include "kitemlistselectiontoggle_p.h"
|
|
||||||
#include "kitemlistview.h"
|
#include "kitemlistview.h"
|
||||||
#include "kitemmodelbase.h"
|
#include "kitemmodelbase.h"
|
||||||
|
|
||||||
|
#include "private/kitemlistselectiontoggle.h"
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kfileitemclipboard_p.h"
|
#include "kfileitemclipboard.h"
|
||||||
|
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -73,4 +73,4 @@ KFileItemClipboard::KFileItemClipboard() :
|
||||||
this, SLOT(updateCutItems()));
|
this, SLOT(updateCutItems()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "kfileitemclipboard_p.moc"
|
#include "kfileitemclipboard.moc"
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* 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 *
|
* 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 *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
@ -17,25 +17,22 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "dolphindirlister.h"
|
#include "kfileitemmodeldirlister.h"
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KIO/JobClasses>
|
#include <KIO/JobClasses>
|
||||||
|
|
||||||
DolphinDirLister::DolphinDirLister(QObject* parent) :
|
KFileItemModelDirLister::KFileItemModelDirLister(QObject* parent) :
|
||||||
KDirLister(parent)
|
KDirLister(parent)
|
||||||
{
|
{
|
||||||
setAutoErrorHandlingEnabled(false, 0);
|
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());
|
|
||||||
} else {
|
|
||||||
const QString errorString = job->errorString();
|
const QString errorString = job->errorString();
|
||||||
if (errorString.isEmpty()) {
|
if (errorString.isEmpty()) {
|
||||||
emit errorMessage(i18nc("@info:status", "Unknown error."));
|
emit errorMessage(i18nc("@info:status", "Unknown error."));
|
||||||
|
@ -43,6 +40,5 @@ void DolphinDirLister::handleError(KIO::Job* job)
|
||||||
emit errorMessage(errorString);
|
emit errorMessage(errorString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#include "dolphindirlister.moc"
|
#include "kfileitemmodeldirlister.moc"
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* 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 *
|
* 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 *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef DOLPHINDIRLISTER_H
|
#ifndef KFILEITEMMODELDIRLISTER_H
|
||||||
#define DOLPHINDIRLISTER_H
|
#define KFILEITEMMODELDIRLISTER_H
|
||||||
|
|
||||||
#include <libdolphin_export.h>
|
#include <libdolphin_export.h>
|
||||||
#include <KDirLister>
|
#include <KDirLister>
|
||||||
|
@ -26,22 +26,20 @@
|
||||||
/**
|
/**
|
||||||
* @brief Extends the class KDirLister by emitting a signal when an
|
* @brief Extends the class KDirLister by emitting a signal when an
|
||||||
* error occurred instead of showing an error dialog.
|
* 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
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DolphinDirLister(QObject* parent = 0);
|
KFileItemModelDirLister(QObject* parent = 0);
|
||||||
virtual ~DolphinDirLister();
|
virtual ~KFileItemModelDirLister();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/** Is emitted whenever an error has occurred. */
|
/** Is emitted whenever an error has occurred. */
|
||||||
void errorMessage(const QString& msg);
|
void errorMessage(const QString& msg);
|
||||||
|
|
||||||
/** Is emitted when the URL of the directory lister represents a file. */
|
|
||||||
void urlIsFileError(const KUrl& url);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleError(KIO::Job* job);
|
virtual void handleError(KIO::Job* job);
|
||||||
};
|
};
|
|
@ -18,7 +18,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kfileitemmodelfilter_p.h"
|
#include "kfileitemmodelfilter.h"
|
||||||
|
|
||||||
#include <KFileItem>
|
#include <KFileItem>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kfileitemmodelsortalgorithm_p.h"
|
#include "kfileitemmodelsortalgorithm.h"
|
||||||
|
|
||||||
void KFileItemModelSortAlgorithm::sort(KFileItemModel* model,
|
void KFileItemModelSortAlgorithm::sort(KFileItemModel* model,
|
||||||
QList<KFileItemModel::ItemData*>::iterator begin,
|
QList<KFileItemModel::ItemData*>::iterator begin,
|
|
@ -17,11 +17,11 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistheaderwidget_p.h"
|
#include "kitemlistheaderwidget.h"
|
||||||
|
|
||||||
#include <KAction>
|
#include <KAction>
|
||||||
#include <KMenu>
|
#include <KMenu>
|
||||||
#include "kitemmodelbase.h"
|
#include <kitemviews/kitemmodelbase.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGraphicsSceneHoverEvent>
|
#include <QGraphicsSceneHoverEvent>
|
||||||
|
@ -532,4 +532,4 @@ qreal KItemListHeaderWidget::roleXPosition(const QByteArray& role) const
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "kitemlistheaderwidget_p.moc"
|
#include "kitemlistheaderwidget.moc"
|
|
@ -20,7 +20,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistkeyboardsearchmanager_p.h"
|
#include "kitemlistkeyboardsearchmanager.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistrubberband_p.h"
|
#include "kitemlistrubberband.h"
|
||||||
|
|
||||||
KItemListRubberBand::KItemListRubberBand(QObject* parent) :
|
KItemListRubberBand::KItemListRubberBand(QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
|
@ -72,4 +72,4 @@ bool KItemListRubberBand::isActive() const
|
||||||
return m_active;
|
return m_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "kitemlistrubberband_p.moc"
|
#include "kitemlistrubberband.moc"
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistselectiontoggle_p.h"
|
#include "kitemlistselectiontoggle.h"
|
||||||
|
|
||||||
#include <KIconEffect>
|
#include <KIconEffect>
|
||||||
#include <KIconLoader>
|
#include <KIconLoader>
|
||||||
|
@ -103,4 +103,4 @@ void KItemListSelectionToggle::updatePixmap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "kitemlistselectiontoggle_p.moc"
|
#include "kitemlistselectiontoggle.moc"
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistsizehintresolver_p.h"
|
#include "kitemlistsizehintresolver.h"
|
||||||
|
|
||||||
#include <kitemviews/kitemlistview.h>
|
#include <kitemviews/kitemlistview.h>
|
||||||
#include <KDebug>
|
#include <KDebug>
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistsmoothscroller_p.h"
|
#include "kitemlistsmoothscroller.h"
|
||||||
|
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
@ -204,4 +204,4 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent* event)
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "kitemlistsmoothscroller_p.moc"
|
#include "kitemlistsmoothscroller.moc"
|
|
@ -17,9 +17,9 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 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 <KDebug>
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
|
@ -242,4 +242,4 @@ void KItemListViewAnimation::slotFinished()
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "kitemlistviewanimation_p.moc"
|
#include "kitemlistviewanimation.moc"
|
|
@ -17,10 +17,10 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "kitemlistviewlayouter_p.h"
|
#include "kitemlistviewlayouter.h"
|
||||||
|
|
||||||
#include "kitemmodelbase.h"
|
#include <kitemviews/kitemmodelbase.h>
|
||||||
#include "kitemlistsizehintresolver_p.h"
|
#include "kitemlistsizehintresolver.h"
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
|
||||||
|
@ -627,4 +627,4 @@ qreal KItemListViewLayouter::minimumGroupHeaderWidth() const
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "kitemlistviewlayouter_p.moc"
|
#include "kitemlistviewlayouter.moc"
|
|
@ -29,7 +29,7 @@
|
||||||
#include <QtDBus/QDBusVariant>
|
#include <QtDBus/QDBusVariant>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
#include "knepomukdatamanagement_export_p.h"
|
#include "knepomukdatamanagement_export.h"
|
||||||
|
|
||||||
namespace Nepomuk {
|
namespace Nepomuk {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "knepomukrolesprovider_p.h"
|
#include "knepomukrolesprovider.h"
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
|
@ -32,7 +32,7 @@
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kpixmapmodifier_p.h"
|
#include "kpixmapmodifier.h"
|
||||||
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
|
@ -30,7 +30,6 @@
|
||||||
#include <kitemviews/kitemlistcontroller.h>
|
#include <kitemviews/kitemlistcontroller.h>
|
||||||
#include <kitemviews/kfileitemmodel.h>
|
#include <kitemviews/kfileitemmodel.h>
|
||||||
|
|
||||||
#include <KDirLister>
|
|
||||||
#include <KFileItem>
|
#include <KFileItem>
|
||||||
#include <konq_operations.h>
|
#include <konq_operations.h>
|
||||||
|
|
||||||
|
@ -50,7 +49,6 @@
|
||||||
FoldersPanel::FoldersPanel(QWidget* parent) :
|
FoldersPanel::FoldersPanel(QWidget* parent) :
|
||||||
Panel(parent),
|
Panel(parent),
|
||||||
m_updateCurrentItem(false),
|
m_updateCurrentItem(false),
|
||||||
m_dirLister(0),
|
|
||||||
m_controller(0)
|
m_controller(0)
|
||||||
{
|
{
|
||||||
setLayoutDirection(Qt::LeftToRight);
|
setLayoutDirection(Qt::LeftToRight);
|
||||||
|
@ -65,9 +63,6 @@ FoldersPanel::~FoldersPanel()
|
||||||
m_controller->setView(0);
|
m_controller->setView(0);
|
||||||
delete view;
|
delete view;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_dirLister;
|
|
||||||
m_dirLister = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FoldersPanel::setShowHiddenFiles(bool show)
|
void FoldersPanel::setShowHiddenFiles(bool show)
|
||||||
|
@ -116,7 +111,7 @@ bool FoldersPanel::urlChanged()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dirLister) {
|
if (m_controller) {
|
||||||
loadTree(url());
|
loadTree(url());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,16 +125,10 @@ void FoldersPanel::showEvent(QShowEvent* event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_dirLister) {
|
if (!m_controller) {
|
||||||
// Postpone the creating of the dir lister to the first show event.
|
// 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
|
// This assures that no performance and memory overhead is given when the TreeView is not
|
||||||
// used at all (see FoldersPanel::setUrl()).
|
// 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();
|
KFileItemListView* view = new KFileItemListView();
|
||||||
view->setWidgetCreator(new KItemListWidgetCreator<KFileItemListWidget>());
|
view->setWidgetCreator(new KItemListWidgetCreator<KFileItemListWidget>());
|
||||||
|
|
||||||
|
@ -158,12 +147,12 @@ void FoldersPanel::showEvent(QShowEvent* event)
|
||||||
// opening the folders panel.
|
// opening the folders panel.
|
||||||
view->setOpacity(0);
|
view->setOpacity(0);
|
||||||
|
|
||||||
KFileItemModel* model = new KFileItemModel(m_dirLister, this);
|
KFileItemModel* model = new KFileItemModel(this);
|
||||||
model->setShowFoldersOnly(true);
|
model->setShowFoldersOnly(true);
|
||||||
model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown());
|
model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown());
|
||||||
// Use a QueuedConnection to give the view the possibility to react first on the
|
// Use a QueuedConnection to give the view the possibility to react first on the
|
||||||
// finished loading.
|
// 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);
|
KItemListContainer* container = new KItemListContainer(this);
|
||||||
m_controller = container->controller();
|
m_controller = container->controller();
|
||||||
|
@ -305,7 +294,7 @@ void FoldersPanel::startFadeInAnimation()
|
||||||
|
|
||||||
void FoldersPanel::loadTree(const KUrl& url)
|
void FoldersPanel::loadTree(const KUrl& url)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_dirLister);
|
Q_ASSERT(m_controller);
|
||||||
|
|
||||||
m_updateCurrentItem = false;
|
m_updateCurrentItem = false;
|
||||||
|
|
||||||
|
@ -319,13 +308,12 @@ void FoldersPanel::loadTree(const KUrl& url)
|
||||||
baseUrl.setPath(QString('/'));
|
baseUrl.setPath(QString('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dirLister->url() != baseUrl) {
|
KFileItemModel* model = fileItemModel();
|
||||||
|
if (model->dir() != baseUrl) {
|
||||||
m_updateCurrentItem = true;
|
m_updateCurrentItem = true;
|
||||||
m_dirLister->stop();
|
model->refreshDir(baseUrl);
|
||||||
m_dirLister->openUrl(baseUrl, KDirLister::Reload);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KFileItemModel* model = fileItemModel();
|
|
||||||
const int index = model->index(url);
|
const int index = model->index(url);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
updateCurrentItem(index);
|
updateCurrentItem(index);
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
#include <panels/panel.h>
|
#include <panels/panel.h>
|
||||||
|
|
||||||
class KDirLister;
|
|
||||||
class KFileItemModel;
|
class KFileItemModel;
|
||||||
class KItemListController;
|
class KItemListController;
|
||||||
class QGraphicsSceneDragDropEvent;
|
class QGraphicsSceneDragDropEvent;
|
||||||
|
@ -100,7 +99,6 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_updateCurrentItem;
|
bool m_updateCurrentItem;
|
||||||
KDirLister* m_dirLister;
|
|
||||||
KItemListController* m_controller;
|
KItemListController* m_controller;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ target_link_libraries(kfileitemmodeltest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QT
|
||||||
# KItemListKeyboardSearchManagerTest
|
# KItemListKeyboardSearchManagerTest
|
||||||
set(kitemlistkeyboardsearchmanagertest_SRCS
|
set(kitemlistkeyboardsearchmanagertest_SRCS
|
||||||
kitemlistkeyboardsearchmanagertest.cpp
|
kitemlistkeyboardsearchmanagertest.cpp
|
||||||
../kitemviews/kitemlistkeyboardsearchmanager.cpp
|
../kitemviews/private/kitemlistkeyboardsearchmanager.cpp
|
||||||
)
|
)
|
||||||
kde4_add_unit_test(kitemlistkeyboardsearchmanagertest TEST ${kitemlistkeyboardsearchmanagertest_SRCS})
|
kde4_add_unit_test(kitemlistkeyboardsearchmanagertest TEST ${kitemlistkeyboardsearchmanagertest_SRCS})
|
||||||
target_link_libraries(kitemlistkeyboardsearchmanagertest ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY})
|
target_link_libraries(kitemlistkeyboardsearchmanagertest ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY})
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <KDirLister>
|
#include <KDirLister>
|
||||||
#include "kitemviews/kfileitemmodel.h"
|
#include "kitemviews/kfileitemmodel.h"
|
||||||
|
#include "kitemviews/private/kfileitemmodeldirlister.h"
|
||||||
#include "testdir.h"
|
#include "testdir.h"
|
||||||
|
|
||||||
void myMessageOutput(QtMsgType type, const char* msg)
|
void myMessageOutput(QtMsgType type, const char* msg)
|
||||||
|
@ -62,7 +63,7 @@ private slots:
|
||||||
void testDefaultGroupedSorting();
|
void testDefaultGroupedSorting();
|
||||||
void testNewItems();
|
void testNewItems();
|
||||||
void testRemoveItems();
|
void testRemoveItems();
|
||||||
void testLoadingCompleted();
|
void testDirLoadingCompleted();
|
||||||
void testSetData();
|
void testSetData();
|
||||||
void testSetDataWithModifiedSortRole_data();
|
void testSetDataWithModifiedSortRole_data();
|
||||||
void testSetDataWithModifiedSortRole();
|
void testSetDataWithModifiedSortRole();
|
||||||
|
@ -82,7 +83,6 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KFileItemModel* m_model;
|
KFileItemModel* m_model;
|
||||||
KDirLister* m_dirLister;
|
|
||||||
TestDir* m_testDir;
|
TestDir* m_testDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,9 +97,8 @@ void KFileItemModelTest::init()
|
||||||
qRegisterMetaType<KFileItemList>("KFileItemList");
|
qRegisterMetaType<KFileItemList>("KFileItemList");
|
||||||
|
|
||||||
m_testDir = new TestDir();
|
m_testDir = new TestDir();
|
||||||
m_dirLister = new KDirLister();
|
m_model = new KFileItemModel();
|
||||||
m_dirLister->setAutoUpdate(false);
|
m_model->m_dirLister->setAutoUpdate(false);
|
||||||
m_model = new KFileItemModel(m_dirLister);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KFileItemModelTest::cleanup()
|
void KFileItemModelTest::cleanup()
|
||||||
|
@ -107,9 +106,6 @@ void KFileItemModelTest::cleanup()
|
||||||
delete m_model;
|
delete m_model;
|
||||||
m_model = 0;
|
m_model = 0;
|
||||||
|
|
||||||
delete m_dirLister;
|
|
||||||
m_dirLister = 0;
|
|
||||||
|
|
||||||
delete m_testDir;
|
delete m_testDir;
|
||||||
m_testDir = 0;
|
m_testDir = 0;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +127,7 @@ void KFileItemModelTest::testDefaultSortRole()
|
||||||
|
|
||||||
m_testDir->createFiles(files);
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
QCOMPARE(m_model->count(), 3);
|
QCOMPARE(m_model->count(), 3);
|
||||||
|
@ -151,7 +147,7 @@ void KFileItemModelTest::testNewItems()
|
||||||
files << "a.txt" << "b.txt" << "c.txt";
|
files << "a.txt" << "b.txt" << "c.txt";
|
||||||
m_testDir->createFiles(files);
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
QCOMPARE(m_model->count(), 3);
|
QCOMPARE(m_model->count(), 3);
|
||||||
|
@ -163,36 +159,36 @@ void KFileItemModelTest::testRemoveItems()
|
||||||
{
|
{
|
||||||
m_testDir->createFile("a.txt");
|
m_testDir->createFile("a.txt");
|
||||||
m_testDir->createFile("b.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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
QCOMPARE(m_model->count(), 2);
|
QCOMPARE(m_model->count(), 2);
|
||||||
QVERIFY(isModelConsistent());
|
QVERIFY(isModelConsistent());
|
||||||
|
|
||||||
m_testDir->removeFile("a.txt");
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsRemoved(KItemRangeList)), DefaultTimeout));
|
||||||
QCOMPARE(m_model->count(), 1);
|
QCOMPARE(m_model->count(), 1);
|
||||||
QVERIFY(isModelConsistent());
|
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 itemsInsertedSpy(m_model, SIGNAL(itemsInserted(KItemRangeList)));
|
||||||
QSignalSpy itemsRemovedSpy(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
|
QSignalSpy itemsRemovedSpy(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
|
||||||
|
|
||||||
m_testDir->createFiles(QStringList() << "a.txt" << "b.txt" << "c.txt");
|
m_testDir->createFiles(QStringList() << "a.txt" << "b.txt" << "c.txt");
|
||||||
|
|
||||||
m_dirLister->openUrl(m_testDir->url());
|
m_model->loadDir(m_testDir->url());
|
||||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
|
||||||
QCOMPARE(loadingCompletedSpy.count(), 1);
|
QCOMPARE(loadingCompletedSpy.count(), 1);
|
||||||
QCOMPARE(itemsInsertedSpy.count(), 1);
|
QCOMPARE(itemsInsertedSpy.count(), 1);
|
||||||
QCOMPARE(itemsRemovedSpy.count(), 0);
|
QCOMPARE(itemsRemovedSpy.count(), 0);
|
||||||
QCOMPARE(m_model->count(), 3);
|
QCOMPARE(m_model->count(), 3);
|
||||||
|
|
||||||
m_testDir->createFiles(QStringList() << "d.txt" << "e.txt");
|
m_testDir->createFiles(QStringList() << "d.txt" << "e.txt");
|
||||||
m_dirLister->updateDirectory(m_testDir->url());
|
m_model->m_dirLister->updateDirectory(m_testDir->url());
|
||||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
|
||||||
QCOMPARE(loadingCompletedSpy.count(), 2);
|
QCOMPARE(loadingCompletedSpy.count(), 2);
|
||||||
QCOMPARE(itemsInsertedSpy.count(), 2);
|
QCOMPARE(itemsInsertedSpy.count(), 2);
|
||||||
QCOMPARE(itemsRemovedSpy.count(), 0);
|
QCOMPARE(itemsRemovedSpy.count(), 0);
|
||||||
|
@ -200,15 +196,15 @@ void KFileItemModelTest::testLoadingCompleted()
|
||||||
|
|
||||||
m_testDir->removeFile("a.txt");
|
m_testDir->removeFile("a.txt");
|
||||||
m_testDir->createFile("f.txt");
|
m_testDir->createFile("f.txt");
|
||||||
m_dirLister->updateDirectory(m_testDir->url());
|
m_model->m_dirLister->updateDirectory(m_testDir->url());
|
||||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
|
||||||
QCOMPARE(loadingCompletedSpy.count(), 3);
|
QCOMPARE(loadingCompletedSpy.count(), 3);
|
||||||
QCOMPARE(itemsInsertedSpy.count(), 3);
|
QCOMPARE(itemsInsertedSpy.count(), 3);
|
||||||
QCOMPARE(itemsRemovedSpy.count(), 1);
|
QCOMPARE(itemsRemovedSpy.count(), 1);
|
||||||
QCOMPARE(m_model->count(), 5);
|
QCOMPARE(m_model->count(), 5);
|
||||||
|
|
||||||
m_testDir->removeFile("b.txt");
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsRemoved(KItemRangeList)), DefaultTimeout));
|
||||||
QCOMPARE(loadingCompletedSpy.count(), 4);
|
QCOMPARE(loadingCompletedSpy.count(), 4);
|
||||||
QCOMPARE(itemsInsertedSpy.count(), 3);
|
QCOMPARE(itemsInsertedSpy.count(), 3);
|
||||||
|
@ -222,7 +218,7 @@ void KFileItemModelTest::testSetData()
|
||||||
{
|
{
|
||||||
m_testDir->createFile("a.txt");
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
QHash<QByteArray, QVariant> values;
|
QHash<QByteArray, QVariant> values;
|
||||||
|
@ -279,7 +275,7 @@ void KFileItemModelTest::testSetDataWithModifiedSortRole()
|
||||||
files << "a.txt" << "b.txt" << "c.txt";
|
files << "a.txt" << "b.txt" << "c.txt";
|
||||||
m_testDir->createFiles(files);
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
// Fill the "rating" role of each file:
|
// Fill the "rating" role of each file:
|
||||||
|
@ -331,7 +327,7 @@ void KFileItemModelTest::testModelConsistencyWhenInsertingItems()
|
||||||
// KFileItemModel to do a lot of insert operation and hence decrease
|
// KFileItemModel to do a lot of insert operation and hence decrease
|
||||||
// the timeout to 1 millisecond.
|
// the timeout to 1 millisecond.
|
||||||
m_testDir->createFile("1");
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
QCOMPARE(m_model->count(), 1);
|
QCOMPARE(m_model->count(), 1);
|
||||||
|
|
||||||
|
@ -351,7 +347,7 @@ void KFileItemModelTest::testModelConsistencyWhenInsertingItems()
|
||||||
m_testDir->createFile(QString::number(itemName));
|
m_testDir->createFile(QString::number(itemName));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dirLister->updateDirectory(m_testDir->url());
|
m_model->m_dirLister->updateDirectory(m_testDir->url());
|
||||||
if (spy.count() == 0) {
|
if (spy.count() == 0) {
|
||||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
}
|
}
|
||||||
|
@ -371,7 +367,7 @@ void KFileItemModelTest::testItemRangeConsistencyWhenInsertingItems()
|
||||||
// Due to inserting the 3 items one item-range with index == 0 and
|
// Due to inserting the 3 items one item-range with index == 0 and
|
||||||
// count == 3 must be given
|
// count == 3 must be given
|
||||||
QSignalSpy spy1(m_model, SIGNAL(itemsInserted(KItemRangeList)));
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
QCOMPARE(spy1.count(), 1);
|
QCOMPARE(spy1.count(), 1);
|
||||||
|
@ -396,7 +392,7 @@ void KFileItemModelTest::testItemRangeConsistencyWhenInsertingItems()
|
||||||
m_testDir->createFiles(files);
|
m_testDir->createFiles(files);
|
||||||
|
|
||||||
QSignalSpy spy2(m_model, SIGNAL(itemsInserted(KItemRangeList)));
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
QCOMPARE(spy2.count(), 1);
|
QCOMPARE(spy2.count(), 1);
|
||||||
|
@ -424,7 +420,7 @@ void KFileItemModelTest::testExpandItems()
|
||||||
QSet<KUrl> allFolders;
|
QSet<KUrl> allFolders;
|
||||||
allFolders << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1");
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
// So far, the model contains only "a/"
|
// So far, the model contains only "a/"
|
||||||
|
@ -496,9 +492,9 @@ void KFileItemModelTest::testExpandItems()
|
||||||
QCOMPARE(m_model->count(), 0);
|
QCOMPARE(m_model->count(), 0);
|
||||||
QVERIFY(m_model->expandedUrls().empty());
|
QVERIFY(m_model->expandedUrls().empty());
|
||||||
|
|
||||||
m_dirLister->openUrl(m_testDir->url());
|
m_model->loadDir(m_testDir->url());
|
||||||
m_model->restoreExpandedUrls(allFolders);
|
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"
|
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(0));
|
||||||
QVERIFY(m_model->isExpanded(1));
|
QVERIFY(m_model->isExpanded(1));
|
||||||
|
@ -509,12 +505,12 @@ void KFileItemModelTest::testExpandItems()
|
||||||
|
|
||||||
// Move to a sub folder, then call restoreExpandedFolders() *before* going back.
|
// Move to a sub folder, then call restoreExpandedFolders() *before* going back.
|
||||||
// This is how DolphinView restores the expanded folders when navigating in history.
|
// This is how DolphinView restores the expanded folders when navigating in history.
|
||||||
m_dirLister->openUrl(KUrl(m_testDir->name() + "a/a/"));
|
m_model->loadDir(KUrl(m_testDir->name() + "a/a/"));
|
||||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
|
||||||
QCOMPARE(m_model->count(), 1); // 1 item: "1"
|
QCOMPARE(m_model->count(), 1); // 1 item: "1"
|
||||||
m_model->restoreExpandedUrls(allFolders);
|
m_model->restoreExpandedUrls(allFolders);
|
||||||
m_dirLister->openUrl(m_testDir->url());
|
m_model->loadDir(m_testDir->url());
|
||||||
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"
|
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);
|
QCOMPARE(m_model->expandedUrls(), allFolders);
|
||||||
}
|
}
|
||||||
|
@ -537,7 +533,7 @@ void KFileItemModelTest::testExpandParentItems()
|
||||||
files << "a 1/b1/c1/file.txt" << "a2/b2/c2/d2/file.txt"; // missing folders are created automatically
|
files << "a 1/b1/c1/file.txt" << "a2/b2/c2/d2/file.txt"; // missing folders are created automatically
|
||||||
m_testDir->createFiles(files);
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
// So far, the model contains only "a 1/" and "a2/".
|
// So far, the model contains only "a 1/" and "a2/".
|
||||||
|
@ -546,7 +542,7 @@ void KFileItemModelTest::testExpandParentItems()
|
||||||
|
|
||||||
// Expand the parents of "a2/b2/c2".
|
// Expand the parents of "a2/b2/c2".
|
||||||
m_model->expandParentItems(KUrl(m_testDir->name() + "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/".
|
// 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.
|
// It's important that only the parents of "a1/b1/c1" are expanded.
|
||||||
|
@ -558,7 +554,7 @@ void KFileItemModelTest::testExpandParentItems()
|
||||||
|
|
||||||
// Expand the parents of "a 1/b1".
|
// Expand the parents of "a 1/b1".
|
||||||
m_model->expandParentItems(KUrl(m_testDir->name() + "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/".
|
// 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.
|
// It's important that only the parents of "a 1/b1/" and "a2/b2/c2/" are expanded.
|
||||||
|
@ -593,7 +589,7 @@ void KFileItemModelTest::testSorting()
|
||||||
m_testDir->createFile("e", "An even larger file", now.addDays(-4));
|
m_testDir->createFile("e", "An even larger file", now.addDays(-4));
|
||||||
m_testDir->createFile(".f");
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
int index = m_model->index(KUrl(m_testDir->url().url() + "c"));
|
int index = m_model->index(KUrl(m_testDir->url().url() + "c"));
|
||||||
|
@ -705,7 +701,7 @@ void KFileItemModelTest::testIndexForKeyboardSearch()
|
||||||
files << "a" << "aa" << "Image.jpg" << "Image.png" << "Text" << "Text1" << "Text2" << "Text11";
|
files << "a" << "aa" << "Image.jpg" << "Image.png" << "Text" << "Text1" << "Text2" << "Text11";
|
||||||
m_testDir->createFiles(files);
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
// Search from index 0
|
// Search from index 0
|
||||||
|
@ -755,7 +751,7 @@ void KFileItemModelTest::testNameFilter()
|
||||||
files << "A1" << "A2" << "Abc" << "Bcd" << "Cde";
|
files << "A1" << "A2" << "Abc" << "Bcd" << "Cde";
|
||||||
m_testDir->createFiles(files);
|
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));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
|
||||||
|
|
||||||
m_model->setNameFilter("A"); // Shows A1, A2 and Abc
|
m_model->setNameFilter("A"); // Shows A1, A2 and Abc
|
||||||
|
|
|
@ -21,13 +21,12 @@
|
||||||
#include <qtestmouse.h>
|
#include <qtestmouse.h>
|
||||||
#include <qtestkeyboard.h>
|
#include <qtestkeyboard.h>
|
||||||
|
|
||||||
#include <KDirLister>
|
|
||||||
#include "kitemviews/kitemlistcontainer.h"
|
#include "kitemviews/kitemlistcontainer.h"
|
||||||
#include "kitemviews/kfileitemlistview.h"
|
#include "kitemviews/kfileitemlistview.h"
|
||||||
#include "kitemviews/kfileitemmodel.h"
|
#include "kitemviews/kfileitemmodel.h"
|
||||||
#include "kitemviews/kitemlistcontroller.h"
|
#include "kitemviews/kitemlistcontroller.h"
|
||||||
#include "kitemviews/kitemlistselectionmanager.h"
|
#include "kitemviews/kitemlistselectionmanager.h"
|
||||||
#include "kitemviews/kitemlistviewlayouter_p.h"
|
#include "kitemviews/private/kitemlistviewlayouter.h"
|
||||||
#include "testdir.h"
|
#include "testdir.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -65,7 +64,6 @@ private:
|
||||||
KItemListController* m_controller;
|
KItemListController* m_controller;
|
||||||
KItemListSelectionManager* m_selectionManager;
|
KItemListSelectionManager* m_selectionManager;
|
||||||
KFileItemModel* m_model;
|
KFileItemModel* m_model;
|
||||||
KDirLister* m_dirLister;
|
|
||||||
TestDir* m_testDir;
|
TestDir* m_testDir;
|
||||||
KItemListContainer* m_container;
|
KItemListContainer* m_container;
|
||||||
};
|
};
|
||||||
|
@ -80,8 +78,7 @@ void KItemListControllerTest::initTestCase()
|
||||||
qRegisterMetaType<QSet<int> >("QSet<int>");
|
qRegisterMetaType<QSet<int> >("QSet<int>");
|
||||||
|
|
||||||
m_testDir = new TestDir();
|
m_testDir = new TestDir();
|
||||||
m_dirLister = new KDirLister();
|
m_model = new KFileItemModel();
|
||||||
m_model = new KFileItemModel(m_dirLister);
|
|
||||||
m_container = new KItemListContainer();
|
m_container = new KItemListContainer();
|
||||||
m_controller = m_container->controller();
|
m_controller = m_container->controller();
|
||||||
m_controller->setSelectionBehavior(KItemListController::MultiSelection);
|
m_controller->setSelectionBehavior(KItemListController::MultiSelection);
|
||||||
|
@ -100,8 +97,8 @@ void KItemListControllerTest::initTestCase()
|
||||||
<< "e1" << "e2" << "e3" << "e4" << "e5" << "e6" << "e7";
|
<< "e1" << "e2" << "e3" << "e4" << "e5" << "e6" << "e7";
|
||||||
|
|
||||||
m_testDir->createFiles(files);
|
m_testDir->createFiles(files);
|
||||||
m_dirLister->openUrl(m_testDir->url());
|
m_model->loadDir(m_testDir->url());
|
||||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
|
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
|
||||||
|
|
||||||
m_container->show();
|
m_container->show();
|
||||||
QTest::qWaitForWindowShown(m_container);
|
QTest::qWaitForWindowShown(m_container);
|
||||||
|
@ -119,9 +116,6 @@ void KItemListControllerTest::cleanupTestCase()
|
||||||
delete m_model;
|
delete m_model;
|
||||||
m_model = 0;
|
m_model = 0;
|
||||||
|
|
||||||
delete m_dirLister;
|
|
||||||
m_dirLister = 0;
|
|
||||||
|
|
||||||
delete m_testDir;
|
delete m_testDir;
|
||||||
m_testDir = 0;
|
m_testDir = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <qtest_kde.h>
|
#include <qtest_kde.h>
|
||||||
|
|
||||||
#include "kitemviews/kitemlistkeyboardsearchmanager_p.h"
|
#include "kitemviews/private/kitemlistkeyboardsearchmanager.h"
|
||||||
|
|
||||||
class KItemListKeyboardSearchManagerTest : public QObject
|
class KItemListKeyboardSearchManagerTest : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include <kitemviews/kitemlistcontroller.h>
|
#include <kitemviews/kitemlistcontroller.h>
|
||||||
#include <kitemviews/kitemliststyleoption.h>
|
#include <kitemviews/kitemliststyleoption.h>
|
||||||
|
|
||||||
#include <KDirLister>
|
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
|
|
||||||
#include <views/viewmodecontroller.h>
|
#include <views/viewmodecontroller.h>
|
||||||
|
@ -39,13 +38,12 @@
|
||||||
#include "zoomlevelinfo.h"
|
#include "zoomlevelinfo.h"
|
||||||
|
|
||||||
|
|
||||||
DolphinItemListContainer::DolphinItemListContainer(KDirLister* dirLister,
|
DolphinItemListContainer::DolphinItemListContainer(QWidget* parent) :
|
||||||
QWidget* parent) :
|
|
||||||
KItemListContainer(parent),
|
KItemListContainer(parent),
|
||||||
m_zoomLevel(0),
|
m_zoomLevel(0),
|
||||||
m_fileItemListView(0)
|
m_fileItemListView(0)
|
||||||
{
|
{
|
||||||
controller()->setModel(new KFileItemModel(dirLister, this));
|
controller()->setModel(new KFileItemModel(this));
|
||||||
|
|
||||||
m_fileItemListView = new KFileItemListView();
|
m_fileItemListView = new KFileItemListView();
|
||||||
controller()->setView(m_fileItemListView);
|
controller()->setView(m_fileItemListView);
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <libdolphin_export.h>
|
#include <libdolphin_export.h>
|
||||||
|
|
||||||
class KDirLister;
|
|
||||||
class KFileItemListView;
|
class KFileItemListView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,8 +43,7 @@ class LIBDOLPHINPRIVATE_EXPORT DolphinItemListContainer : public KItemListContai
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DolphinItemListContainer(KDirLister* dirLister,
|
explicit DolphinItemListContainer(QWidget* parent = 0);
|
||||||
QWidget* parent = 0);
|
|
||||||
|
|
||||||
virtual ~DolphinItemListContainer();
|
virtual ~DolphinItemListContainer();
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <KColorScheme>
|
#include <KColorScheme>
|
||||||
#include <KDirLister>
|
|
||||||
#include <KDirModel>
|
#include <KDirModel>
|
||||||
#include <KIconEffect>
|
#include <KIconEffect>
|
||||||
#include <KFileItem>
|
#include <KFileItem>
|
||||||
|
@ -59,7 +58,6 @@
|
||||||
#include <KToggleAction>
|
#include <KToggleAction>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
|
|
||||||
#include "dolphindirlister.h"
|
|
||||||
#include "dolphinnewfilemenuobserver.h"
|
#include "dolphinnewfilemenuobserver.h"
|
||||||
#include "dolphin_detailsmodesettings.h"
|
#include "dolphin_detailsmodesettings.h"
|
||||||
#include "dolphin_generalsettings.h"
|
#include "dolphin_generalsettings.h"
|
||||||
|
@ -91,7 +89,6 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
|
||||||
m_mode(DolphinView::IconsView),
|
m_mode(DolphinView::IconsView),
|
||||||
m_visibleRoles(),
|
m_visibleRoles(),
|
||||||
m_topLayout(0),
|
m_topLayout(0),
|
||||||
m_dirLister(0),
|
|
||||||
m_container(0),
|
m_container(0),
|
||||||
m_toolTipManager(0),
|
m_toolTipManager(0),
|
||||||
m_selectionChangedTimer(0),
|
m_selectionChangedTimer(0),
|
||||||
|
@ -117,24 +114,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
|
||||||
connect(m_selectionChangedTimer, SIGNAL(timeout()),
|
connect(m_selectionChangedTimer, SIGNAL(timeout()),
|
||||||
this, SLOT(emitSelectionChangedSignal()));
|
this, SLOT(emitSelectionChangedSignal()));
|
||||||
|
|
||||||
m_dirLister = new DolphinDirLister(this);
|
m_container = new DolphinItemListContainer(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->setVisibleRoles(QList<QByteArray>() << "name");
|
m_container->setVisibleRoles(QList<QByteArray>() << "name");
|
||||||
m_container->installEventFilter(this);
|
m_container->installEventFilter(this);
|
||||||
setFocusProxy(m_container);
|
setFocusProxy(m_container);
|
||||||
|
@ -156,10 +136,17 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
|
||||||
connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
|
connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
|
||||||
|
|
||||||
KFileItemModel* model = fileItemModel();
|
KFileItemModel* model = fileItemModel();
|
||||||
if (model) {
|
connect(model, SIGNAL(dirLoadingStarted()), this, SLOT(slotDirLoadingStarted()));
|
||||||
connect(model, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
|
connect(model, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
|
||||||
connect(model, SIGNAL(sortProgress(int)), this, SIGNAL(sortProgress(int)));
|
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();
|
KItemListView* view = controller->view();
|
||||||
view->installEventFilter(this);
|
view->installEventFilter(this);
|
||||||
|
@ -269,7 +256,8 @@ bool DolphinView::previewsShown() const
|
||||||
|
|
||||||
void DolphinView::setHiddenFilesShown(bool show)
|
void DolphinView::setHiddenFilesShown(bool show)
|
||||||
{
|
{
|
||||||
if (m_dirLister->showingDotFiles() == show) {
|
KFileItemModel* model = fileItemModel();
|
||||||
|
if (model->showHiddenFiles() == show) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,13 +268,13 @@ void DolphinView::setHiddenFilesShown(bool show)
|
||||||
ViewProperties props(url());
|
ViewProperties props(url());
|
||||||
props.setHiddenFilesShown(show);
|
props.setHiddenFilesShown(show);
|
||||||
|
|
||||||
fileItemModel()->setShowHiddenFiles(show);
|
model->setShowHiddenFiles(show);
|
||||||
emit hiddenFilesShownChanged(show);
|
emit hiddenFilesShownChanged(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DolphinView::hiddenFilesShown() const
|
bool DolphinView::hiddenFilesShown() const
|
||||||
{
|
{
|
||||||
return m_dirLister->showingDotFiles();
|
return fileItemModel()->showHiddenFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinView::setGroupedSorting(bool grouped)
|
void DolphinView::setGroupedSorting(bool grouped)
|
||||||
|
@ -311,7 +299,21 @@ bool DolphinView::groupedSorting() const
|
||||||
|
|
||||||
KFileItemList DolphinView::items() const
|
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
|
KFileItemList DolphinView::selectedItems() const
|
||||||
|
@ -455,7 +457,7 @@ void DolphinView::reload()
|
||||||
|
|
||||||
void DolphinView::stopLoading()
|
void DolphinView::stopLoading()
|
||||||
{
|
{
|
||||||
m_dirLister->stop();
|
fileItemModel()->cancelDirLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinView::readSettings()
|
void DolphinView::readSettings()
|
||||||
|
@ -492,7 +494,10 @@ void DolphinView::calculateItemCount(int& fileCount,
|
||||||
int& folderCount,
|
int& folderCount,
|
||||||
KIO::filesize_t& totalFileSize) const
|
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()) {
|
if (item.isDir()) {
|
||||||
++folderCount;
|
++folderCount;
|
||||||
} else {
|
} else {
|
||||||
|
@ -628,8 +633,9 @@ void DolphinView::renameSelectedItems()
|
||||||
dialog->activateWindow();
|
dialog->activateWindow();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// assure that the current index remains visible when KDirLister
|
// Assure that the current index remains visible when KFileItemModel
|
||||||
// will notify the view about changed items
|
// will notify the view about changed items (which might result in
|
||||||
|
// a changed sorting).
|
||||||
m_assureVisibleCurrentIndex = true;
|
m_assureVisibleCurrentIndex = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,11 +985,11 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
|
||||||
void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
|
void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
|
||||||
{
|
{
|
||||||
if (previous != 0) {
|
if (previous != 0) {
|
||||||
disconnect(previous, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
|
disconnect(previous, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(qobject_cast<KFileItemModel*>(current));
|
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);
|
KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
|
||||||
m_versionControlObserver->setModel(fileItemModel);
|
m_versionControlObserver->setModel(fileItemModel);
|
||||||
|
@ -1121,7 +1127,7 @@ bool DolphinView::hasSelection() const
|
||||||
|
|
||||||
KFileItem DolphinView::rootItem() const
|
KFileItem DolphinView::rootItem() const
|
||||||
{
|
{
|
||||||
return m_dirLister->rootItem();
|
return fileItemModel()->rootItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinView::observeCreatedItem(const KUrl& url)
|
void DolphinView::observeCreatedItem(const KUrl& url)
|
||||||
|
@ -1222,7 +1228,7 @@ void DolphinView::slotDeleteFileFinished(KJob* job)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinView::slotDirListerStarted(const KUrl& url)
|
void DolphinView::slotDirLoadingStarted()
|
||||||
{
|
{
|
||||||
// Disable the writestate temporary until it can be determined in a fast way
|
// Disable the writestate temporary until it can be determined in a fast way
|
||||||
// in DolphinView::slotLoadingCompleted()
|
// in DolphinView::slotLoadingCompleted()
|
||||||
|
@ -1231,29 +1237,23 @@ void DolphinView::slotDirListerStarted(const KUrl& url)
|
||||||
emit writeStateChanged(m_isFolderWritable);
|
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
|
// Update the view-state. This has to be done using a Qt::QueuedConnection
|
||||||
// because the view might not be in its final state yet.
|
// because the view might not be in its final state yet.
|
||||||
QTimer::singleShot(0, this, SLOT(updateViewState()));
|
QTimer::singleShot(0, this, SLOT(updateViewState()));
|
||||||
|
|
||||||
emit finishedPathLoading(url());
|
emit finishedDirLoading(url());
|
||||||
|
|
||||||
updateWritableState();
|
updateWritableState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinView::slotRefreshItems()
|
void DolphinView::slotItemsChanged()
|
||||||
{
|
{
|
||||||
if (m_assureVisibleCurrentIndex) {
|
|
||||||
m_assureVisibleCurrentIndex = false;
|
m_assureVisibleCurrentIndex = false;
|
||||||
//QAbstractItemView* view = m_viewAccessor.itemView();
|
|
||||||
//if (view) {
|
|
||||||
// m_viewAccessor.itemView()->scrollTo(m_viewAccessor.itemView()->currentIndex());
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous)
|
void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous)
|
||||||
|
@ -1311,7 +1311,12 @@ void DolphinView::loadDirectory(const KUrl& url, bool reload)
|
||||||
return;
|
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()
|
void DolphinView::applyViewProperties()
|
||||||
|
@ -1465,7 +1470,7 @@ void DolphinView::updateWritableState()
|
||||||
const bool wasFolderWritable = m_isFolderWritable;
|
const bool wasFolderWritable = m_isFolderWritable;
|
||||||
m_isFolderWritable = true;
|
m_isFolderWritable = true;
|
||||||
|
|
||||||
const KFileItem item = m_dirLister->rootItem();
|
const KFileItem item = fileItemModel()->rootItem();
|
||||||
if (!item.isNull()) {
|
if (!item.isNull()) {
|
||||||
KFileItemListProperties capabilities(KFileItemList() << item);
|
KFileItemListProperties capabilities(KFileItemList() << item);
|
||||||
m_isFolderWritable = capabilities.supportsWriting();
|
m_isFolderWritable = capabilities.supportsWriting();
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
typedef KIO::FileUndoManager::CommandType CommandType;
|
typedef KIO::FileUndoManager::CommandType CommandType;
|
||||||
|
|
||||||
class DolphinDirLister;
|
|
||||||
class DolphinItemListContainer;
|
class DolphinItemListContainer;
|
||||||
class KAction;
|
class KAction;
|
||||||
class KActionCollection;
|
class KActionCollection;
|
||||||
|
@ -154,6 +153,12 @@ public:
|
||||||
*/
|
*/
|
||||||
KFileItemList items() const;
|
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
|
* Returns the selected items. The list is empty if no item has been
|
||||||
* selected.
|
* selected.
|
||||||
|
@ -474,25 +479,29 @@ signals:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is emitted after DolphinView::setUrl() has been invoked and
|
* 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
|
* it is assured that the view contains already the correct root
|
||||||
* URL and property settings.
|
* 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.
|
* has been loaded.
|
||||||
*/
|
*/
|
||||||
void finishedPathLoading(const KUrl& url);
|
void finishedDirLoading(const KUrl& url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is emitted after DolphinView::setUrl() has been invoked and provides
|
* 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
|
* Is emitted if the DolphinView::setUrl() is invoked but the URL is not
|
||||||
|
@ -501,7 +510,7 @@ signals:
|
||||||
void urlIsFileError(const KUrl& file);
|
void urlIsFileError(const KUrl& file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when KDirLister emits redirection.
|
* Emitted when the file-item-model emits redirection.
|
||||||
* Testcase: fish://localhost
|
* Testcase: fish://localhost
|
||||||
*/
|
*/
|
||||||
void redirection(const KUrl& oldUrl, const KUrl& newUrl);
|
void redirection(const KUrl& oldUrl, const KUrl& newUrl);
|
||||||
|
@ -606,23 +615,21 @@ private slots:
|
||||||
void slotDeleteFileFinished(KJob* job);
|
void slotDeleteFileFinished(KJob* job);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when the directory lister has been started the
|
* Invoked when the file item model has started the loading
|
||||||
* loading of \a url.
|
* 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
|
* Invoked when the file item model indicates that the loading of a directory has
|
||||||
* of items, and that expanded folders have been restored (if the view mode is 'Details', and the
|
* been completed. Assures that pasted items and renamed items get seleced.
|
||||||
* view state is restored after navigating back or forward in history). 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
|
* Is invoked when the sort order has been changed by the user by clicking
|
||||||
|
@ -730,7 +737,6 @@ private:
|
||||||
|
|
||||||
QVBoxLayout* m_topLayout;
|
QVBoxLayout* m_topLayout;
|
||||||
|
|
||||||
DolphinDirLister* m_dirLister;
|
|
||||||
DolphinItemListContainer* m_container;
|
DolphinItemListContainer* m_container;
|
||||||
|
|
||||||
ToolTipManager* m_toolTipManager;
|
ToolTipManager* m_toolTipManager;
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include "dolphin_versioncontrolsettings.h"
|
#include "dolphin_versioncontrolsettings.h"
|
||||||
|
|
||||||
#include <KDirLister>
|
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KService>
|
#include <KService>
|
||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
|
@ -30,6 +29,7 @@
|
||||||
|
|
||||||
#include "updateitemstatesthread.h"
|
#include "updateitemstatesthread.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
@ -298,7 +298,6 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
|
||||||
// Verify whether the current directory contains revision information
|
// Verify whether the current directory contains revision information
|
||||||
// like .svn, .git, ...
|
// like .svn, .git, ...
|
||||||
foreach (KVersionControlPlugin* plugin, plugins) {
|
foreach (KVersionControlPlugin* plugin, plugins) {
|
||||||
// Use the KDirLister cache to check for .svn, .git, ... files
|
|
||||||
const QString fileName = directory.path(KUrl::AddTrailingSlash) + plugin->fileName();
|
const QString fileName = directory.path(KUrl::AddTrailingSlash) + plugin->fileName();
|
||||||
if (QFile::exists(fileName)) {
|
if (QFile::exists(fileName)) {
|
||||||
return plugin;
|
return plugin;
|
||||||
|
|
Loading…
Reference in a new issue