┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kfileitemlistview.cpp19
-rw-r--r--src/kitemviews/kfileitemlistview.h37
-rw-r--r--src/kitemviews/kfileitemlistwidget.cpp16
-rw-r--r--src/kitemviews/kfileitemlistwidget.h22
-rw-r--r--src/kitemviews/kfileitemmodel.cpp284
-rw-r--r--src/kitemviews/kfileitemmodel.h84
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp159
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.h12
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp57
-rw-r--r--src/kitemviews/kitemlistcontainer.h16
-rw-r--r--src/kitemviews/kitemlistcontroller.cpp35
-rw-r--r--src/kitemviews/kitemlistcontroller.h10
-rw-r--r--src/kitemviews/kitemlistgroupheader.cpp2
-rw-r--r--src/kitemviews/kitemlistgroupheader.h9
-rw-r--r--src/kitemviews/kitemlistheader.cpp5
-rw-r--r--src/kitemviews/kitemlistheader.h4
-rw-r--r--src/kitemviews/kitemlistselectionmanager.cpp3
-rw-r--r--src/kitemviews/kitemlistselectionmanager.h4
-rw-r--r--src/kitemviews/kitemliststyleoption.cpp1
-rw-r--r--src/kitemviews/kitemliststyleoption.h4
-rw-r--r--src/kitemviews/kitemlistview.cpp167
-rw-r--r--src/kitemviews/kitemlistview.h35
-rw-r--r--src/kitemviews/kitemlistviewaccessible.cpp259
-rw-r--r--src/kitemviews/kitemlistviewaccessible.h158
-rw-r--r--src/kitemviews/kitemlistwidget.cpp7
-rw-r--r--src/kitemviews/kitemlistwidget.h10
-rw-r--r--src/kitemviews/kitemmodelbase.cpp1
-rw-r--r--src/kitemviews/kitemmodelbase.h4
-rw-r--r--src/kitemviews/kstandarditem.cpp4
-rw-r--r--src/kitemviews/kstandarditem.h5
-rw-r--r--src/kitemviews/kstandarditemlistgroupheader.cpp3
-rw-r--r--src/kitemviews/kstandarditemlistgroupheader.h16
-rw-r--r--src/kitemviews/kstandarditemlistview.cpp4
-rw-r--r--src/kitemviews/kstandarditemlistview.h18
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp50
-rw-r--r--src/kitemviews/kstandarditemlistwidget.h48
-rw-r--r--src/kitemviews/kstandarditemmodel.cpp6
-rw-r--r--src/kitemviews/kstandarditemmodel.h20
-rw-r--r--src/kitemviews/private/kbaloorolesprovider.cpp19
-rw-r--r--src/kitemviews/private/kbaloorolesprovider.h7
-rw-r--r--src/kitemviews/private/kdirectorycontentscounter.cpp20
-rw-r--r--src/kitemviews/private/kdirectorycontentscounterworker.h1
-rw-r--r--src/kitemviews/private/kfileitemclipboard.cpp16
-rw-r--r--src/kitemviews/private/kfileitemclipboard.h12
-rw-r--r--src/kitemviews/private/kfileitemmodeldirlister.cpp5
-rw-r--r--src/kitemviews/private/kfileitemmodeldirlister.h7
-rw-r--r--src/kitemviews/private/kfileitemmodelfilter.h4
-rw-r--r--src/kitemviews/private/kfileitemmodelsortalgorithm.h2
-rw-r--r--src/kitemviews/private/kitemlistheaderwidget.cpp20
-rw-r--r--src/kitemviews/private/kitemlistheaderwidget.h4
-rw-r--r--src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp2
-rw-r--r--src/kitemviews/private/kitemlistkeyboardsearchmanager.h4
-rw-r--r--src/kitemviews/private/kitemlistroleeditor.cpp6
-rw-r--r--src/kitemviews/private/kitemlistroleeditor.h4
-rw-r--r--src/kitemviews/private/kitemlistrubberband.cpp1
-rw-r--r--src/kitemviews/private/kitemlistrubberband.h4
-rw-r--r--src/kitemviews/private/kitemlistselectiontoggle.cpp3
-rw-r--r--src/kitemviews/private/kitemlistselectiontoggle.h5
-rw-r--r--src/kitemviews/private/kitemlistsizehintresolver.h4
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp11
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.h4
-rw-r--r--src/kitemviews/private/kitemlistviewanimation.cpp18
-rw-r--r--src/kitemviews/private/kitemlistviewanimation.h6
-rw-r--r--src/kitemviews/private/kitemlistviewlayouter.cpp5
-rw-r--r--src/kitemviews/private/kitemlistviewlayouter.h4
-rw-r--r--src/kitemviews/private/kpixmapmodifier.cpp1
-rw-r--r--src/kitemviews/private/kpixmapmodifier.h4
67 files changed, 827 insertions, 974 deletions
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp
index fd01f2c4c..d249bef91 100644
--- a/src/kitemviews/kfileitemlistview.cpp
+++ b/src/kitemviews/kfileitemlistview.cpp
@@ -22,16 +22,12 @@
#include "kfileitemmodelrolesupdater.h"
#include "kfileitemlistwidget.h"
#include "kfileitemmodel.h"
-#include <KLocale>
-#include <KStringHandler>
#include "private/kpixmapmodifier.h"
-#include <KDebug>
-#include <KIcon>
-#include <KTextEdit>
+#include <QIcon>
+#include <KIconLoader>
#include <QPainter>
-#include <QTextLine>
#include <QTimer>
// #define KFILEITEMLISTVIEW_DEBUG
@@ -62,14 +58,14 @@ KFileItemListView::KFileItemListView(QGraphicsWidget* parent) :
m_updateVisibleIndexRangeTimer = new QTimer(this);
m_updateVisibleIndexRangeTimer->setSingleShot(true);
m_updateVisibleIndexRangeTimer->setInterval(ShortInterval);
- connect(m_updateVisibleIndexRangeTimer, SIGNAL(timeout()), this, SLOT(updateVisibleIndexRange()));
+ connect(m_updateVisibleIndexRangeTimer, &QTimer::timeout, this, &KFileItemListView::updateVisibleIndexRange);
m_updateIconSizeTimer = new QTimer(this);
m_updateIconSizeTimer->setSingleShot(true);
m_updateIconSizeTimer->setInterval(LongInterval);
- connect(m_updateIconSizeTimer, SIGNAL(timeout()), this, SLOT(updateIconSize()));
+ connect(m_updateIconSizeTimer, &QTimer::timeout, this, &KFileItemListView::updateIconSize);
- setVisibleRoles(QList<QByteArray>() << "text");
+ setVisibleRoles({"text"});
}
KFileItemListView::~KFileItemListView()
@@ -169,7 +165,7 @@ QPixmap KFileItemListView::createDragPixmap(const KItemSet& indexes) const
foreach (int index, indexes) {
QPixmap pixmap = model()->data(index).value("iconPixmap").value<QPixmap>();
if (pixmap.isNull()) {
- KIcon icon(model()->data(index).value("iconName").toString());
+ QIcon icon = QIcon::fromTheme(model()->data(index).value("iconName").toString());
pixmap = icon.pixmap(size, size);
} else {
KPixmapModifier::scale(pixmap, QSize(size, size));
@@ -208,7 +204,7 @@ void KFileItemListView::initializeItemListWidget(KItemListWidget* item)
const KFileItem fileItem = fileItemModel->fileItem(item->index());
data.insert("iconName", fileItem.iconName());
- item->setData(data, QSet<QByteArray>() << "iconName");
+ item->setData(data, {"iconName"});
}
}
@@ -421,4 +417,3 @@ QSize KFileItemListView::availableIconSize() const
return QSize(iconSize, iconSize);
}
-#include "kfileitemlistview.moc"
diff --git a/src/kitemviews/kfileitemlistview.h b/src/kitemviews/kfileitemlistview.h
index 2fd21edbf..84aa17d89 100644
--- a/src/kitemviews/kfileitemlistview.h
+++ b/src/kitemviews/kfileitemlistview.h
@@ -20,7 +20,7 @@
#ifndef KFILEITEMLISTVIEW_H
#define KFILEITEMLISTVIEW_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kstandarditemlistview.h>
@@ -36,7 +36,7 @@ class QTimer;
* KItemListView::setWidgetCreator() and KItemListView::setGroupHeaderCreator()
* to apply customized generators.
*/
-class LIBDOLPHINPRIVATE_EXPORT KFileItemListView : public KStandardItemListView
+class DOLPHIN_EXPORT KFileItemListView : public KStandardItemListView
{
Q_OBJECT
@@ -72,28 +72,27 @@ public:
*/
QStringList enabledPlugins() const;
- /** @reimp */
- virtual QPixmap createDragPixmap(const KItemSet& indexes) const;
+ virtual QPixmap createDragPixmap(const KItemSet& indexes) const Q_DECL_OVERRIDE;
protected:
- virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const;
- virtual void initializeItemListWidget(KItemListWidget* item);
+ virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const Q_DECL_OVERRIDE;
+ virtual void initializeItemListWidget(KItemListWidget* item) Q_DECL_OVERRIDE;
virtual void onPreviewsShownChanged(bool shown);
- virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous);
- virtual void onModelChanged(KItemModelBase* current, KItemModelBase* previous);
- virtual void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous);
- virtual void onItemSizeChanged(const QSizeF& current, const QSizeF& previous);
- virtual void onScrollOffsetChanged(qreal current, qreal previous);
- virtual void onVisibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous);
- virtual void onStyleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous);
- virtual void onSupportsItemExpandingChanged(bool supportsExpanding);
- virtual void onTransactionBegin();
- virtual void onTransactionEnd();
- virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
+ virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous) Q_DECL_OVERRIDE;
+ virtual void onModelChanged(KItemModelBase* current, KItemModelBase* previous) Q_DECL_OVERRIDE;
+ virtual void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous) Q_DECL_OVERRIDE;
+ virtual void onItemSizeChanged(const QSizeF& current, const QSizeF& previous) Q_DECL_OVERRIDE;
+ virtual void onScrollOffsetChanged(qreal current, qreal previous) Q_DECL_OVERRIDE;
+ virtual void onVisibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous) Q_DECL_OVERRIDE;
+ virtual void onStyleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous) Q_DECL_OVERRIDE;
+ virtual void onSupportsItemExpandingChanged(bool supportsExpanding) Q_DECL_OVERRIDE;
+ virtual void onTransactionBegin() Q_DECL_OVERRIDE;
+ virtual void onTransactionEnd() Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE;
protected slots:
- virtual void slotItemsRemoved(const KItemRangeList& itemRanges);
- virtual void slotSortRoleChanged(const QByteArray& current, const QByteArray& previous);
+ virtual void slotItemsRemoved(const KItemRangeList& itemRanges) Q_DECL_OVERRIDE;
+ virtual void slotSortRoleChanged(const QByteArray& current, const QByteArray& previous) Q_DECL_OVERRIDE;
private slots:
void triggerVisibleIndexRangeUpdate();
diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp
index fe8c7e997..7e5b4bb13 100644
--- a/src/kitemviews/kfileitemlistwidget.cpp
+++ b/src/kitemviews/kfileitemlistwidget.cpp
@@ -21,12 +21,12 @@
#include "kfileitemmodel.h"
#include "kitemlistview.h"
-#include <kmimetype.h>
-#include <KDebug>
-#include <KGlobal>
-#include <KLocale>
+#include <KLocalizedString>
#include <KIO/MetaData>
#include <QDateTime>
+#include <KFormat>
+#include <QMimeDatabase>
+#include <QLocale>
KFileItemListWidgetInformant::KFileItemListWidgetInformant() :
KStandardItemListWidgetInformant()
@@ -78,11 +78,11 @@ QString KFileItemListWidgetInformant::roleText(const QByteArray& role,
}
} else {
const KIO::filesize_t size = roleValue.value<KIO::filesize_t>();
- text = KGlobal::locale()->formatByteSize(size);
+ text = KFormat().formatByteSize(size);
}
} else if (role == "date") {
const QDateTime dateTime = roleValue.toDateTime();
- text = KGlobal::locale()->formatDateTime(dateTime);
+ text = QLocale().toString(dateTime, QLocale::ShortFormat);
} else {
text = KStandardItemListWidgetInformant::roleText(role, values);
}
@@ -142,7 +142,8 @@ int KFileItemListWidget::selectionLength(const QString& text) const
return selectionLength;
}
- const QString extension = KMimeType::extractKnownExtension(text);
+ QMimeDatabase db;
+ const QString extension = db.suffixForFileName(text);
if (extension.isEmpty()) {
// For an unknown extension just exclude the extension after
// the last point. This does not work for multiple extensions like
@@ -161,4 +162,3 @@ int KFileItemListWidget::selectionLength(const QString& text) const
return selectionLength;
}
-#include "kfileitemlistwidget.moc"
diff --git a/src/kitemviews/kfileitemlistwidget.h b/src/kitemviews/kfileitemlistwidget.h
index 8e8958b16..07ca59b44 100644
--- a/src/kitemviews/kfileitemlistwidget.h
+++ b/src/kitemviews/kfileitemlistwidget.h
@@ -20,24 +20,24 @@
#ifndef KFILEITEMLISTWIDGET_H
#define KFILEITEMLISTWIDGET_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kstandarditemlistwidget.h>
-class LIBDOLPHINPRIVATE_EXPORT KFileItemListWidgetInformant : public KStandardItemListWidgetInformant
+class DOLPHIN_EXPORT KFileItemListWidgetInformant : public KStandardItemListWidgetInformant
{
public:
KFileItemListWidgetInformant();
virtual ~KFileItemListWidgetInformant();
protected:
- virtual QString itemText(int index, const KItemListView* view) const;
- virtual bool itemIsLink(int index, const KItemListView* view) const;
- virtual QString roleText(const QByteArray& role, const QHash<QByteArray, QVariant>& values) const;
- virtual QFont customizedFontForLinks(const QFont& baseFont) const;
+ virtual QString itemText(int index, const KItemListView* view) const Q_DECL_OVERRIDE;
+ virtual bool itemIsLink(int index, const KItemListView* view) const Q_DECL_OVERRIDE;
+ virtual QString roleText(const QByteArray& role, const QHash<QByteArray, QVariant>& values) const Q_DECL_OVERRIDE;
+ virtual QFont customizedFontForLinks(const QFont& baseFont) const Q_DECL_OVERRIDE;
};
-class LIBDOLPHINPRIVATE_EXPORT KFileItemListWidget : public KStandardItemListWidget
+class DOLPHIN_EXPORT KFileItemListWidget : public KStandardItemListWidget
{
Q_OBJECT
@@ -48,14 +48,14 @@ public:
static KItemListWidgetInformant* createInformant();
protected:
- virtual bool isRoleRightAligned(const QByteArray& role) const;
- virtual bool isHidden() const;
- virtual QFont customizedFont(const QFont& baseFont) const;
+ virtual bool isRoleRightAligned(const QByteArray& role) const Q_DECL_OVERRIDE;
+ virtual bool isHidden() const Q_DECL_OVERRIDE;
+ virtual QFont customizedFont(const QFont& baseFont) const Q_DECL_OVERRIDE;
/**
* @return Selection length without MIME-type extension
*/
- virtual int selectionLength(const QString& text) const;
+ virtual int selectionLength(const QString& text) const Q_DECL_OVERRIDE;
};
#endif
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 72acf776a..eac3ddf8b 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -21,15 +21,14 @@
#include "kfileitemmodel.h"
-#include <KGlobalSettings>
-#include <KLocale>
-#include <KStringHandler>
-#include <KDebug>
+#include "dolphin_generalsettings.h"
+
+#include <KLocalizedString>
+#include "dolphindebug.h"
#include "private/kfileitemmodelsortalgorithm.h"
#include "private/kfileitemmodeldirlister.h"
-#include <QApplication>
#include <QMimeData>
#include <QTimer>
#include <QWidget>
@@ -42,12 +41,11 @@
KFileItemModel::KFileItemModel(QObject* parent) :
KItemModelBase("text", parent),
m_dirLister(0),
- m_naturalSorting(KGlobalSettings::naturalSorting()),
+ m_naturalSorting(GeneralSettings::naturalSorting()),
m_sortDirsFirst(true),
m_sortRole(NameRole),
m_sortingProgressPercent(-1),
m_roles(),
- m_caseSensitivity(Qt::CaseInsensitive),
m_itemData(),
m_items(),
m_filter(),
@@ -60,6 +58,9 @@ KFileItemModel::KFileItemModel(QObject* parent) :
m_expandedDirs(),
m_urlsToExpand()
{
+ m_collator.setCaseSensitivity(Qt::CaseInsensitive);
+ m_collator.setNumericMode(true);
+
m_dirLister = new KFileItemModelDirLister(this);
m_dirLister->setDelayedMimeTypes(true);
@@ -68,17 +69,17 @@ KFileItemModel::KFileItemModel(QObject* parent) :
m_dirLister->setMainWindow(parentWidget->window());
}
- connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(directoryLoadingStarted()));
- connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled()));
- connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted()));
- connect(m_dirLister, SIGNAL(itemsAdded(KUrl,KFileItemList)), this, SLOT(slotItemsAdded(KUrl,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(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(directoryRedirection(KUrl,KUrl)));
- connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
+ connect(m_dirLister, &KFileItemModelDirLister::started, this, &KFileItemModel::directoryLoadingStarted);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)()>(&KFileItemModelDirLister::canceled), this, &KFileItemModel::slotCanceled);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)(const QUrl&)>(&KFileItemModelDirLister::completed), this, &KFileItemModel::slotCompleted);
+ connect(m_dirLister, &KFileItemModelDirLister::itemsAdded, this, &KFileItemModel::slotItemsAdded);
+ connect(m_dirLister, &KFileItemModelDirLister::itemsDeleted, this, &KFileItemModel::slotItemsDeleted);
+ connect(m_dirLister, &KFileItemModelDirLister::refreshItems, this, &KFileItemModel::slotRefreshItems);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)()>(&KFileItemModelDirLister::clear), this, &KFileItemModel::slotClear);
+ connect(m_dirLister, &KFileItemModelDirLister::infoMessage, this, &KFileItemModel::infoMessage);
+ connect(m_dirLister, &KFileItemModelDirLister::errorMessage, this, &KFileItemModel::errorMessage);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)(const QUrl&, const QUrl&)>(&KFileItemModelDirLister::redirection), this, &KFileItemModel::directoryRedirection);
+ connect(m_dirLister, &KFileItemModelDirLister::urlIsFileError, this, &KFileItemModel::urlIsFileError);
// Apply default roles that should be determined
resetRoles();
@@ -94,7 +95,7 @@ KFileItemModel::KFileItemModel(QObject* parent) :
m_maximumUpdateIntervalTimer = new QTimer(this);
m_maximumUpdateIntervalTimer->setInterval(2000);
m_maximumUpdateIntervalTimer->setSingleShot(true);
- connect(m_maximumUpdateIntervalTimer, SIGNAL(timeout()), this, SLOT(dispatchPendingItemsToInsert()));
+ connect(m_maximumUpdateIntervalTimer, &QTimer::timeout, this, &KFileItemModel::dispatchPendingItemsToInsert);
// When changing the value of an item which represents the sort-role a resorting must be
// triggered. Especially in combination with KFileItemModelRolesUpdater this might be done
@@ -103,9 +104,10 @@ KFileItemModel::KFileItemModel(QObject* parent) :
m_resortAllItemsTimer = new QTimer(this);
m_resortAllItemsTimer->setInterval(500);
m_resortAllItemsTimer->setSingleShot(true);
- connect(m_resortAllItemsTimer, SIGNAL(timeout()), this, SLOT(resortAllItems()));
+ connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel::resortAllItems);
- connect(KGlobalSettings::self(), SIGNAL(naturalSortingChanged()), this, SLOT(slotNaturalSortingChanged()));
+ connect(GeneralSettings::self(), &GeneralSettings::naturalSortingChanged,
+ this, &KFileItemModel::slotNaturalSortingChanged);
}
KFileItemModel::~KFileItemModel()
@@ -115,15 +117,15 @@ KFileItemModel::~KFileItemModel()
qDeleteAll(m_pendingItemsToInsert);
}
-void KFileItemModel::loadDirectory(const KUrl& url)
+void KFileItemModel::loadDirectory(const QUrl &url)
{
m_dirLister->openUrl(url);
}
-void KFileItemModel::refreshDirectory(const KUrl& url)
+void KFileItemModel::refreshDirectory(const QUrl &url)
{
// Refresh all expanded directories first (Bug 295300)
- QHashIterator<KUrl, KUrl> expandedDirs(m_expandedDirs);
+ QHashIterator<QUrl, QUrl> expandedDirs(m_expandedDirs);
while (expandedDirs.hasNext()) {
expandedDirs.next();
m_dirLister->openUrl(expandedDirs.value(), KDirLister::Reload);
@@ -132,7 +134,7 @@ void KFileItemModel::refreshDirectory(const KUrl& url)
m_dirLister->openUrl(url, KDirLister::Reload);
}
-KUrl KFileItemModel::directory() const
+QUrl KFileItemModel::directory() const
{
return m_dirLister->url();
}
@@ -188,8 +190,9 @@ bool KFileItemModel::setData(int index, const QHash<QByteArray, QVariant>& value
m_itemData[index]->values = currentValues;
if (changedRoles.contains("text")) {
- KUrl url = m_itemData[index]->item.url();
- url.setFileName(currentValues["text"].toString());
+ QUrl url = m_itemData[index]->item.url();
+ url = url.adjusted(QUrl::RemoveFilename);
+ url.setPath(url.path() + currentValues["text"].toString());
m_itemData[index]->item.setUrl(url);
}
@@ -242,8 +245,8 @@ QMimeData* KFileItemModel::createMimeData(const KItemSet& indexes) const
// The following code has been taken from KDirModel::mimeData()
// (kdelibs/kio/kio/kdirmodel.cpp)
// Copyright (C) 2006 David Faure <[email protected]>
- KUrl::List urls;
- KUrl::List mostLocalUrls;
+ QList<QUrl> urls;
+ QList<QUrl> mostLocalUrls;
bool canUseMostLocalUrls = true;
const ItemData* lastAddedItem = 0;
@@ -275,9 +278,9 @@ QMimeData* KFileItemModel::createMimeData(const KItemSet& indexes) const
const bool different = canUseMostLocalUrls && mostLocalUrls != urls;
if (different) {
- urls.populateMimeData(mostLocalUrls, data);
+ data->setUrls(mostLocalUrls);
} else {
- urls.populateMimeData(data);
+ data->setUrls(urls);
}
return data;
@@ -336,7 +339,7 @@ QList<QPair<int, QVariant> > KFileItemModel::groups() const
}
#ifdef KFILEITEMMODEL_DEBUG
- kDebug() << "[TIME] Calculating groups for" << count() << "items:" << timer.elapsed();
+ qCDebug(DolphinDebug) << "[TIME] Calculating groups for" << count() << "items:" << timer.elapsed();
#endif
}
@@ -352,7 +355,7 @@ KFileItem KFileItemModel::fileItem(int index) const
return KFileItem();
}
-KFileItem KFileItemModel::fileItem(const KUrl& url) const
+KFileItem KFileItemModel::fileItem(const QUrl &url) const
{
const int indexForUrl = index(url);
if (indexForUrl >= 0) {
@@ -366,10 +369,9 @@ int KFileItemModel::index(const KFileItem& item) const
return index(item.url());
}
-int KFileItemModel::index(const KUrl& url) const
+int KFileItemModel::index(const QUrl& url) const
{
- KUrl urlToFind = url;
- urlToFind.adjustPath(KUrl::RemoveTrailingSlash);
+ const QUrl urlToFind = url.adjusted(QUrl::StripTrailingSlash);
const int itemCount = m_itemData.count();
int itemsInHash = m_items.count();
@@ -387,7 +389,7 @@ int KFileItemModel::index(const KUrl& url) const
const int blockSize = 1000;
const int currentBlockEnd = qMin(itemsInHash + blockSize, itemCount);
for (int i = itemsInHash; i < currentBlockEnd; ++i) {
- const KUrl nextUrl = m_itemData.at(i)->item.url();
+ const QUrl nextUrl = m_itemData.at(i)->item.url();
m_items.insert(nextUrl, i);
}
@@ -406,24 +408,24 @@ int KFileItemModel::index(const KUrl& url) const
if (m_items.count() != m_itemData.count() && printDebugInfo) {
printDebugInfo = false;
- kWarning() << "The model is in an inconsistent state.";
- kWarning() << "m_items.count() ==" << m_items.count();
- kWarning() << "m_itemData.count() ==" << m_itemData.count();
+ qCWarning(DolphinDebug) << "The model is in an inconsistent state.";
+ qCWarning(DolphinDebug) << "m_items.count() ==" << m_items.count();
+ qCWarning(DolphinDebug) << "m_itemData.count() ==" << m_itemData.count();
// Check if there are multiple items with the same URL.
- QMultiHash<KUrl, int> indexesForUrl;
+ QMultiHash<QUrl, int> indexesForUrl;
for (int i = 0; i < m_itemData.count(); ++i) {
indexesForUrl.insert(m_itemData.at(i)->item.url(), i);
}
- foreach (const KUrl& url, indexesForUrl.uniqueKeys()) {
+ foreach (const QUrl& url, indexesForUrl.uniqueKeys()) {
if (indexesForUrl.count(url) > 1) {
- kWarning() << "Multiple items found with the URL" << url;
+ qCWarning(DolphinDebug) << "Multiple items found with the URL" << url;
foreach (int index, indexesForUrl.values(url)) {
const ItemData* data = m_itemData.at(index);
- kWarning() << "index" << index << ":" << data->item;
+ qCWarning(DolphinDebug) << "index" << index << ":" << data->item;
if (data->parent) {
- kWarning() << "parent" << data->parent->item;
+ qCWarning(DolphinDebug) << "parent" << data->parent->item;
}
}
}
@@ -510,15 +512,15 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
}
const KFileItem item = m_itemData.at(index)->item;
- const KUrl url = item.url();
- const KUrl targetUrl = item.targetUrl();
+ const QUrl url = item.url();
+ const QUrl targetUrl = item.targetUrl();
if (expanded) {
m_expandedDirs.insert(targetUrl, url);
m_dirLister->openUrl(url, KDirLister::Keep);
- const KUrl::List previouslyExpandedChildren = m_itemData.at(index)->values.value("previouslyExpandedChildren").value<KUrl::List>();
- foreach (const KUrl& url, previouslyExpandedChildren) {
- m_urlsToExpand.insert(url);
+ const QVariantList previouslyExpandedChildren = m_itemData.at(index)->values.value("previouslyExpandedChildren").value<QVariantList>();
+ foreach (const QVariant& var, previouslyExpandedChildren) {
+ m_urlsToExpand.insert(var.toUrl());
}
} else {
// Note that there might be (indirect) children of the folder which is to be collapsed in
@@ -540,14 +542,14 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
const int itemCount = m_itemData.count();
const int firstChildIndex = index + 1;
- KUrl::List expandedChildren;
+ QVariantList expandedChildren;
int childIndex = firstChildIndex;
while (childIndex < itemCount && expandedParentsCount(childIndex) > parentLevel) {
ItemData* itemData = m_itemData.at(childIndex);
if (itemData->values.value("isExpanded").toBool()) {
- const KUrl targetUrl = itemData->item.targetUrl();
- const KUrl url = itemData->item.url();
+ const QUrl targetUrl = itemData->item.targetUrl();
+ const QUrl url = itemData->item.url();
m_expandedDirs.remove(targetUrl);
m_dirLister->stop(url); // TODO: try to unit-test this, see https://bugs.kde.org/show_bug.cgi?id=332102#c11
expandedChildren.append(targetUrl);
@@ -591,17 +593,17 @@ int KFileItemModel::expandedParentsCount(int index) const
return 0;
}
-QSet<KUrl> KFileItemModel::expandedDirectories() const
+QSet<QUrl> KFileItemModel::expandedDirectories() const
{
return m_expandedDirs.values().toSet();
}
-void KFileItemModel::restoreExpandedDirectories(const QSet<KUrl>& urls)
+void KFileItemModel::restoreExpandedDirectories(const QSet<QUrl> &urls)
{
m_urlsToExpand = urls;
}
-void KFileItemModel::expandParentDirectories(const KUrl& url)
+void KFileItemModel::expandParentDirectories(const QUrl &url)
{
const int pos = m_dirLister->url().path().length();
@@ -609,17 +611,17 @@ void KFileItemModel::expandParentDirectories(const KUrl& url)
// expanded is added to m_urlsToExpand. KDirLister
// does not care whether the parent-URL has already been
// expanded.
- KUrl urlToExpand = m_dirLister->url();
+ QUrl urlToExpand = m_dirLister->url();
const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
for (int i = 0; i < subDirs.count() - 1; ++i) {
- urlToExpand.addPath(subDirs.at(i));
+ urlToExpand.setPath(urlToExpand.path() + '/' + subDirs.at(i));
m_urlsToExpand.insert(urlToExpand);
}
// KDirLister::open() must called at least once to trigger an initial
// loading. The pending URLs that must be restored are handled
// in slotCompleted().
- QSetIterator<KUrl> it2(m_urlsToExpand);
+ QSetIterator<QUrl> it2(m_urlsToExpand);
while (it2.hasNext()) {
const int idx = index(it2.next());
if (idx >= 0 && !isExpanded(idx)) {
@@ -793,14 +795,14 @@ void KFileItemModel::resortAllItems()
#ifdef KFILEITEMMODEL_DEBUG
QElapsedTimer timer;
timer.start();
- kDebug() << "===========================================================";
- kDebug() << "Resorting" << itemCount << "items";
+ qCDebug(DolphinDebug) << "===========================================================";
+ qCDebug(DolphinDebug) << "Resorting" << itemCount << "items";
#endif
// Remember the order of the current URLs so
// that it can be determined which indexes have
// been moved because of the resorting.
- QList<KUrl> oldUrls;
+ QList<QUrl> oldUrls;
oldUrls.reserve(itemCount);
foreach (const ItemData* itemData, m_itemData) {
oldUrls.append(itemData->item.url());
@@ -856,7 +858,7 @@ void KFileItemModel::resortAllItems()
}
#ifdef KFILEITEMMODEL_DEBUG
- kDebug() << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed();
+ qCDebug(DolphinDebug) << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed();
#endif
}
@@ -869,7 +871,7 @@ void KFileItemModel::slotCompleted()
// Note that the parent folder must be expanded before any of its subfolders become visible.
// Therefore, some URLs in m_restoredExpandedUrls might not be visible yet
// -> we expand the first visible URL we find in m_restoredExpandedUrls.
- foreach (const KUrl& url, m_urlsToExpand) {
+ foreach (const QUrl& url, m_urlsToExpand) {
const int indexForUrl = index(url);
if (indexForUrl >= 0) {
m_urlsToExpand.remove(url);
@@ -897,16 +899,15 @@ void KFileItemModel::slotCanceled()
emit directoryLoadingCanceled();
}
-void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items)
+void KFileItemModel::slotItemsAdded(const QUrl &directoryUrl, const KFileItemList& items)
{
Q_ASSERT(!items.isEmpty());
- KUrl parentUrl;
+ QUrl parentUrl;
if (m_expandedDirs.contains(directoryUrl)) {
parentUrl = m_expandedDirs.value(directoryUrl);
} else {
- parentUrl = directoryUrl;
- parentUrl.adjustPath(KUrl::RemoveTrailingSlash);
+ parentUrl = directoryUrl.adjusted(QUrl::StripTrailingSlash);
}
if (m_requestRole[ExpandedParentsCountRole]) {
@@ -1012,7 +1013,7 @@ void KFileItemModel::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&
{
Q_ASSERT(!items.isEmpty());
#ifdef KFILEITEMMODEL_DEBUG
- kDebug() << "Refreshing" << items.count() << "items";
+ qCDebug(DolphinDebug) << "Refreshing" << items.count() << "items";
#endif
// Get the indexes of all items that have been refreshed
@@ -1078,7 +1079,7 @@ void KFileItemModel::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&
void KFileItemModel::slotClear()
{
#ifdef KFILEITEMMODEL_DEBUG
- kDebug() << "Clearing all items";
+ qCDebug(DolphinDebug) << "Clearing all items";
#endif
qDeleteAll(m_filteredItems.values());
@@ -1104,7 +1105,7 @@ void KFileItemModel::slotClear()
void KFileItemModel::slotNaturalSortingChanged()
{
- m_naturalSorting = KGlobalSettings::naturalSorting();
+ m_naturalSorting = GeneralSettings::naturalSorting();
resortAllItems();
}
@@ -1125,8 +1126,8 @@ void KFileItemModel::insertItems(QList<ItemData*>& newItems)
#ifdef KFILEITEMMODEL_DEBUG
QElapsedTimer timer;
timer.start();
- kDebug() << "===========================================================";
- kDebug() << "Inserting" << newItems.count() << "items";
+ qCDebug(DolphinDebug) << "===========================================================";
+ qCDebug(DolphinDebug) << "Inserting" << newItems.count() << "items";
#endif
m_groups.clear();
@@ -1143,7 +1144,7 @@ void KFileItemModel::insertItems(QList<ItemData*>& newItems)
sort(newItems.begin(), newItems.end());
#ifdef KFILEITEMMODEL_DEBUG
- kDebug() << "[TIME] Sorting:" << timer.elapsed();
+ qCDebug(DolphinDebug) << "[TIME] Sorting:" << timer.elapsed();
#endif
KItemRangeList itemRanges;
@@ -1172,7 +1173,7 @@ void KFileItemModel::insertItems(QList<ItemData*>& newItems)
while (sourceIndexNewItems >= 0) {
ItemData* newItem = newItems.at(sourceIndexNewItems);
- if (sourceIndexExistingItems >= 0 && lessThan(newItem, m_itemData.at(sourceIndexExistingItems))) {
+ if (sourceIndexExistingItems >= 0 && lessThan(newItem, m_itemData.at(sourceIndexExistingItems), m_collator)) {
// Move an existing item to its new position. If any new items
// are behind it, push the item range to itemRanges.
if (rangeCount > 0) {
@@ -1201,13 +1202,13 @@ void KFileItemModel::insertItems(QList<ItemData*>& newItems)
}
// The indexes in m_items are not correct anymore. Therefore, we clear m_items.
- // It will be re-populated with the updated indices if index(const KUrl&) is called.
+ // It will be re-populated with the updated indices if index(const QUrl&) is called.
m_items.clear();
emit itemsInserted(itemRanges);
#ifdef KFILEITEMMODEL_DEBUG
- kDebug() << "[TIME] Inserting of" << newItems.count() << "items:" << timer.elapsed();
+ qCDebug(DolphinDebug) << "[TIME] Inserting of" << newItems.count() << "items:" << timer.elapsed();
#endif
}
@@ -1254,13 +1255,13 @@ void KFileItemModel::removeItems(const KItemRangeList& itemRanges, RemoveItemsBe
m_itemData.erase(m_itemData.end() - removedItemsCount, m_itemData.end());
// The indexes in m_items are not correct anymore. Therefore, we clear m_items.
- // It will be re-populated with the updated indices if index(const KUrl&) is called.
+ // It will be re-populated with the updated indices if index(const QUrl&) is called.
m_items.clear();
emit itemsRemoved(itemRanges);
}
-QList<KFileItemModel::ItemData*> KFileItemModel::createItemDataList(const KUrl& parentUrl, const KFileItemList& items) const
+QList<KFileItemModel::ItemData*> KFileItemModel::createItemDataList(const QUrl& parentUrl, const KFileItemList& items) const
{
if (m_sortRole == TypeRole) {
// Try to resolve the MIME-types synchronously to prevent a reordering of
@@ -1388,14 +1389,14 @@ void KFileItemModel::emitItemsChangedAndTriggerResorting(const KItemRangeList& i
// (b) the successor of the last item is "lessThan" the last item, or
// (c) the internal order of the items in the range is incorrect.
if (first > 0
- && lessThan(m_itemData.at(first), m_itemData.at(first - 1))) {
+ && lessThan(m_itemData.at(first), m_itemData.at(first - 1), m_collator)) {
needsResorting = true;
} else if (last < count() - 1
- && lessThan(m_itemData.at(last + 1), m_itemData.at(last))) {
+ && lessThan(m_itemData.at(last + 1), m_itemData.at(last), m_collator)) {
needsResorting = true;
} else {
for (int index = first; index < last; ++index) {
- if (lessThan(m_itemData.at(index + 1), m_itemData.at(index))) {
+ if (lessThan(m_itemData.at(index + 1), m_itemData.at(index), m_collator)) {
needsResorting = true;
break;
}
@@ -1510,8 +1511,8 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
// Don't use KFileItem::timeString() as this is too expensive when
// having several thousands of items. Instead the formatting of the
// date-time will be done on-demand by the view when the date will be shown.
- const KDateTime dateTime = item.time(KFileItem::ModificationTime);
- data.insert(sharedValue("date"), dateTime.dateTime());
+ const QDateTime dateTime = item.time(KFileItem::ModificationTime);
+ data.insert(sharedValue("date"), dateTime);
}
if (m_requestRole[PermissionsRole]) {
@@ -1536,7 +1537,7 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
if (m_requestRole[PathRole]) {
QString path;
- if (item.url().protocol() == QLatin1String("trash")) {
+ if (item.url().scheme() == QLatin1String("trash")) {
path = item.entry().stringValue(KIO::UDSEntry::UDS_EXTRA);
} else {
// For performance reasons cache the home-path in a static QString
@@ -1582,7 +1583,7 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
return data;
}
-bool KFileItemModel::lessThan(const ItemData* a, const ItemData* b) const
+bool KFileItemModel::lessThan(const ItemData* a, const ItemData* b, const QCollator& collator) const
{
int result = 0;
@@ -1627,7 +1628,7 @@ bool KFileItemModel::lessThan(const ItemData* a, const ItemData* b) const
}
}
- result = sortRoleCompare(a, b);
+ result = sortRoleCompare(a, b, collator);
return (sortOrder() == Qt::AscendingOrder) ? result < 0 : result > 0;
}
@@ -1638,24 +1639,36 @@ bool KFileItemModel::lessThan(const ItemData* a, const ItemData* b) const
class KFileItemModelLessThan
{
public:
- KFileItemModelLessThan(const KFileItemModel* model) :
- m_model(model)
+ KFileItemModelLessThan(const KFileItemModel* model, const QCollator& collator) :
+ m_model(model),
+ m_collator(collator)
+ {
+ }
+
+ KFileItemModelLessThan(const KFileItemModelLessThan& other) :
+ m_model(other.m_model),
+ m_collator()
{
+ m_collator.setCaseSensitivity(other.m_collator.caseSensitivity());
+ m_collator.setIgnorePunctuation(other.m_collator.ignorePunctuation());
+ m_collator.setLocale(other.m_collator.locale());
+ m_collator.setNumericMode(other.m_collator.numericMode());
}
bool operator()(const KFileItemModel::ItemData* a, const KFileItemModel::ItemData* b) const
{
- return m_model->lessThan(a, b);
+ return m_model->lessThan(a, b, m_collator);
}
private:
const KFileItemModel* m_model;
+ QCollator m_collator;
};
void KFileItemModel::sort(QList<KFileItemModel::ItemData*>::iterator begin,
QList<KFileItemModel::ItemData*>::iterator end) const
{
- KFileItemModelLessThan lessThan(this);
+ KFileItemModelLessThan lessThan(this, m_collator);
if (m_sortRole == NameRole) {
// Sorting by name can be expensive, in particular if natural sorting is
@@ -1670,7 +1683,7 @@ void KFileItemModel::sort(QList<KFileItemModel::ItemData*>::iterator begin,
}
}
-int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
+int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const QCollator& collator) const
{
const KFileItem& itemA = a->item;
const KFileItem& itemB = b->item;
@@ -1715,8 +1728,8 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
}
case DateRole: {
- const KDateTime dateTimeA = itemA.time(KFileItem::ModificationTime);
- const KDateTime dateTimeB = itemB.time(KFileItem::ModificationTime);
+ const QDateTime dateTimeA = itemA.time(KFileItem::ModificationTime);
+ const QDateTime dateTimeB = itemB.time(KFileItem::ModificationTime);
if (dateTimeA < dateTimeB) {
result = -1;
} else if (dateTimeA > dateTimeB) {
@@ -1733,9 +1746,8 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
case ImageSizeRole: {
// Alway use a natural comparing to interpret the numbers of a string like
// "1600 x 1200" for having a correct sorting.
- result = KStringHandler::naturalCompare(a->values.value("imageSize").toString(),
- b->values.value("imageSize").toString(),
- Qt::CaseSensitive);
+ result = collator.compare(a->values.value("imageSize").toString(),
+ b->values.value("imageSize").toString());
break;
}
@@ -1754,14 +1766,13 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
}
// Fallback #1: Compare the text of the items
- result = stringCompare(itemA.text(), itemB.text());
+ result = stringCompare(itemA.text(), itemB.text(), collator);
if (result != 0) {
return result;
}
// Fallback #2: KFileItem::text() may not be unique in case UDS_DISPLAY_NAME is used
- result = stringCompare(itemA.name(m_caseSensitivity == Qt::CaseInsensitive),
- itemB.name(m_caseSensitivity == Qt::CaseInsensitive));
+ result = stringCompare(itemA.name(), itemB.name(), collator);
if (result != 0) {
return result;
}
@@ -1772,26 +1783,21 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const
return QString::compare(itemA.url().url(), itemB.url().url(), Qt::CaseSensitive);
}
-int KFileItemModel::stringCompare(const QString& a, const QString& b) const
+int KFileItemModel::stringCompare(const QString& a, const QString& b, const QCollator& collator) const
{
- // Taken from KDirSortFilterProxyModel (kdelibs/kfile/kdirsortfilterproxymodel.*)
- // Copyright (C) 2006 by Peter Penz <[email protected]>
- // Copyright (C) 2006 by Dominic Battre <[email protected]>
- // Copyright (C) 2006 by Martin Pool <[email protected]>
+ if (m_naturalSorting) {
+ return collator.compare(a, b);
+ }
- if (m_caseSensitivity == Qt::CaseInsensitive) {
- const int result = m_naturalSorting ? KStringHandler::naturalCompare(a, b, Qt::CaseInsensitive)
- : QString::compare(a, b, Qt::CaseInsensitive);
- if (result != 0) {
- // Only return the result, if the strings are not equal. If they are equal by a case insensitive
- // comparison, still a deterministic sort order is required. A case sensitive
- // comparison is done as fallback.
- return result;
- }
+ const int result = QString::compare(a, b, collator.caseSensitivity());
+ if (result != 0 || collator.caseSensitivity() == Qt::CaseSensitive) {
+ // Only return the result, if the strings are not equal. If they are equal by a case insensitive
+ // comparison, still a deterministic sort order is required. A case sensitive
+ // comparison is done as fallback.
+ return result;
}
- return m_naturalSorting ? KStringHandler::naturalCompare(a, b, Qt::CaseSensitive)
- : QString::compare(a, b, Qt::CaseSensitive);
+ return QString::compare(a, b, Qt::CaseSensitive);
}
bool KFileItemModel::useMaximumUpdateInterval() const
@@ -1799,11 +1805,6 @@ bool KFileItemModel::useMaximumUpdateInterval() const
return !m_dirLister->url().isLocalFile();
}
-static bool localeAwareLessThan(const QChar& c1, const QChar& c2)
-{
- return QString::localeAwareCompare(c1, c2) < 0;
-}
-
QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const
{
Q_ASSERT(!m_itemData.isEmpty());
@@ -1837,6 +1838,10 @@ QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const
}
}
+ auto localeAwareLessThan = [this](const QChar& c1, const QChar& c2) -> bool {
+ return m_collator.compare(c1, c2) < 0;
+ };
+
std::vector<QChar>::iterator it = std::lower_bound(lettersAtoZ.begin(), lettersAtoZ.end(), newFirstChar, localeAwareLessThan);
if (it != lettersAtoZ.end()) {
if (localeAwareLessThan(newFirstChar, *it) && it != lettersAtoZ.begin()) {
@@ -1908,7 +1913,7 @@ QList<QPair<int, QVariant> > KFileItemModel::dateRoleGroups() const
const int maxIndex = count() - 1;
QList<QPair<int, QVariant> > groups;
- const QDate currentDate = KDateTime::currentLocalDateTime().date();
+ const QDate currentDate = QDate::currentDate();
QDate previousModifiedDate;
QString groupValue;
@@ -1917,7 +1922,7 @@ QList<QPair<int, QVariant> > KFileItemModel::dateRoleGroups() const
continue;
}
- const KDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime);
+ const QDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime);
const QDate modifiedDate = modifiedTime.date();
if (modifiedDate == previousModifiedDate) {
// The current item is in the same group as the previous item
@@ -1934,7 +1939,7 @@ QList<QPair<int, QVariant> > KFileItemModel::dateRoleGroups() const
switch (daysDistance) {
case 0: newGroupValue = i18nc("@title:group Date", "Today"); break;
case 1: newGroupValue = i18nc("@title:group Date", "Yesterday"); break;
- default: newGroupValue = modifiedTime.toString(i18nc("@title:group The week day name: %A", "%A"));
+ default: newGroupValue = modifiedTime.toString(i18nc("@title:group The week day name: dddd", "dddd"));
}
break;
case 1:
@@ -1957,20 +1962,20 @@ QList<QPair<int, QVariant> > KFileItemModel::dateRoleGroups() const
const QDate lastMonthDate = currentDate.addMonths(-1);
if (lastMonthDate.year() == modifiedDate.year() && lastMonthDate.month() == modifiedDate.month()) {
if (daysDistance == 1) {
- newGroupValue = modifiedTime.toString(i18nc("@title:group Date: %B is full month name in current locale, and %Y is full year number", "Yesterday (%B, %Y)"));
+ newGroupValue = modifiedTime.toString(i18nc("@title:group Date: MMMM is full month name in current locale, and yyyy is full year number", "'Yesterday' (MMMM, yyyy)"));
} else if (daysDistance <= 7) {
- newGroupValue = modifiedTime.toString(i18nc("@title:group The week day name: %A, %B is full month name in current locale, and %Y is full year number", "%A (%B, %Y)"));
+ newGroupValue = modifiedTime.toString(i18nc("@title:group The week day name: dddd, MMMM is full month name in current locale, and yyyy is full year number", "dddd (MMMM, yyyy)"));
} else if (daysDistance <= 7 * 2) {
- newGroupValue = modifiedTime.toString(i18nc("@title:group Date: %B is full month name in current locale, and %Y is full year number", "One Week Ago (%B, %Y)"));
+ newGroupValue = modifiedTime.toString(i18nc("@title:group Date: MMMM is full month name in current locale, and yyyy is full year number", "'One Week Ago' (MMMM, yyyy)"));
} else if (daysDistance <= 7 * 3) {
- newGroupValue = modifiedTime.toString(i18nc("@title:group Date: %B is full month name in current locale, and %Y is full year number", "Two Weeks Ago (%B, %Y)"));
+ newGroupValue = modifiedTime.toString(i18nc("@title:group Date: MMMM is full month name in current locale, and yyyy is full year number", "'Two Weeks Ago' (MMMM, yyyy)"));
} else if (daysDistance <= 7 * 4) {
- newGroupValue = modifiedTime.toString(i18nc("@title:group Date: %B is full month name in current locale, and %Y is full year number", "Three Weeks Ago (%B, %Y)"));
+ newGroupValue = modifiedTime.toString(i18nc("@title:group Date: MMMM is full month name in current locale, and yyyy is full year number", "'Three Weeks Ago' (MMMM, yyyy)"));
} else {
- newGroupValue = modifiedTime.toString(i18nc("@title:group Date: %B is full month name in current locale, and %Y is full year number", "Earlier on %B, %Y"));
+ newGroupValue = modifiedTime.toString(i18nc("@title:group Date: MMMM is full month name in current locale, and yyyy is full year number", "'Earlier on' MMMM, yyyy"));
}
} else {
- newGroupValue = modifiedTime.toString(i18nc("@title:group The month and year: %B is full month name in current locale, and %Y is full year number", "%B, %Y"));
+ newGroupValue = modifiedTime.toString(i18nc("@title:group The month and year: MMMM is full month name in current locale, and yyyy is full year number", "MMMM, yyyy"));
}
}
@@ -2004,7 +2009,7 @@ QList<QPair<int, QVariant> > KFileItemModel::permissionRoleGroups() const
}
permissionsString = newPermissionsString;
- const QFileInfo info(itemData->item.url().pathOrUrl());
+ const QFileInfo info(itemData->item.url().toLocalFile());
// Set user string
QString user;
@@ -2199,7 +2204,7 @@ QByteArray KFileItemModel::sharedValue(const QByteArray& value)
bool KFileItemModel::isConsistent() const
{
// m_items may contain less items than m_itemData because m_items
- // is populated lazily, see KFileItemModel::index(const KUrl& url).
+ // is populated lazily, see KFileItemModel::index(const QUrl& url).
if (m_items.count() > m_itemData.count()) {
return false;
}
@@ -2208,19 +2213,19 @@ bool KFileItemModel::isConsistent() const
// Check if m_items and m_itemData are consistent.
const KFileItem item = fileItem(i);
if (item.isNull()) {
- qWarning() << "Item" << i << "is null";
+ qCWarning(DolphinDebug) << "Item" << i << "is null";
return false;
}
const int itemIndex = index(item);
if (itemIndex != i) {
- qWarning() << "Item" << i << "has a wrong index:" << itemIndex;
+ qCWarning(DolphinDebug) << "Item" << i << "has a wrong index:" << itemIndex;
return false;
}
// Check if the items are sorted correctly.
- if (i > 0 && !lessThan(m_itemData.at(i - 1), m_itemData.at(i))) {
- qWarning() << "The order of items" << i - 1 << "and" << i << "is wrong:"
+ if (i > 0 && !lessThan(m_itemData.at(i - 1), m_itemData.at(i), m_collator)) {
+ qCWarning(DolphinDebug) << "The order of items" << i - 1 << "and" << i << "is wrong:"
<< fileItem(i - 1) << fileItem(i);
return false;
}
@@ -2230,13 +2235,13 @@ bool KFileItemModel::isConsistent() const
const ItemData* parent = data->parent;
if (parent) {
if (expandedParentsCount(data) != expandedParentsCount(parent) + 1) {
- qWarning() << "expandedParentsCount is inconsistent for parent" << parent->item << "and child" << data->item;
+ qCWarning(DolphinDebug) << "expandedParentsCount is inconsistent for parent" << parent->item << "and child" << data->item;
return false;
}
const int parentIndex = index(parent->item);
if (parentIndex >= i) {
- qWarning() << "Index" << parentIndex << "of parent" << parent->item << "is not smaller than index" << i << "of child" << data->item;
+ qCWarning(DolphinDebug) << "Index" << parentIndex << "of parent" << parent->item << "is not smaller than index" << i << "of child" << data->item;
return false;
}
}
@@ -2245,4 +2250,3 @@ bool KFileItemModel::isConsistent() const
return true;
}
-#include "kfileitemmodel.moc"
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index 62a283d33..167f508cf 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -20,12 +20,13 @@
#ifndef KFILEITEMMODEL_H
#define KFILEITEMMODEL_H
-#include <libdolphin_export.h>
-#include <KFileItemList>
-#include <KUrl>
+#include "dolphin_export.h"
+#include <KFileItem>
+#include <QUrl>
#include <kitemviews/kitemmodelbase.h>
#include <kitemviews/private/kfileitemmodelfilter.h>
+#include <QCollator>
#include <QHash>
#include <QSet>
@@ -42,7 +43,7 @@ class QTimer;
* Recursive expansion of sub-directories is supported by
* KFileItemModel::setExpanded().
*/
-class LIBDOLPHINPRIVATE_EXPORT KFileItemModel : public KItemModelBase
+class DOLPHIN_EXPORT KFileItemModel : public KItemModelBase
{
Q_OBJECT
@@ -56,13 +57,13 @@ public:
* indicate the current state of the loading process. The items
* of the directory are added after the loading has been completed.
*/
- void loadDirectory(const KUrl& url);
+ void loadDirectory(const QUrl& url);
/**
* Throws away all currently loaded items and refreshes the directory
* by reloading all items again.
*/
- void refreshDirectory(const KUrl& url);
+ void refreshDirectory(const QUrl& url);
/**
* @return Parent directory of the items that are shown. In case
@@ -70,7 +71,7 @@ public:
* the root-parent of all items.
* @see rootItem()
*/
- KUrl directory() const;
+ QUrl directory() const;
/**
* Cancels the loading of a directory which has been started by either
@@ -78,9 +79,9 @@ public:
*/
void cancelDirectoryLoading();
- virtual int count() const;
- virtual QHash<QByteArray, QVariant> data(int index) const;
- virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
+ virtual int count() const Q_DECL_OVERRIDE;
+ virtual QHash<QByteArray, QVariant> data(int index) const Q_DECL_OVERRIDE;
+ virtual bool setData(int index, const QHash<QByteArray, QVariant>& values) Q_DECL_OVERRIDE;
/**
* Sets a separate sorting with directories first (true) or a mixed
@@ -99,20 +100,15 @@ public:
void setShowDirectoriesOnly(bool enabled);
bool showDirectoriesOnly() const;
- /** @reimp */
- virtual QMimeData* createMimeData(const KItemSet& indexes) const;
+ virtual QMimeData* createMimeData(const KItemSet& indexes) const Q_DECL_OVERRIDE;
- /** @reimp */
- virtual int indexForKeyboardSearch(const QString& text, int startFromIndex = 0) const;
+ virtual int indexForKeyboardSearch(const QString& text, int startFromIndex = 0) const Q_DECL_OVERRIDE;
- /** @reimp */
- virtual bool supportsDropping(int index) const;
+ virtual bool supportsDropping(int index) const Q_DECL_OVERRIDE;
- /** @reimp */
- virtual QString roleDescription(const QByteArray& role) const;
+ virtual QString roleDescription(const QByteArray& role) const Q_DECL_OVERRIDE;
- /** @reimp */
- virtual QList<QPair<int, QVariant> > groups() const;
+ virtual QList<QPair<int, QVariant> > groups() const Q_DECL_OVERRIDE;
/**
* @return The file-item for the index \a index. If the index is in a valid
@@ -126,7 +122,7 @@ public:
* URL is found KFileItem::isNull() will be true for the returned
* file-item. The runtime complexity of this call is O(1).
*/
- KFileItem fileItem(const KUrl& url) const;
+ KFileItem fileItem(const QUrl& url) const;
/**
* @return The index for the file-item \a item. -1 is returned if no file-item
@@ -139,7 +135,7 @@ public:
* @return The index for the URL \a url. -1 is returned if no file-item
* is found. The amortized runtime complexity of this call is O(1).
*/
- int index(const KUrl& url) const;
+ int index(const QUrl &url) const;
/**
* @return Root item of all items representing the item
@@ -158,24 +154,24 @@ public:
void setRoles(const QSet<QByteArray>& roles);
QSet<QByteArray> roles() const;
- virtual bool setExpanded(int index, bool expanded);
- virtual bool isExpanded(int index) const;
- virtual bool isExpandable(int index) const;
- virtual int expandedParentsCount(int index) const;
+ virtual bool setExpanded(int index, bool expanded) Q_DECL_OVERRIDE;
+ virtual bool isExpanded(int index) const Q_DECL_OVERRIDE;
+ virtual bool isExpandable(int index) const Q_DECL_OVERRIDE;
+ virtual int expandedParentsCount(int index) const Q_DECL_OVERRIDE;
- QSet<KUrl> expandedDirectories() const;
+ QSet<QUrl> expandedDirectories() const;
/**
* Marks the URLs in \a urls as sub-directories which were expanded previously.
* After calling loadDirectory() or refreshDirectory() the marked sub-directories
* will be expanded step-by-step.
*/
- void restoreExpandedDirectories(const QSet<KUrl>& urls);
+ void restoreExpandedDirectories(const QSet<QUrl>& urls);
/**
* Expands all parent-directories of the item \a url.
*/
- void expandParentDirectories(const KUrl& url);
+ void expandParentDirectories(const QUrl& url);
void setNameFilter(const QString& nameFilter);
QString nameFilter() const;
@@ -251,18 +247,18 @@ signals:
* Is emitted if a redirection from the current URL \a oldUrl
* to the new URL \a newUrl has been done.
*/
- void directoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void directoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Is emitted when the URL passed by KFileItemModel::setUrl() represents a file.
* In this case no signal errorMessage() will be emitted.
*/
- void urlIsFileError(const KUrl& url);
+ void urlIsFileError(const QUrl& url);
protected:
- virtual void onGroupedSortingChanged(bool current);
- virtual void onSortRoleChanged(const QByteArray& current, const QByteArray& previous);
- virtual void onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous);
+ virtual void onGroupedSortingChanged(bool current) Q_DECL_OVERRIDE;
+ virtual void onSortRoleChanged(const QByteArray& current, const QByteArray& previous) Q_DECL_OVERRIDE;
+ virtual void onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous) Q_DECL_OVERRIDE;
private slots:
/**
@@ -273,7 +269,7 @@ private slots:
void slotCompleted();
void slotCanceled();
- void slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items);
+ void slotItemsAdded(const QUrl& directoryUrl, const KFileItemList& items);
void slotItemsDeleted(const KFileItemList& items);
void slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >& items);
void slotClear();
@@ -317,7 +313,7 @@ private:
* Note that the ItemData instances are created dynamically and
* must be deleted by the caller.
*/
- QList<ItemData*> createItemDataList(const KUrl& parentUrl, const KFileItemList& items) const;
+ QList<ItemData*> createItemDataList(const QUrl& parentUrl, const KFileItemList& items) const;
/**
* Prepares the items for sorting. Normally, the hash 'values' in ItemData is filled
@@ -366,7 +362,7 @@ private:
* @return True if the item-data \a a should be ordered before the item-data
* \b. The item-data may have different parent-items.
*/
- bool lessThan(const ItemData* a, const ItemData* b) const;
+ bool lessThan(const ItemData* a, const ItemData* b, const QCollator& collator) const;
/**
* Sorts the items between \a begin and \a end using the comparison
@@ -379,9 +375,9 @@ private:
* the passed item-data using m_sortRole as criteria. Both items must
* have the same parent item, otherwise the comparison will be wrong.
*/
- int sortRoleCompare(const ItemData* a, const ItemData* b) const;
+ int sortRoleCompare(const ItemData* a, const ItemData* b, const QCollator& collator) const;
- int stringCompare(const QString& a, const QString& b) const;
+ int stringCompare(const QString& a, const QString& b, const QCollator& collator) const;
bool useMaximumUpdateInterval() const;
@@ -460,21 +456,21 @@ private:
private:
KFileItemModelDirLister* m_dirLister;
+ QCollator m_collator;
bool m_naturalSorting;
bool m_sortDirsFirst;
RoleType m_sortRole;
int m_sortingProgressPercent; // Value of directorySortingProgress() signal
QSet<QByteArray> m_roles;
- Qt::CaseSensitivity m_caseSensitivity;
QList<ItemData*> m_itemData;
- // m_items is a cache for the method index(const KUrl&). If it contains N
+ // m_items is a cache for the method index(const QUrl&). If it contains N
// entries, it is guaranteed that these correspond to the first N items in
// the model, i.e., that (for every i between 0 and N - 1)
// m_items.value(fileItem(i).url()) == i
- mutable QHash<KUrl, int> m_items;
+ mutable QHash<QUrl, int> m_items;
KFileItemModelFilter m_filter;
QHash<KFileItem, ItemData*> m_filteredItems; // Items that got hidden by KFileItemModel::setNameFilter()
@@ -489,11 +485,11 @@ private:
mutable QList<QPair<int, QVariant> > m_groups;
// Stores the URLs (key: target url, value: url) of the expanded directories.
- QHash<KUrl, KUrl> m_expandedDirs;
+ QHash<QUrl, QUrl> m_expandedDirs;
// URLs that must be expanded. The expanding is initially triggered in setExpanded()
// and done step after step in slotCompleted().
- QSet<KUrl> m_urlsToExpand;
+ QSet<QUrl> m_urlsToExpand;
friend class KFileItemModelLessThan; // Accesses lessThan() method
friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp
index 0865d40e7..c18d65892 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.cpp
+++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -23,9 +23,10 @@
#include <KConfig>
#include <KConfigGroup>
-#include <KDebug>
+#include <KSharedConfig>
#include <KFileItem>
-#include <KGlobal>
+#include <KIconLoader>
+#include <KJobWidgets>
#include <KIO/JobUiDelegate>
#include <KIO/PreviewJob>
@@ -42,9 +43,8 @@
#ifdef HAVE_BALOO
#include "private/kbaloorolesprovider.h"
- #include <baloo/file.h>
- #include <baloo/filefetchjob.h>
- #include <baloo/filemonitor.h>
+ #include <Baloo/File>
+ #include <Baloo/FileMonitor>
#endif
// #define KFILEITEMMODELROLESUPDATER_DEBUG
@@ -95,29 +95,29 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
{
Q_ASSERT(model);
- const KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings");
+ const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList()
<< "directorythumbnail"
<< "imagethumbnail"
<< "jpegthumbnail");
- connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(slotItemsInserted(KItemRangeList)));
- connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved(KItemRangeList)));
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
- connect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
- connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
+ connect(m_model, &KFileItemModel::itemsInserted,
+ this, &KFileItemModelRolesUpdater::slotItemsInserted);
+ connect(m_model, &KFileItemModel::itemsRemoved,
+ this, &KFileItemModelRolesUpdater::slotItemsRemoved);
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
+ connect(m_model, &KFileItemModel::itemsMoved,
+ this, &KFileItemModelRolesUpdater::slotItemsMoved);
+ connect(m_model, &KFileItemModel::sortRoleChanged,
+ this, &KFileItemModelRolesUpdater::slotSortRoleChanged);
// Use a timer to prevent that each call of slotItemsChanged() results in a synchronous
// resolving of the roles. Postpone the resolving until no update has been done for 1 second.
m_recentlyChangedItemsTimer = new QTimer(this);
m_recentlyChangedItemsTimer->setInterval(1000);
m_recentlyChangedItemsTimer->setSingleShot(true);
- connect(m_recentlyChangedItemsTimer, SIGNAL(timeout()), this, SLOT(resolveRecentlyChangedItems()));
+ connect(m_recentlyChangedItemsTimer, &QTimer::timeout, this, &KFileItemModelRolesUpdater::resolveRecentlyChangedItems);
m_resolvableRoles.insert("size");
m_resolvableRoles.insert("type");
@@ -127,8 +127,8 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
#endif
m_directoryContentsCounter = new KDirectoryContentsCounter(m_model, this);
- connect(m_directoryContentsCounter, SIGNAL(result(QString,int)),
- this, SLOT(slotDirectoryContentsCountReceived(QString,int)));
+ connect(m_directoryContentsCounter, &KDirectoryContentsCounter::result,
+ this, &KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived);
}
KFileItemModelRolesUpdater::~KFileItemModelRolesUpdater()
@@ -280,8 +280,8 @@ void KFileItemModelRolesUpdater::setRoles(const QSet<QByteArray>& roles)
if (hasBalooRole && !m_balooFileMonitor) {
m_balooFileMonitor = new Baloo::FileMonitor(this);
- connect(m_balooFileMonitor, SIGNAL(fileMetaDataChanged(QString)),
- this, SLOT(applyChangedBalooRoles(QString)));
+ connect(m_balooFileMonitor, &Baloo::FileMonitor::fileMetaDataChanged,
+ this, &KFileItemModelRolesUpdater::applyChangedBalooRoles);
} else if (!hasBalooRole && m_balooFileMonitor) {
delete m_balooFileMonitor;
m_balooFileMonitor = 0;
@@ -543,11 +543,11 @@ void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPi
data.insert("iconPixmap", scaledPixmap);
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_finishedItems.insert(item);
}
@@ -565,11 +565,11 @@ void KFileItemModelRolesUpdater::slotPreviewFailed(const KFileItem& item)
QHash<QByteArray, QVariant> data;
data.insert("iconPixmap", QPixmap());
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
applyResolvedRoles(index, ResolveAll);
m_finishedItems.insert(item);
@@ -625,11 +625,11 @@ void KFileItemModelRolesUpdater::resolveNextSortRole()
m_state = Idle;
// Prevent that we try to update the items twice.
- disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
+ disconnect(m_model, &KFileItemModel::itemsMoved,
+ this, &KFileItemModelRolesUpdater::slotItemsMoved);
applySortProgressToModel();
- connect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
+ connect(m_model, &KFileItemModel::itemsMoved,
+ this, &KFileItemModelRolesUpdater::slotItemsMoved);
startUpdating();
}
}
@@ -665,15 +665,15 @@ void KFileItemModelRolesUpdater::resolveNextPendingRoles()
QHash<QByteArray, QVariant> data;
data.insert("iconPixmap", QPixmap());
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
for (int index = 0; index <= m_model->count(); ++index) {
if (m_model->data(index).contains("iconPixmap")) {
m_model->setData(index, data);
}
}
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
}
m_clearPreviews = false;
@@ -703,21 +703,8 @@ void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& itemUrl)
return;
}
- Baloo::FileFetchJob* job = new Baloo::FileFetchJob(item.localPath());
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(applyChangedBalooRolesJobFinished(KJob*)));
- job->setProperty("item", QVariant::fromValue(item));
- job->start();
-#else
-#ifndef Q_CC_MSVC
- Q_UNUSED(itemUrl);
-#endif
-#endif
-}
-
-void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob)
-{
-#ifdef HAVE_BALOO
- const KFileItem item = kjob->property("item").value<KFileItem>();
+ Baloo::File file(item.localPath());
+ file.load();
const KBalooRolesProvider& rolesProvider = KBalooRolesProvider::instance();
QHash<QByteArray, QVariant> data;
@@ -729,19 +716,22 @@ void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob)
data.insert(role, QVariant());
}
- Baloo::FileFetchJob* job = static_cast<Baloo::FileFetchJob*>(kjob);
- QHashIterator<QByteArray, QVariant> it(rolesProvider.roleValues(job->file(), m_roles));
+ QHashIterator<QByteArray, QVariant> it(rolesProvider.roleValues(file, m_roles));
while (it.hasNext()) {
it.next();
data.insert(it.key(), it.value());
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
const int index = m_model->index(item);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
+#else
+#ifndef Q_CC_MSVC
+ Q_UNUSED(itemUrl);
+#endif
#endif
}
@@ -751,7 +741,7 @@ void KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived(const QStrin
const bool getIsExpandableRole = m_roles.contains("isExpandable");
if (getSizeRole || getIsExpandableRole) {
- const int index = m_model->index(KUrl(path));
+ const int index = m_model->index(QUrl::fromLocalFile(path));
if (index >= 0) {
QHash<QByteArray, QVariant> data;
@@ -762,11 +752,11 @@ void KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived(const QStrin
data.insert("isExpandable", count > 0);
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
}
}
}
@@ -897,15 +887,15 @@ void KFileItemModelRolesUpdater::startPreviewJob()
job->setIgnoreMaximumSize(itemSubSet.first().isLocalFile());
if (job->ui()) {
- job->ui()->setWindow(qApp->activeWindow());
+ KJobWidgets::setWindow(job, qApp->activeWindow());
}
- connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)),
- this, SLOT(slotGotPreview(KFileItem,QPixmap)));
- connect(job, SIGNAL(failed(KFileItem)),
- this, SLOT(slotPreviewFailed(KFileItem)));
- connect(job, SIGNAL(finished(KJob*)),
- this, SLOT(slotPreviewJobFinished()));
+ connect(job, &KIO::PreviewJob::gotPreview,
+ this, &KFileItemModelRolesUpdater::slotGotPreview);
+ connect(job, &KIO::PreviewJob::failed,
+ this, &KFileItemModelRolesUpdater::slotPreviewFailed);
+ connect(job, &KIO::PreviewJob::finished,
+ this, &KFileItemModelRolesUpdater::slotPreviewJobFinished);
m_previewJob = job;
}
@@ -998,11 +988,11 @@ void KFileItemModelRolesUpdater::applySortRole(int index)
data = rolesData(item);
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
}
void KFileItemModelRolesUpdater::applySortProgressToModel()
@@ -1042,11 +1032,11 @@ bool KFileItemModelRolesUpdater::applyResolvedRoles(int index, ResolveHint hint)
data.insert("iconPixmap", QPixmap());
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
return true;
}
@@ -1099,12 +1089,12 @@ void KFileItemModelRolesUpdater::updateAllPreviews()
void KFileItemModelRolesUpdater::killPreviewJob()
{
if (m_previewJob) {
- disconnect(m_previewJob, SIGNAL(gotPreview(KFileItem,QPixmap)),
- this, SLOT(slotGotPreview(KFileItem,QPixmap)));
- disconnect(m_previewJob, SIGNAL(failed(KFileItem)),
- this, SLOT(slotPreviewFailed(KFileItem)));
- disconnect(m_previewJob, SIGNAL(finished(KJob*)),
- this, SLOT(slotPreviewJobFinished()));
+ disconnect(m_previewJob, &KIO::PreviewJob::gotPreview,
+ this, &KFileItemModelRolesUpdater::slotGotPreview);
+ disconnect(m_previewJob, &KIO::PreviewJob::failed,
+ this, &KFileItemModelRolesUpdater::slotPreviewFailed);
+ disconnect(m_previewJob, &KIO::PreviewJob::finished,
+ this, &KFileItemModelRolesUpdater::slotPreviewJobFinished);
m_previewJob->kill();
m_previewJob = 0;
m_pendingPreviewItems.clear();
@@ -1168,4 +1158,3 @@ QList<int> KFileItemModelRolesUpdater::indexesToResolve() const
return result;
}
-#include "kfileitemmodelrolesupdater.moc"
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h
index a9e979ae1..216b0a501 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.h
+++ b/src/kitemviews/kfileitemmodelrolesupdater.h
@@ -25,7 +25,7 @@
#include <KFileItem>
#include <kitemviews/kitemmodelbase.h>
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QObject>
#include <QSet>
@@ -34,10 +34,13 @@
class KDirectoryContentsCounter;
class KFileItemModel;
-class KJob;
class QPixmap;
class QTimer;
+namespace KIO {
+ class PreviewJob;
+}
+
#ifdef HAVE_BALOO
namespace Baloo
{
@@ -84,7 +87,7 @@ class QTimer;
* 3. Finally, the entire process is repeated for any items that might have
* changed in the mean time.
*/
-class LIBDOLPHINPRIVATE_EXPORT KFileItemModelRolesUpdater : public QObject
+class DOLPHIN_EXPORT KFileItemModelRolesUpdater : public QObject
{
Q_OBJECT
@@ -201,7 +204,6 @@ private slots:
void resolveRecentlyChangedItems();
void applyChangedBalooRoles(const QString& file);
- void applyChangedBalooRolesJobFinished(KJob* job);
void slotDirectoryContentsCountReceived(const QString& path, int count);
@@ -316,7 +318,7 @@ private:
// A new preview job will be started from them once the first one finishes.
KFileItemList m_pendingPreviewItems;
- KJob* m_previewJob;
+ KIO::PreviewJob* m_previewJob;
// When downloading or copying large files, the slot slotItemsChanged()
// will be called periodically within a quite short delay. To prevent
diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp
index 8498286c9..f5c785a3e 100644
--- a/src/kitemviews/kitemlistcontainer.cpp
+++ b/src/kitemviews/kitemlistcontainer.cpp
@@ -31,12 +31,10 @@
#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
-#include <QPropertyAnimation>
#include <QScrollBar>
#include <QStyle>
#include <QStyleOption>
-#include <KDebug>
/**
* Replaces the default viewport of KItemListContainer by a
@@ -89,10 +87,10 @@ KItemListContainer::KItemListContainer(KItemListController* controller, QWidget*
slotViewChanged(controller->view(), 0);
}
- connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)),
- this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
- connect(controller, SIGNAL(viewChanged(KItemListView*,KItemListView*)),
- this, SLOT(slotViewChanged(KItemListView*,KItemListView*)));
+ connect(controller, &KItemListController::modelChanged,
+ this, &KItemListContainer::slotModelChanged);
+ connect(controller, &KItemListController::viewChanged,
+ this, &KItemListContainer::slotViewChanged);
}
KItemListContainer::~KItemListContainer()
@@ -185,11 +183,15 @@ void KItemListContainer::wheelEvent(QWheelEvent* event)
KItemListSmoothScroller* smoothScroller = scrollHorizontally ?
m_horizontalSmoothScroller : m_verticalSmoothScroller;
- const int numDegrees = event->delta() / 8;
- const int numSteps = numDegrees / 15;
-
const QScrollBar* scrollBar = smoothScroller->scrollBar();
- smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
+ if (!event->pixelDelta().isNull()) {
+ const int numPixels = event->pixelDelta().y();
+ smoothScroller->scrollTo(scrollBar->value() - numPixels);
+ } else {
+ const int numDegrees = event->angleDelta().y() / 8;
+ const int numSteps = numDegrees / 15;
+ smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
+ }
event->accept();
}
@@ -211,23 +213,33 @@ void KItemListContainer::slotViewChanged(KItemListView* current, KItemListView*
QGraphicsScene* scene = static_cast<QGraphicsView*>(viewport())->scene();
if (previous) {
scene->removeItem(previous);
- disconnect(previous, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation)));
- disconnect(previous, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- disconnect(previous, SIGNAL(maximumScrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- disconnect(previous, SIGNAL(itemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- disconnect(previous, SIGNAL(maximumItemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- disconnect(previous, SIGNAL(scrollTo(qreal)), this, SLOT(scrollTo(qreal)));
+ disconnect(previous, &KItemListView::scrollOrientationChanged,
+ this, &KItemListContainer::slotScrollOrientationChanged);
+ disconnect(previous, &KItemListView::scrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ disconnect(previous, &KItemListView::maximumScrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ disconnect(previous, &KItemListView::itemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ disconnect(previous, &KItemListView::maximumItemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ disconnect(previous, &KItemListView::scrollTo, this, &KItemListContainer::scrollTo);
m_horizontalSmoothScroller->setTargetObject(0);
m_verticalSmoothScroller->setTargetObject(0);
}
if (current) {
scene->addItem(current);
- connect(current, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation)));
- connect(current, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- connect(current, SIGNAL(maximumScrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- connect(current, SIGNAL(itemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- connect(current, SIGNAL(maximumItemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- connect(current, SIGNAL(scrollTo(qreal)), this, SLOT(scrollTo(qreal)));
+ connect(current, &KItemListView::scrollOrientationChanged,
+ this, &KItemListContainer::slotScrollOrientationChanged);
+ connect(current, &KItemListView::scrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ connect(current, &KItemListView::maximumScrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ connect(current, &KItemListView::itemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ connect(current, &KItemListView::maximumItemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ connect(current, &KItemListView::scrollTo, this, &KItemListContainer::scrollTo);
m_horizontalSmoothScroller->setTargetObject(current);
m_verticalSmoothScroller->setTargetObject(current);
updateSmoothScrollers(current->scrollOrientation());
@@ -403,4 +415,3 @@ void KItemListContainer::updateScrollOffsetScrollBarPolicy()
}
}
-#include "kitemlistcontainer.moc"
diff --git a/src/kitemviews/kitemlistcontainer.h b/src/kitemviews/kitemlistcontainer.h
index 474a9ecc0..9fc3d4957 100644
--- a/src/kitemviews/kitemlistcontainer.h
+++ b/src/kitemviews/kitemlistcontainer.h
@@ -23,16 +23,14 @@
#ifndef KITEMLISTCONTAINER_H
#define KITEMLISTCONTAINER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
-#include <QAbstractAnimation>
#include <QAbstractScrollArea>
class KItemListController;
class KItemListSmoothScroller;
class KItemListView;
class KItemModelBase;
-class QPropertyAnimation;
/**
* @brief Provides a QWidget based scrolling view for a KItemListController.
@@ -41,7 +39,7 @@ class QPropertyAnimation;
*
* @see KItemListController
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListContainer : public QAbstractScrollArea
+class DOLPHIN_EXPORT KItemListContainer : public QAbstractScrollArea
{
Q_OBJECT
@@ -60,11 +58,11 @@ public:
bool enabledFrame() const;
protected:
- virtual void keyPressEvent(QKeyEvent* event);
- virtual void showEvent(QShowEvent* event);
- virtual void resizeEvent(QResizeEvent* event);
- virtual void scrollContentsBy(int dx, int dy);
- virtual void wheelEvent(QWheelEvent* event);
+ virtual void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
+ virtual void showEvent(QShowEvent* event) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
+ virtual void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ virtual void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
private slots:
void slotScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous);
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
index 8e2ef5ef3..a9ebf97af 100644
--- a/src/kitemviews/kitemlistcontroller.cpp
+++ b/src/kitemviews/kitemlistcontroller.cpp
@@ -23,8 +23,6 @@
#include "kitemlistcontroller.h"
-#include <KGlobalSettings>
-#include <KDebug>
#include "kitemlistview.h"
#include "kitemlistselectionmanager.h"
@@ -61,15 +59,15 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v
m_keyboardAnchorIndex(-1),
m_keyboardAnchorPos(0)
{
- connect(m_keyboardManager, SIGNAL(changeCurrentItem(QString,bool)),
- this, SLOT(slotChangeCurrentItem(QString,bool)));
- connect(m_selectionManager, SIGNAL(currentChanged(int,int)),
- m_keyboardManager, SLOT(slotCurrentChanged(int,int)));
+ connect(m_keyboardManager, &KItemListKeyboardSearchManager::changeCurrentItem,
+ this, &KItemListController::slotChangeCurrentItem);
+ connect(m_selectionManager, &KItemListSelectionManager::currentChanged,
+ m_keyboardManager, &KItemListKeyboardSearchManager::slotCurrentChanged);
m_autoActivationTimer = new QTimer(this);
m_autoActivationTimer->setSingleShot(true);
m_autoActivationTimer->setInterval(-1);
- connect(m_autoActivationTimer, SIGNAL(timeout()), this, SLOT(slotAutoActivationTimeout()));
+ connect(m_autoActivationTimer, &QTimer::timeout, this, &KItemListController::slotAutoActivationTimeout);
setModel(model);
setView(view);
@@ -127,7 +125,7 @@ void KItemListController::setView(KItemListView* view)
KItemListView* oldView = m_view;
if (oldView) {
- disconnect(oldView, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal)));
+ disconnect(oldView, &KItemListView::scrollOffsetChanged, this, &KItemListController::slotViewScrollOffsetChanged);
oldView->deleteLater();
}
@@ -137,7 +135,7 @@ void KItemListController::setView(KItemListView* view)
m_view->setParent(this);
m_view->setController(this);
m_view->setModel(m_model);
- connect(m_view, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal)));
+ connect(m_view, &KItemListView::scrollOffsetChanged, this, &KItemListController::slotViewScrollOffsetChanged);
updateExtendedSelectionRegion();
}
@@ -538,8 +536,7 @@ bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const
m_pressedIndex = m_view->itemAt(m_pressedMousePos);
emit mouseButtonPressed(m_pressedIndex, event->buttons());
- // TODO: Qt5: Replace Qt::XButton1 by Qt::BackButton and Qt::XButton2 by Qt::ForwardButton
- if (event->buttons() & (Qt::XButton1 | Qt::XButton2)) {
+ if (event->buttons() & (Qt::BackButton | Qt::ForwardButton)) {
// Do not select items when clicking the back/forward buttons, see
// https://bugs.kde.org/show_bug.cgi?id=327412.
return true;
@@ -655,7 +652,7 @@ bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const
rubberBand->setStartPosition(startPos);
rubberBand->setEndPosition(startPos);
rubberBand->setActive(true);
- connect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged()));
+ connect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged);
m_view->setAutoScroll(true);
}
@@ -743,7 +740,7 @@ bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, con
KItemListRubberBand* rubberBand = m_view->rubberBand();
if (rubberBand->isActive()) {
- disconnect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged()));
+ disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged);
rubberBand->setActive(false);
m_oldSelection.clear();
m_view->setAutoScroll(false);
@@ -774,7 +771,7 @@ bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, con
} else if (shiftOrControlPressed) {
// The mouse click should only update the selection, not trigger the item
emitItemActivated = false;
- } else if (!(KGlobalSettings::singleClick() || m_singleClickActivationEnforced)) {
+ } else if (!(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced)) {
emitItemActivated = false;
}
if (emitItemActivated) {
@@ -804,7 +801,7 @@ bool KItemListController::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event,
}
}
- bool emitItemActivated = !(KGlobalSettings::singleClick() || m_singleClickActivationEnforced) &&
+ bool emitItemActivated = !(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced) &&
(event->button() & Qt::LeftButton) &&
index >= 0 && index < m_model->count();
if (emitItemActivated) {
@@ -920,7 +917,8 @@ bool KItemListController::dropEvent(QGraphicsSceneDragDropEvent* event, const QT
emit itemDropEvent(m_view->itemAt(pos), event);
}
- QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropEnd);
+ QAccessibleEvent accessibilityEvent(view(), QAccessible::DragDropEnd);
+ QAccessible::updateAccessibility(&accessibilityEvent);
return true;
}
@@ -1174,7 +1172,9 @@ void KItemListController::startDragging()
drag->setHotSpot(hotSpot);
drag->exec(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction, Qt::CopyAction);
- QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropStart);
+
+ QAccessibleEvent accessibilityEvent(view(), QAccessible::DragDropStart);
+ QAccessible::updateAccessibility(&accessibilityEvent);
}
KItemListWidget* KItemListController::hoveredWidget() const
@@ -1310,4 +1310,3 @@ void KItemListController::updateExtendedSelectionRegion()
}
}
-#include "kitemlistcontroller.moc"
diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h
index e9b70cdda..b8a93edac 100644
--- a/src/kitemviews/kitemlistcontroller.h
+++ b/src/kitemviews/kitemlistcontroller.h
@@ -23,14 +23,13 @@
#ifndef KITEMLISTCONTROLLER_H
#define KITEMLISTCONTROLLER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include "kitemset.h"
#include <QObject>
-#include <QPixmap>
#include <QPointF>
-
+class QTimer;
class KItemModelBase;
class KItemListKeyboardSearchManager;
class KItemListSelectionManager;
@@ -44,7 +43,6 @@ class QGraphicsSceneWheelEvent;
class QHideEvent;
class QInputMethodEvent;
class QKeyEvent;
-class QMimeData;
class QShowEvent;
class QTransform;
@@ -58,7 +56,7 @@ class QTransform;
* @see KItemModelBase
* @see KItemListSelectionManager
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListController : public QObject
+class DOLPHIN_EXPORT KItemListController : public QObject
{
Q_OBJECT
Q_ENUMS(SelectionBehavior)
@@ -131,7 +129,7 @@ public:
/**
* If set to true, the signals itemActivated() and itemsActivated() are emitted
* after a single-click of the left mouse button. If set to false (the default),
- * the setting from KGlobalSettings::singleClick() is used.
+ * the setting from style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) is used.
*/
void setSingleClickActivationEnforced(bool singleClick);
bool singleClickActivationEnforced() const;
diff --git a/src/kitemviews/kitemlistgroupheader.cpp b/src/kitemviews/kitemlistgroupheader.cpp
index 17c95a97c..f8576b08c 100644
--- a/src/kitemviews/kitemlistgroupheader.cpp
+++ b/src/kitemviews/kitemlistgroupheader.cpp
@@ -27,7 +27,6 @@
#include <QGraphicsSceneResizeEvent>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
-#include <KDebug>
KItemListGroupHeader::KItemListGroupHeader(QGraphicsWidget* parent) :
QGraphicsWidget(parent, 0),
@@ -233,4 +232,3 @@ QColor KItemListGroupHeader::baseColor() const
return styleOption().palette.color(group, normalBaseColorRole());
}
-#include "kitemlistgroupheader.moc"
diff --git a/src/kitemviews/kitemlistgroupheader.h b/src/kitemviews/kitemlistgroupheader.h
index 1e8ed2cca..4612bc4da 100644
--- a/src/kitemviews/kitemlistgroupheader.h
+++ b/src/kitemviews/kitemlistgroupheader.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTGROUPHEADER_H
#define KITEMLISTGROUPHEADER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemliststyleoption.h>
@@ -37,7 +37,7 @@ class KItemListView;
* the method paint() and draw the role within the given roleBounds() with
* the color roleColor().
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListGroupHeader : public QGraphicsWidget
+class DOLPHIN_EXPORT KItemListGroupHeader : public QGraphicsWidget
{
Q_OBJECT
@@ -65,7 +65,7 @@ public:
void setItemIndex(int index);
int itemIndex() const;
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE;
protected:
virtual void paintRole(QPainter* painter, const QRectF& roleBounds, const QColor& color) = 0;
@@ -101,8 +101,7 @@ protected:
*/
virtual void itemIndexChanged(int current, int previous);
- /** @reimp */
- virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
+ virtual void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE;
virtual QPalette::ColorRole normalTextColorRole() const;
virtual QPalette::ColorRole normalBaseColorRole() const;
diff --git a/src/kitemviews/kitemlistheader.cpp b/src/kitemviews/kitemlistheader.cpp
index e89ece0a1..a3fa14d35 100644
--- a/src/kitemviews/kitemlistheader.cpp
+++ b/src/kitemviews/kitemlistheader.cpp
@@ -81,8 +81,7 @@ KItemListHeader::KItemListHeader(KItemListView* listView) :
m_headerWidget = m_view->m_headerWidget;
Q_ASSERT(m_headerWidget);
- connect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
- this, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)));
+ connect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged,
+ this, &KItemListHeader::columnWidthChanged);
}
-#include "kitemlistheader.moc"
diff --git a/src/kitemviews/kitemlistheader.h b/src/kitemviews/kitemlistheader.h
index fe2d0ac10..cc2b74793 100644
--- a/src/kitemviews/kitemlistheader.h
+++ b/src/kitemviews/kitemlistheader.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTHEADER_H
#define KITEMLISTHEADER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QHash>
#include <QObject>
@@ -33,7 +33,7 @@ class KItemListView;
* Each column of the header represents a visible role
* accessible by KItemListView::visibleRoles().
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListHeader : public QObject
+class DOLPHIN_EXPORT KItemListHeader : public QObject
{
Q_OBJECT
diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp
index 1f0a89d06..46b77f7e4 100644
--- a/src/kitemviews/kitemlistselectionmanager.cpp
+++ b/src/kitemviews/kitemlistselectionmanager.cpp
@@ -24,7 +24,6 @@
#include "kitemlistselectionmanager.h"
#include "kitemmodelbase.h"
-#include <KDebug>
KItemListSelectionManager::KItemListSelectionManager(QObject* parent) :
QObject(parent),
@@ -396,4 +395,4 @@ int KItemListSelectionManager::indexAfterRangesRemoving(int index, const KItemRa
}
return qBound(-1, index - dec, m_model->count() - 1);
}
-#include "kitemlistselectionmanager.moc"
+
diff --git a/src/kitemviews/kitemlistselectionmanager.h b/src/kitemviews/kitemlistselectionmanager.h
index c4decd39e..16761428b 100644
--- a/src/kitemviews/kitemlistselectionmanager.h
+++ b/src/kitemviews/kitemlistselectionmanager.h
@@ -23,7 +23,7 @@
#ifndef KITEMLISTSELECTIONMANAGER_H
#define KITEMLISTSELECTIONMANAGER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemmodelbase.h>
#include <kitemviews/kitemset.h>
@@ -35,7 +35,7 @@ class KItemModelBase;
/**
* @brief Allows to select and deselect items of a KItemListView.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListSelectionManager : public QObject
+class DOLPHIN_EXPORT KItemListSelectionManager : public QObject
{
Q_OBJECT
diff --git a/src/kitemviews/kitemliststyleoption.cpp b/src/kitemviews/kitemliststyleoption.cpp
index edd6363c8..1ebcad141 100644
--- a/src/kitemviews/kitemliststyleoption.cpp
+++ b/src/kitemviews/kitemliststyleoption.cpp
@@ -19,7 +19,6 @@
#include "kitemliststyleoption.h"
-#include <KIconLoader>
KItemListStyleOption::KItemListStyleOption() :
rect(),
diff --git a/src/kitemviews/kitemliststyleoption.h b/src/kitemviews/kitemliststyleoption.h
index 782dd0ec2..09b787c27 100644
--- a/src/kitemviews/kitemliststyleoption.h
+++ b/src/kitemviews/kitemliststyleoption.h
@@ -20,14 +20,14 @@
#ifndef KITEMLISTSTYLEOPTION_H
#define KITEMLISTSTYLEOPTION_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QFont>
#include <QFontMetrics>
#include <QPalette>
#include <QRect>
-class LIBDOLPHINPRIVATE_EXPORT KItemListStyleOption
+class DOLPHIN_EXPORT KItemListStyleOption
{
public:
KItemListStyleOption();
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index 756f9e39a..9416f0dd7 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -22,7 +22,7 @@
#include "kitemlistview.h"
-#include <KDebug>
+#include "dolphindebug.h"
#include "kitemlistcontainer.h"
#include "kitemlistcontroller.h"
#include "kitemlistheader.h"
@@ -35,14 +35,13 @@
#include "private/kitemlistviewlayouter.h"
#include "private/kitemlistviewanimation.h"
-#include <QCursor>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsView>
#include <QPainter>
-#include <QPropertyAnimation>
#include <QStyle>
#include <QStyleOptionRubberBand>
#include <QTimer>
+#include <QElapsedTimer>
#include <algorithm>
@@ -58,7 +57,7 @@ namespace {
}
#ifndef QT_NO_ACCESSIBILITY
-QAccessibleInterface* accessibleInterfaceFactory(const QString &key, QObject *object)
+QAccessibleInterface* accessibleInterfaceFactory(const QString& key, QObject* object)
{
Q_UNUSED(key)
@@ -114,16 +113,16 @@ KItemListView::KItemListView(QGraphicsWidget* parent) :
m_layouter = new KItemListViewLayouter(m_sizeHintResolver, this);
m_animation = new KItemListViewAnimation(this);
- connect(m_animation, SIGNAL(finished(QGraphicsWidget*,KItemListViewAnimation::AnimationType)),
- this, SLOT(slotAnimationFinished(QGraphicsWidget*,KItemListViewAnimation::AnimationType)));
+ connect(m_animation, &KItemListViewAnimation::finished,
+ this, &KItemListView::slotAnimationFinished);
m_layoutTimer = new QTimer(this);
m_layoutTimer->setInterval(300);
m_layoutTimer->setSingleShot(true);
- connect(m_layoutTimer, SIGNAL(timeout()), this, SLOT(slotLayoutTimerFinished()));
+ connect(m_layoutTimer, &QTimer::timeout, this, &KItemListView::slotLayoutTimerFinished);
m_rubberBand = new KItemListRubberBand(this);
- connect(m_rubberBand, SIGNAL(activationChanged(bool)), this, SLOT(slotRubberBandActivationChanged(bool)));
+ connect(m_rubberBand, &KItemListRubberBand::activationChanged, this, &KItemListView::slotRubberBandActivationChanged);
m_headerWidget = new KItemListHeaderWidget(this);
m_headerWidget->setVisible(false);
@@ -267,7 +266,7 @@ void KItemListView::setAutoScroll(bool enabled)
if (enabled && !m_autoScrollTimer) {
m_autoScrollTimer = new QTimer(this);
m_autoScrollTimer->setSingleShot(true);
- connect(m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(triggerAutoScrolling()));
+ connect(m_autoScrollTimer, &QTimer::timeout, this, &KItemListView::triggerAutoScrolling);
m_autoScrollTimer->start(InitialAutoScrollDelay);
} else if (!enabled && m_autoScrollTimer) {
delete m_autoScrollTimer;
@@ -544,7 +543,7 @@ void KItemListView::endTransaction()
--m_activeTransactions;
if (m_activeTransactions < 0) {
m_activeTransactions = 0;
- kWarning() << "Mismatch between beginTransaction()/endTransaction()";
+ qCWarning(DolphinDebug) << "Mismatch between beginTransaction()/endTransaction()";
}
if (m_activeTransactions == 0) {
@@ -572,26 +571,26 @@ void KItemListView::setHeaderVisible(bool visible)
m_headerWidget->setColumns(m_visibleRoles);
m_headerWidget->setZValue(1);
- connect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
- this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal)));
- connect(m_headerWidget, SIGNAL(columnMoved(QByteArray,int,int)),
- this, SLOT(slotHeaderColumnMoved(QByteArray,int,int)));
- connect(m_headerWidget, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- connect(m_headerWidget, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SIGNAL(sortRoleChanged(QByteArray,QByteArray)));
+ connect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged,
+ this, &KItemListView::slotHeaderColumnWidthChanged);
+ connect(m_headerWidget, &KItemListHeaderWidget::columnMoved,
+ this, &KItemListView::slotHeaderColumnMoved);
+ connect(m_headerWidget, &KItemListHeaderWidget::sortOrderChanged,
+ this, &KItemListView::sortOrderChanged);
+ connect(m_headerWidget, &KItemListHeaderWidget::sortRoleChanged,
+ this, &KItemListView::sortRoleChanged);
m_layouter->setHeaderHeight(headerSize.height());
m_headerWidget->setVisible(true);
} else if (!visible && m_headerWidget->isVisible()) {
- disconnect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
- this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal)));
- disconnect(m_headerWidget, SIGNAL(columnMoved(QByteArray,int,int)),
- this, SLOT(slotHeaderColumnMoved(QByteArray,int,int)));
- disconnect(m_headerWidget, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- disconnect(m_headerWidget, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SIGNAL(sortRoleChanged(QByteArray,QByteArray)));
+ disconnect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged,
+ this, &KItemListView::slotHeaderColumnWidthChanged);
+ disconnect(m_headerWidget, &KItemListHeaderWidget::columnMoved,
+ this, &KItemListView::slotHeaderColumnMoved);
+ disconnect(m_headerWidget, &KItemListHeaderWidget::sortOrderChanged,
+ this, &KItemListView::sortOrderChanged);
+ disconnect(m_headerWidget, &KItemListHeaderWidget::sortRoleChanged,
+ this, &KItemListView::sortRoleChanged);
m_layouter->setHeaderHeight(0);
m_headerWidget->setVisible(false);
@@ -637,10 +636,10 @@ void KItemListView::editRole(int index, const QByteArray& role)
m_editingRole = true;
widget->setEditedRole(role);
- connect(widget, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(int,QByteArray,QVariant)));
- connect(widget, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+ connect(widget, &KItemListWidget::roleEditingCanceled,
+ this, &KItemListView::slotRoleEditingCanceled);
+ connect(widget, &KItemListWidget::roleEditingFinished,
+ this, &KItemListView::slotRoleEditingFinished);
}
void KItemListView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
@@ -936,7 +935,7 @@ void KItemListView::dragEnterEvent(QGraphicsSceneDragDropEvent* event)
setAutoScroll(true);
}
-void KItemListView::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
+void KItemListView::dragMoveEvent(QGraphicsSceneDragDropEvent* event)
{
QGraphicsWidget::dragMoveEvent(event);
@@ -946,7 +945,7 @@ void KItemListView::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
}
}
-void KItemListView::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
+void KItemListView::dragLeaveEvent(QGraphicsSceneDragDropEvent* event)
{
QGraphicsWidget::dragLeaveEvent(event);
setAutoScroll(false);
@@ -1007,7 +1006,7 @@ void KItemListView::slotItemsInserted(const KItemRangeList& itemRanges)
const int index = range.index + previouslyInsertedCount;
const int count = range.count;
if (index < 0 || count <= 0) {
- kWarning() << "Invalid item range (index:" << index << ", count:" << count << ")";
+ qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")";
continue;
}
previouslyInsertedCount += count;
@@ -1115,7 +1114,7 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges)
const int index = range.index;
const int count = range.count;
if (index < 0 || count <= 0) {
- kWarning() << "Invalid item range (index:" << index << ", count:" << count << ")";
+ qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")";
continue;
}
@@ -1268,8 +1267,12 @@ void KItemListView::slotItemsChanged(const KItemRangeList& itemRanges,
updateVisibleGroupHeaders();
doLayout(NoAnimation);
}
+
+ QAccessibleTableModelChangeEvent ev(this, QAccessibleTableModelChangeEvent::DataChanged);
+ ev.setFirstRow(itemRange.index);
+ ev.setLastRow(itemRange.index + itemRange.count);
+ QAccessible::updateAccessibility(&ev);
}
- QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
}
void KItemListView::slotGroupsChanged()
@@ -1345,7 +1348,10 @@ void KItemListView::slotCurrentChanged(int current, int previous)
currentWidget->setCurrent(true);
}
}
- QAccessible::updateAccessibility(this, current+1, QAccessible::Focus);
+
+ QAccessibleEvent ev(this, QAccessible::Focus);
+ ev.setChild(current);
+ QAccessible::updateAccessibility(&ev);
}
void KItemListView::slotSelectionChanged(const KItemSet& current, const KItemSet& previous)
@@ -1412,12 +1418,12 @@ void KItemListView::slotRubberBandPosChanged()
void KItemListView::slotRubberBandActivationChanged(bool active)
{
if (active) {
- connect(m_rubberBand, SIGNAL(startPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
- connect(m_rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
+ connect(m_rubberBand, &KItemListRubberBand::startPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
+ connect(m_rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
m_skipAutoScrollForRubberBand = true;
} else {
- disconnect(m_rubberBand, SIGNAL(startPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
- disconnect(m_rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
+ disconnect(m_rubberBand, &KItemListRubberBand::startPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
+ disconnect(m_rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
m_skipAutoScrollForRubberBand = false;
}
@@ -1544,16 +1550,16 @@ void KItemListView::setController(KItemListController* controller)
KItemListController* previous = m_controller;
if (previous) {
KItemListSelectionManager* selectionManager = previous->selectionManager();
- disconnect(selectionManager, SIGNAL(currentChanged(int,int)), this, SLOT(slotCurrentChanged(int,int)));
- disconnect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), this, SLOT(slotSelectionChanged(KItemSet,KItemSet)));
+ disconnect(selectionManager, &KItemListSelectionManager::currentChanged, this, &KItemListView::slotCurrentChanged);
+ disconnect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &KItemListView::slotSelectionChanged);
}
m_controller = controller;
if (controller) {
KItemListSelectionManager* selectionManager = controller->selectionManager();
- connect(selectionManager, SIGNAL(currentChanged(int,int)), this, SLOT(slotCurrentChanged(int,int)));
- connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), this, SLOT(slotSelectionChanged(KItemSet,KItemSet)));
+ connect(selectionManager, &KItemListSelectionManager::currentChanged, this, &KItemListView::slotCurrentChanged);
+ connect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &KItemListView::slotSelectionChanged);
}
onControllerChanged(controller, previous);
@@ -1569,22 +1575,22 @@ void KItemListView::setModel(KItemModelBase* model)
KItemModelBase* previous = m_model;
if (m_model) {
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
- disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(slotItemsInserted(KItemRangeList)));
- disconnect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved(KItemRangeList)));
- disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
- disconnect(m_model, SIGNAL(groupsChanged()),
- this, SLOT(slotGroupsChanged()));
- disconnect(m_model, SIGNAL(groupedSortingChanged(bool)),
- this, SLOT(slotGroupedSortingChanged(bool)));
- disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- disconnect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
+ disconnect(m_model, &KItemModelBase::itemsChanged,
+ this, &KItemListView::slotItemsChanged);
+ disconnect(m_model, &KItemModelBase::itemsInserted,
+ this, &KItemListView::slotItemsInserted);
+ disconnect(m_model, &KItemModelBase::itemsRemoved,
+ this, &KItemListView::slotItemsRemoved);
+ disconnect(m_model, &KItemModelBase::itemsMoved,
+ this, &KItemListView::slotItemsMoved);
+ disconnect(m_model, &KItemModelBase::groupsChanged,
+ this, &KItemListView::slotGroupsChanged);
+ disconnect(m_model, &KItemModelBase::groupedSortingChanged,
+ this, &KItemListView::slotGroupedSortingChanged);
+ disconnect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListView::slotSortOrderChanged);
+ disconnect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListView::slotSortRoleChanged);
m_sizeHintResolver->itemsRemoved(KItemRangeList() << KItemRange(0, m_model->count()));
}
@@ -1594,22 +1600,22 @@ void KItemListView::setModel(KItemModelBase* model)
m_grouped = model->groupedSorting();
if (m_model) {
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
- connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(slotItemsInserted(KItemRangeList)));
- connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved(KItemRangeList)));
- connect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
- connect(m_model, SIGNAL(groupsChanged()),
- this, SLOT(slotGroupsChanged()));
- connect(m_model, SIGNAL(groupedSortingChanged(bool)),
- this, SLOT(slotGroupedSortingChanged(bool)));
- connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
+ connect(m_model, &KItemModelBase::itemsChanged,
+ this, &KItemListView::slotItemsChanged);
+ connect(m_model, &KItemModelBase::itemsInserted,
+ this, &KItemListView::slotItemsInserted);
+ connect(m_model, &KItemModelBase::itemsRemoved,
+ this, &KItemListView::slotItemsRemoved);
+ connect(m_model, &KItemModelBase::itemsMoved,
+ this, &KItemListView::slotItemsMoved);
+ connect(m_model, &KItemModelBase::groupsChanged,
+ this, &KItemListView::slotGroupsChanged);
+ connect(m_model, &KItemModelBase::groupedSortingChanged,
+ this, &KItemListView::slotGroupedSortingChanged);
+ connect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListView::slotSortOrderChanged);
+ connect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListView::slotSortRoleChanged);
const int itemCount = m_model->count();
if (itemCount > 0) {
@@ -2023,7 +2029,7 @@ void KItemListView::updateGroupHeaderForWidget(KItemListWidget* widget)
groupHeader = groupHeaderCreator()->create(this);
groupHeader->setParentItem(widget);
m_visibleGroups.insert(widget, groupHeader);
- connect(widget, SIGNAL(geometryChanged()), this, SLOT(slotGeometryOfGroupHeaderParentChanged()));
+ connect(widget, &KItemListWidget::geometryChanged, this, &KItemListView::slotGeometryOfGroupHeaderParentChanged);
}
Q_ASSERT(groupHeader->parentItem() == widget);
@@ -2070,7 +2076,7 @@ void KItemListView::recycleGroupHeaderForWidget(KItemListWidget* widget)
header->setParentItem(0);
groupHeaderCreator()->recycle(header);
m_visibleGroups.remove(widget);
- disconnect(widget, SIGNAL(geometryChanged()), this, SLOT(slotGeometryOfGroupHeaderParentChanged()));
+ disconnect(widget, &KItemListWidget::geometryChanged, this, &KItemListView::slotGeometryOfGroupHeaderParentChanged);
}
}
@@ -2624,8 +2630,8 @@ void KItemListView::disconnectRoleEditingSignals(int index)
return;
}
- widget->disconnect(SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)), this);
- widget->disconnect(SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), this);
+ disconnect(widget, &KItemListWidget::roleEditingCanceled, this, nullptr);
+ disconnect(widget, &KItemListWidget::roleEditingFinished, this, nullptr);
}
int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc)
@@ -2719,4 +2725,3 @@ void KItemListGroupHeaderCreatorBase::recycle(KItemListGroupHeader* header)
pushRecycleableWidget(header);
}
-#include "kitemlistview.moc"
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index cf6f27c03..f20180289 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -23,7 +23,7 @@
#ifndef KITEMLISTVIEW_H
#define KITEMLISTVIEW_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kstandarditemlistgroupheader.h>
#include <kitemviews/kitemliststyleoption.h>
@@ -44,7 +44,6 @@ class KItemListViewLayouter;
class KItemListWidget;
class KItemListWidgetInformant;
class KItemListWidgetCreatorBase;
-class KItemListViewCreatorBase;
class QTimer;
/**
@@ -60,7 +59,7 @@ class QTimer;
* @see KItemListWidget
* @see KItemModelBase
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListView : public QGraphicsWidget
+class DOLPHIN_EXPORT KItemListView : public QGraphicsWidget
{
Q_OBJECT
@@ -161,8 +160,7 @@ public:
const KItemListStyleOption& styleOption() const;
- /** @reimp */
- virtual void setGeometry(const QRectF& rect);
+ virtual void setGeometry(const QRectF& rect) Q_DECL_OVERRIDE;
/**
* @return The page step which should be used by the vertical scroll bar.
@@ -280,10 +278,7 @@ public:
*/
void editRole(int index, const QByteArray& role);
- /**
- * @reimp
- */
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE;
signals:
void scrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous);
@@ -323,7 +318,7 @@ signals:
void roleEditingFinished(int index, const QByteArray& role, const QVariant& value);
protected:
- virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+ virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
void setItemSize(const QSizeF& size);
void setStyleOption(const KItemListStyleOption& option);
@@ -380,13 +375,13 @@ protected:
virtual void onTransactionBegin();
virtual void onTransactionEnd();
- virtual bool event(QEvent* event);
- virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
- virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
- virtual void dragEnterEvent(QGraphicsSceneDragDropEvent* event);
- virtual void dragMoveEvent(QGraphicsSceneDragDropEvent* event);
- virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent* event);
- virtual void dropEvent(QGraphicsSceneDragDropEvent* event);
+ virtual bool event(QEvent* event) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE;
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE;
+ virtual void dragEnterEvent(QGraphicsSceneDragDropEvent* event) Q_DECL_OVERRIDE;
+ virtual void dragMoveEvent(QGraphicsSceneDragDropEvent* event) Q_DECL_OVERRIDE;
+ virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent* event) Q_DECL_OVERRIDE;
+ virtual void dropEvent(QGraphicsSceneDragDropEvent* event) Q_DECL_OVERRIDE;
QList<KItemListWidget*> visibleItemListWidgets() const;
@@ -774,7 +769,7 @@ private:
* KItemListWidgetCreatorBase and KItemListGroupHeaderCreatorBase.
* @internal
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListCreatorBase
+class DOLPHIN_EXPORT KItemListCreatorBase
{
public:
virtual ~KItemListCreatorBase();
@@ -798,7 +793,7 @@ private:
* expensive instantiations and deletions of KItemListWidgets by recycling existing widget
* instances.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListWidgetCreatorBase : public KItemListCreatorBase
+class DOLPHIN_EXPORT KItemListWidgetCreatorBase : public KItemListCreatorBase
{
public:
virtual ~KItemListWidgetCreatorBase();
@@ -880,7 +875,7 @@ qreal KItemListWidgetCreator<T>::preferredRoleColumnWidth(const QByteArray& role
* The intention of the group-header creator is to prevent repetitive and expensive instantiations and
* deletions of KItemListGroupHeaders by recycling existing header instances.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListGroupHeaderCreatorBase : public KItemListCreatorBase
+class DOLPHIN_EXPORT KItemListGroupHeaderCreatorBase : public KItemListCreatorBase
{
public:
virtual ~KItemListGroupHeaderCreatorBase();
diff --git a/src/kitemviews/kitemlistviewaccessible.cpp b/src/kitemviews/kitemlistviewaccessible.cpp
index d9ddd58f8..7b1605a0c 100644
--- a/src/kitemviews/kitemlistviewaccessible.cpp
+++ b/src/kitemviews/kitemlistviewaccessible.cpp
@@ -27,11 +27,10 @@
#include "kitemlistview.h"
#include "private/kitemlistviewlayouter.h"
-#include <QtGui/qaccessible2.h>
+#include <qaccessible.h>
#include <qgraphicsscene.h>
#include <qgraphicsview.h>
-#include <KDebug>
#include <QHash>
KItemListView* KItemListViewAccessible::view() const
@@ -40,35 +39,52 @@ KItemListView* KItemListViewAccessible::view() const
}
KItemListViewAccessible::KItemListViewAccessible(KItemListView* view_) :
- QAccessibleObjectEx(view_)
+ QAccessibleObject(view_)
{
Q_ASSERT(view());
+ m_cells.resize(childCount());
}
-void KItemListViewAccessible::modelReset()
+KItemListViewAccessible::~KItemListViewAccessible()
{
+ foreach (QAccessibleInterface* child, m_cells) {
+ if (child) {
+ QAccessible::Id childId = QAccessible::uniqueId(child);
+ QAccessible::deleteAccessibleInterface(childId);
+ }
+ }
}
-QAccessible::Role KItemListViewAccessible::cellRole() const
+void* KItemListViewAccessible::interface_cast(QAccessible::InterfaceType type)
{
- return QAccessible::Cell;
+ if (type == QAccessible::TableInterface) {
+ return static_cast<QAccessibleTableInterface*>(this);
+ }
+ return Q_NULLPTR;
}
-QAccessibleTable2CellInterface* KItemListViewAccessible::cell(int index) const
+void KItemListViewAccessible::modelReset()
+{
+}
+
+QAccessibleInterface* KItemListViewAccessible::cell(int index) const
{
if (index < 0 || index >= view()->model()->count()) {
return 0;
- } else {
- return new KItemListAccessibleCell(view(), index);
}
-}
-QVariant KItemListViewAccessible::invokeMethodEx(Method, int, const QVariantList&)
-{
- return QVariant();
+ if (m_cells.size() < index - 1)
+ m_cells.resize(childCount());
+
+ QAccessibleInterface* child = m_cells.at(index);
+ if (!child) {
+ child = new KItemListAccessibleCell(view(), index);
+ QAccessible::registerAccessibleInterface(child);
+ }
+ return child;
}
-QAccessibleTable2CellInterface* KItemListViewAccessible::cellAt(int row, int column) const
+QAccessibleInterface* KItemListViewAccessible::cellAt(int row, int column) const
{
return cell(columnCount() * row + column);
}
@@ -127,9 +143,9 @@ QString KItemListViewAccessible::rowDescription(int) const
return QString();
}
-QList<QAccessibleTable2CellInterface*> KItemListViewAccessible::selectedCells() const
+QList<QAccessibleInterface*> KItemListViewAccessible::selectedCells() const
{
- QList<QAccessibleTable2CellInterface*> cells;
+ QList<QAccessibleInterface*> cells;
Q_FOREACH (int index, view()->controller()->selectionManager()->selectedItems()) {
cells.append(cell(index));
}
@@ -181,42 +197,31 @@ bool KItemListViewAccessible::unselectColumn(int)
return true;
}
-QAccessible2::TableModelChange KItemListViewAccessible::modelChange() const
+void KItemListViewAccessible::modelChange(QAccessibleTableModelChangeEvent* /*event*/)
+{}
+
+QAccessible::Role KItemListViewAccessible::role() const
{
- QAccessible2::TableModelChange change;
- change.lastRow = rowCount();
- change.lastColumn = columnCount();
- return change;
+ return QAccessible::Table;
}
-QAccessible::Role KItemListViewAccessible::role(int child) const
+QAccessible::State KItemListViewAccessible::state() const
{
- Q_ASSERT(child >= 0);
-
- if (child > 0) {
- return QAccessible::Cell;
- } else {
- return QAccessible::Table;
- }
+ QAccessible::State s;
+ return s;
}
-QAccessible::State KItemListViewAccessible::state(int child) const
+QAccessibleInterface* KItemListViewAccessible::childAt(int x, int y) const
{
- if (child) {
- QAccessibleInterface* interface = 0;
- navigate(Child, child, &interface);
- if (interface) {
- return interface->state(0);
- }
- }
-
- return QAccessible::Normal | QAccessible::HasInvokeExtension;
+ const QPointF point = QPointF(x, y);
+ int itemIndex = view()->itemAt(view()->mapFromScene(point));
+ return child(itemIndex);
}
-int KItemListViewAccessible::childAt(int x, int y) const
+QAccessibleInterface* KItemListViewAccessible::parent() const
{
- const QPointF point = QPointF(x,y);
- return view()->itemAt(view()->mapFromScene(point));
+ // FIXME: return KItemListContainerAccessible here
+ return Q_NULLPTR;
}
int KItemListViewAccessible::childCount() const
@@ -227,18 +232,16 @@ int KItemListViewAccessible::childCount() const
int KItemListViewAccessible::indexOfChild(const QAccessibleInterface* interface) const
{
const KItemListAccessibleCell* widget = static_cast<const KItemListAccessibleCell*>(interface);
- return widget->index() + 1;
+ return widget->index();
}
-QString KItemListViewAccessible::text(Text, int child) const
+QString KItemListViewAccessible::text(QAccessible::Text) const
{
- Q_ASSERT(child == 0);
return QString();
}
-QRect KItemListViewAccessible::rect(int child) const
+QRect KItemListViewAccessible::rect() const
{
- Q_UNUSED(child)
if (!view()->isVisible()) {
return QRect();
}
@@ -253,50 +256,14 @@ QRect KItemListViewAccessible::rect(int child) const
}
}
-int KItemListViewAccessible::navigate(RelationFlag relation, int index, QAccessibleInterface** interface) const
+QAccessibleInterface* KItemListViewAccessible::child(int index) const
{
- *interface = 0;
-
- switch (relation) {
- case QAccessible::Child:
- Q_ASSERT(index > 0);
- *interface = cell(index - 1);
- if (*interface) {
- return 0;
- }
- break;
-
- default:
- break;
+ if (index >= 0 && index < childCount()) {
+ return cell(index);
}
-
- return -1;
+ return Q_NULLPTR;
}
-QAccessible::Relation KItemListViewAccessible::relationTo(int, const QAccessibleInterface*, int) const
-{
- return QAccessible::Unrelated;
-}
-
-#ifndef QT_NO_ACTION
-
-int KItemListViewAccessible::userActionCount(int) const
-{
- return 0;
-}
-
-QString KItemListViewAccessible::actionText(int, Text, int) const
-{
- return QString();
-}
-
-bool KItemListViewAccessible::doAction(int, int, const QVariantList&)
-{
- return false;
-}
-
-#endif
-
// Table Cell
KItemListAccessibleCell::KItemListAccessibleCell(KItemListView* view, int index) :
@@ -306,6 +273,14 @@ KItemListAccessibleCell::KItemListAccessibleCell(KItemListView* view, int index)
Q_ASSERT(index >= 0 && index < view->model()->count());
}
+void* KItemListAccessibleCell::interface_cast(QAccessible::InterfaceType type)
+{
+ if (type == QAccessible::TableCellInterface) {
+ return static_cast<QAccessibleTableCellInterface*>(this);
+ }
+ return Q_NULLPTR;
+}
+
int KItemListAccessibleCell::columnExtent() const
{
return 1;
@@ -341,52 +316,39 @@ bool KItemListAccessibleCell::isSelected() const
return m_view->controller()->selectionManager()->isSelected(m_index);
}
-void KItemListAccessibleCell::rowColumnExtents(int* row, int* column, int* rowExtents, int* columnExtents, bool* selected) const
+QAccessibleInterface* KItemListAccessibleCell::table() const
{
- const KItemListViewLayouter* layouter = m_view->m_layouter;
- *row = layouter->itemRow(m_index);
- *column = layouter->itemColumn(m_index);
- *rowExtents = 1;
- *columnExtents = 1;
- *selected = isSelected();
+ return QAccessible::queryAccessibleInterface(m_view);
}
-QAccessibleTable2Interface* KItemListAccessibleCell::table() const
+QAccessible::Role KItemListAccessibleCell::role() const
{
- return QAccessible::queryAccessibleInterface(m_view)->table2Interface();
-}
-
-QAccessible::Role KItemListAccessibleCell::role(int child) const
-{
- Q_ASSERT(child == 0);
return QAccessible::Cell;
}
-QAccessible::State KItemListAccessibleCell::state(int child) const
+QAccessible::State KItemListAccessibleCell::state() const
{
- Q_ASSERT(child == 0);
- QAccessible::State state = Normal;
+ QAccessible::State state;
+ state.selectable = true;
if (isSelected()) {
- state |= Selected;
+ state.selected = true;
}
+ state.focusable = true;
if (m_view->controller()->selectionManager()->currentItem() == m_index) {
- state |= Focused;
+ state.focused = true;
}
- state |= Selectable;
- state |= Focusable;
-
if (m_view->controller()->selectionBehavior() == KItemListController::MultiSelection) {
- state |= MultiSelectable;
+ state.multiSelectable = true;
}
if (m_view->model()->isExpandable(m_index)) {
if (m_view->model()->isExpanded(m_index)) {
- state |= Expanded;
+ state.expanded = true;
} else {
- state |= Collapsed;
+ state.collapsed = true;
}
}
@@ -398,7 +360,7 @@ bool KItemListAccessibleCell::isExpandable() const
return m_view->model()->isExpandable(m_index);
}
-QRect KItemListAccessibleCell::rect(int) const
+QRect KItemListAccessibleCell::rect() const
{
QRect rect = m_view->itemRect(m_index).toRect();
@@ -411,13 +373,9 @@ QRect KItemListAccessibleCell::rect(int) const
return rect;
}
-QString KItemListAccessibleCell::text(QAccessible::Text t, int child) const
+QString KItemListAccessibleCell::text(QAccessible::Text t) const
{
- Q_ASSERT(child == 0);
- Q_UNUSED(child)
-
switch (t) {
- case QAccessible::Value:
case QAccessible::Name: {
const QHash<QByteArray, QVariant> data = m_view->model()->data(m_index);
return data["text"].toString();
@@ -430,9 +388,13 @@ QString KItemListAccessibleCell::text(QAccessible::Text t, int child) const
return QString();
}
-void KItemListAccessibleCell::setText(QAccessible::Text, int child, const QString&)
+void KItemListAccessibleCell::setText(QAccessible::Text, const QString&)
{
- Q_ASSERT(child == 0);
+}
+
+QAccessibleInterface* KItemListAccessibleCell::child(int) const
+{
+ return Q_NULLPTR;
}
bool KItemListAccessibleCell::isValid() const
@@ -440,9 +402,9 @@ bool KItemListAccessibleCell::isValid() const
return m_view && (m_index >= 0) && (m_index < m_view->model()->count());
}
-int KItemListAccessibleCell::childAt(int, int) const
+QAccessibleInterface* KItemListAccessibleCell::childAt(int, int) const
{
- return 0;
+ return Q_NULLPTR;
}
int KItemListAccessibleCell::childCount() const
@@ -456,43 +418,11 @@ int KItemListAccessibleCell::indexOfChild(const QAccessibleInterface* child) con
return -1;
}
-int KItemListAccessibleCell::navigate(RelationFlag relation, int index, QAccessibleInterface** interface) const
-{
- if (relation == Ancestor && index == 1) {
- *interface = new KItemListViewAccessible(m_view);
- return 0;
- }
-
- *interface = 0;
- return -1;
-}
-
-QAccessible::Relation KItemListAccessibleCell::relationTo(int child, const QAccessibleInterface* , int otherChild) const
-{
- Q_ASSERT(child == 0);
- Q_ASSERT(otherChild == 0);
- return QAccessible::Unrelated;
-}
-
-#ifndef QT_NO_ACTION
-
-int KItemListAccessibleCell::userActionCount(int) const
+QAccessibleInterface* KItemListAccessibleCell::parent() const
{
- return 0;
-}
-
-QString KItemListAccessibleCell::actionText(int, Text, int) const
-{
- return QString();
+ return QAccessible::queryAccessibleInterface(m_view);
}
-bool KItemListAccessibleCell::doAction(int, int, const QVariantList&)
-{
- return false;
-}
-
-#endif
-
int KItemListAccessibleCell::index() const
{
return m_index;
@@ -505,7 +435,7 @@ QObject* KItemListAccessibleCell::object() const
// Container Interface
KItemListContainerAccessible::KItemListContainerAccessible(KItemListContainer* container) :
- QAccessibleWidgetEx(container)
+ QAccessibleWidget(container)
{
}
@@ -521,20 +451,17 @@ int KItemListContainerAccessible::childCount() const
int KItemListContainerAccessible::indexOfChild(const QAccessibleInterface* child) const
{
if (child->object() == container()->controller()->view()) {
- return 1;
- } else {
- return -1;
+ return 0;
}
+ return -1;
}
-int KItemListContainerAccessible::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface** target) const
+QAccessibleInterface* KItemListContainerAccessible::child(int index) const
{
- if (relation == QAccessible::Child) {
- *target = new KItemListViewAccessible(container()->controller()->view());
- return 0;
- } else {
- return QAccessibleWidgetEx::navigate(relation, index, target);
+ if (index == 0) {
+ return QAccessible::queryAccessibleInterface(container()->controller()->view());
}
+ return Q_NULLPTR;
}
const KItemListContainer* KItemListContainerAccessible::container() const
diff --git a/src/kitemviews/kitemlistviewaccessible.h b/src/kitemviews/kitemlistviewaccessible.h
index c2213cd67..afef2d5fe 100644
--- a/src/kitemviews/kitemlistviewaccessible.h
+++ b/src/kitemviews/kitemlistviewaccessible.h
@@ -22,118 +22,104 @@
#ifndef QT_NO_ACCESSIBILITY
+#include "dolphin_export.h"
+
#include <QtCore/qpointer.h>
-#include <QtGui/qaccessible.h>
-#include <QtGui/qaccessible2.h>
-#include <QtGui/qaccessiblewidget.h>
-#include <QtGui/qaccessibleobject.h>
+#include <qaccessible.h>
+#include <qaccessibleobject.h>
+#include <QtWidgets/qaccessiblewidget.h>
class KItemListView;
class KItemListContainer;
-class KItemListViewAccessible: public QAccessibleTable2Interface, public QAccessibleObjectEx
+class DOLPHIN_EXPORT KItemListViewAccessible: public QAccessibleObject, public QAccessibleTableInterface
{
- Q_ACCESSIBLE_OBJECT
-
public:
explicit KItemListViewAccessible(KItemListView* view);
+ ~KItemListViewAccessible();
- Role role(int child) const;
- State state(int child) const;
- QString text(Text t, int child) const;
- QRect rect(int child) const;
-
- int childAt(int x, int y) const;
- int childCount() const;
- int indexOfChild(const QAccessibleInterface*) const;
+ void* interface_cast(QAccessible::InterfaceType type) Q_DECL_OVERRIDE;
- int navigate(RelationFlag relation, int index, QAccessibleInterface** interface) const;
- Relation relationTo(int child, const QAccessibleInterface* other, int otherChild) const;
+ QAccessible::Role role() const Q_DECL_OVERRIDE;
+ QAccessible::State state() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QRect rect() const Q_DECL_OVERRIDE;
-#ifndef QT_NO_ACTION
- int userActionCount(int child) const;
- QString actionText(int action, Text t, int child) const;
- bool doAction(int action, int child, const QVariantList& params);
-#endif
- QVariant invokeMethodEx(Method, int, const QVariantList&);
+ QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE;
+ int childCount() const Q_DECL_OVERRIDE;
+ int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE;
+ QAccessibleInterface* childAt(int x, int y) const Q_DECL_OVERRIDE;
+ QAccessibleInterface* parent() const Q_DECL_OVERRIDE;
- // Table2 interface
- virtual QAccessibleTable2CellInterface* cellAt(int row, int column) const;
- virtual QAccessibleInterface* caption() const;
- virtual QAccessibleInterface* summary() const;
- virtual QString columnDescription(int column) const;
- virtual QString rowDescription(int row) const;
- virtual int columnCount() const;
- virtual int rowCount() const;
- virtual QAccessible2::TableModelChange modelChange() const;
- virtual void rowsInserted(const QModelIndex&, int, int) {}
- virtual void rowsRemoved(const QModelIndex&, int, int) {}
- virtual void columnsInserted(const QModelIndex&, int, int) {}
- virtual void columnsRemoved(const QModelIndex&, int, int) {}
- virtual void rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int) {}
- virtual void columnsMoved(const QModelIndex&, int, int, const QModelIndex&, int) {}
+ // Table interface
+ virtual QAccessibleInterface* cellAt(int row, int column) const Q_DECL_OVERRIDE;
+ virtual QAccessibleInterface* caption() const Q_DECL_OVERRIDE;
+ virtual QAccessibleInterface* summary() const Q_DECL_OVERRIDE;
+ virtual QString columnDescription(int column) const Q_DECL_OVERRIDE;
+ virtual QString rowDescription(int row) const Q_DECL_OVERRIDE;
+ virtual int columnCount() const Q_DECL_OVERRIDE;
+ virtual int rowCount() const Q_DECL_OVERRIDE;
// Selection
- virtual int selectedCellCount() const;
- virtual int selectedColumnCount() const;
- virtual int selectedRowCount() const;
- virtual QList<QAccessibleTable2CellInterface*> selectedCells() const;
- virtual QList<int> selectedColumns() const;
- virtual QList<int> selectedRows() const;
- virtual bool isColumnSelected(int column) const;
- virtual bool isRowSelected(int row) const;
- virtual bool selectRow(int row);
- virtual bool selectColumn(int column);
- virtual bool unselectRow(int row);
- virtual bool unselectColumn(int column);
+ virtual int selectedCellCount() const Q_DECL_OVERRIDE;
+ virtual int selectedColumnCount() const Q_DECL_OVERRIDE;
+ virtual int selectedRowCount() const Q_DECL_OVERRIDE;
+ virtual QList<QAccessibleInterface*> selectedCells() const Q_DECL_OVERRIDE;
+ virtual QList<int> selectedColumns() const Q_DECL_OVERRIDE;
+ virtual QList<int> selectedRows() const Q_DECL_OVERRIDE;
+ virtual bool isColumnSelected(int column) const Q_DECL_OVERRIDE;
+ virtual bool isRowSelected(int row) const Q_DECL_OVERRIDE;
+ virtual bool selectRow(int row) Q_DECL_OVERRIDE;
+ virtual bool selectColumn(int column) Q_DECL_OVERRIDE;
+ virtual bool unselectRow(int row) Q_DECL_OVERRIDE;
+ virtual bool unselectColumn(int column) Q_DECL_OVERRIDE;
+ virtual void modelChange(QAccessibleTableModelChangeEvent*) Q_DECL_OVERRIDE;
KItemListView* view() const;
protected:
virtual void modelReset();
/**
- * Create an QAccessibleTable2CellInterface representing the table
+ * Create an QAccessibleTableCellInterface representing the table
* cell at the @index. Index is 0-based.
*/
- inline QAccessibleTable2CellInterface* cell(int index) const;
- inline QAccessible::Role cellRole() const;
+ inline QAccessibleInterface* cell(int index) const;
+
+private:
+ mutable QVector<QAccessibleInterface*> m_cells;
};
-class KItemListAccessibleCell: public QAccessibleTable2CellInterface
+class DOLPHIN_EXPORT KItemListAccessibleCell: public QAccessibleInterface, public QAccessibleTableCellInterface
{
public:
KItemListAccessibleCell(KItemListView* view, int m_index);
- QObject* object() const;
- Role role(int) const;
- State state(int) const;
- QRect rect(int) const;
- bool isValid() const;
- int childAt(int, int) const;
- int childCount() const;
- int indexOfChild(const QAccessibleInterface*) const;
- QString text(Text t, int child) const;
- void setText(Text t, int child, const QString& text);
- int navigate(RelationFlag relation, int m_index, QAccessibleInterface** interface) const;
- Relation relationTo(int child, const QAccessibleInterface* other, int otherChild) const;
- bool isExpandable() const;
+ void* interface_cast(QAccessible::InterfaceType type) Q_DECL_OVERRIDE;
+ QObject* object() const Q_DECL_OVERRIDE;
+ bool isValid() const Q_DECL_OVERRIDE;
+ QAccessible::Role role() const Q_DECL_OVERRIDE;
+ QAccessible::State state() const Q_DECL_OVERRIDE;
+ QRect rect() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ void setText(QAccessible::Text t, const QString& text) Q_DECL_OVERRIDE;
-#ifndef QT_NO_ACTION
- int userActionCount(int child) const;
- QString actionText(int action, Text t, int child) const;
- bool doAction(int action, int child, const QVariantList& params);
-#endif
+ QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE;
+ int childCount() const Q_DECL_OVERRIDE;
+ QAccessibleInterface* childAt(int x, int y) const Q_DECL_OVERRIDE;
+ int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE;
+
+ QAccessibleInterface* parent() const Q_DECL_OVERRIDE;
+ bool isExpandable() const;
// Cell Interface
- virtual int columnExtent() const;
- virtual QList<QAccessibleInterface*> columnHeaderCells() const;
- virtual int columnIndex() const;
- virtual int rowExtent() const;
- virtual QList<QAccessibleInterface*> rowHeaderCells() const;
- virtual int rowIndex() const;
- virtual bool isSelected() const;
- virtual void rowColumnExtents(int* row, int* column, int* rowExtents, int* columnExtents, bool* selected) const;
- virtual QAccessibleTable2Interface* table() const;
+ virtual int columnExtent() const Q_DECL_OVERRIDE;
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const Q_DECL_OVERRIDE;
+ virtual int columnIndex() const Q_DECL_OVERRIDE;
+ virtual int rowExtent() const Q_DECL_OVERRIDE;
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const Q_DECL_OVERRIDE;
+ virtual int rowIndex() const Q_DECL_OVERRIDE;
+ virtual bool isSelected() const Q_DECL_OVERRIDE;
+ virtual QAccessibleInterface* table() const Q_DECL_OVERRIDE;
inline int index() const;
@@ -142,17 +128,15 @@ private:
int m_index;
};
-class KItemListContainerAccessible : public QAccessibleWidgetEx
+class DOLPHIN_EXPORT KItemListContainerAccessible : public QAccessibleWidget
{
- Q_ACCESSIBLE_OBJECT
-
public:
explicit KItemListContainerAccessible(KItemListContainer* container);
virtual ~KItemListContainerAccessible();
- int childCount() const;
- int indexOfChild(const QAccessibleInterface* child) const;
- int navigate(RelationFlag relation, int entry, QAccessibleInterface** target) const;
+ QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE;
+ int childCount() const Q_DECL_OVERRIDE;
+ int indexOfChild(const QAccessibleInterface* child) const Q_DECL_OVERRIDE;
private:
const KItemListContainer* container() const;
diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp
index 97a14763c..3eb6b1d71 100644
--- a/src/kitemviews/kitemlistwidget.cpp
+++ b/src/kitemviews/kitemlistwidget.cpp
@@ -27,9 +27,7 @@
#include "private/kitemlistselectiontoggle.h"
-#include <KDebug>
-#include <KGlobalSettings>
#include <QApplication>
#include <QPainter>
#include <QPropertyAnimation>
@@ -250,9 +248,9 @@ void KItemListWidget::setHovered(bool hovered)
if (!m_hoverAnimation) {
m_hoverAnimation = new QPropertyAnimation(this, "hoverOpacity", this);
- const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 200;
+ const int duration = style()->styleHint(QStyle::SH_Widget_Animate) ? 200 : 1;
m_hoverAnimation->setDuration(duration);
- connect(m_hoverAnimation, SIGNAL(finished()), this, SLOT(slotHoverAnimationFinished()));
+ connect(m_hoverAnimation, &QPropertyAnimation::finished, this, &KItemListWidget::slotHoverAnimationFinished);
}
m_hoverAnimation->stop();
@@ -526,4 +524,3 @@ void KItemListWidget::drawItemStyleOption(QPainter* painter, QWidget* widget, QS
widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget);
}
-#include "kitemlistwidget.moc"
diff --git a/src/kitemviews/kitemlistwidget.h b/src/kitemviews/kitemlistwidget.h
index c086ee6d3..ae99a1f29 100644
--- a/src/kitemviews/kitemlistwidget.h
+++ b/src/kitemviews/kitemlistwidget.h
@@ -23,7 +23,7 @@
#ifndef KITEMLISTWIDGET_H
#define KITEMLISTWIDGET_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemliststyleoption.h>
@@ -43,7 +43,7 @@ class QPropertyAnimation;
* size for the invisible items must be accessible. KItemListWidgetInformant
* provides this information.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListWidgetInformant
+class DOLPHIN_EXPORT KItemListWidgetInformant
{
public:
KItemListWidgetInformant();
@@ -63,7 +63,7 @@ public:
* All properties are set by KItemListView, for each property there is a corresponding
* virtual protected method that allows to react on property changes.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListWidget : public QGraphicsWidget
+class DOLPHIN_EXPORT KItemListWidget : public QGraphicsWidget
{
Q_OBJECT
@@ -82,7 +82,7 @@ public:
* to show the data of the custom model provided by KItemListWidget::data().
* @reimp
*/
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE;
void setVisibleRoles(const QList<QByteArray>& roles);
QList<QByteArray> visibleRoles() const;
@@ -203,7 +203,7 @@ protected:
virtual void alternateBackgroundChanged(bool enabled);
virtual void siblingsInformationChanged(const QBitArray& current, const QBitArray& previous);
virtual void editedRoleChanged(const QByteArray& current, const QByteArray& previous);
- virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
+ virtual void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE;
/**
* @return The current opacity of the hover-animation. When implementing a custom painting-code for a hover-state
diff --git a/src/kitemviews/kitemmodelbase.cpp b/src/kitemviews/kitemmodelbase.cpp
index 4312640e4..bf41b1c84 100644
--- a/src/kitemviews/kitemmodelbase.cpp
+++ b/src/kitemviews/kitemmodelbase.cpp
@@ -159,4 +159,3 @@ void KItemModelBase::onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder pre
Q_UNUSED(previous);
}
-#include "kitemmodelbase.moc"
diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h
index 283cfa552..bd5ca1d65 100644
--- a/src/kitemviews/kitemmodelbase.h
+++ b/src/kitemviews/kitemmodelbase.h
@@ -23,7 +23,7 @@
#ifndef KITEMMODELBASE_H
#define KITEMMODELBASE_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemrange.h>
#include <kitemviews/kitemset.h>
@@ -49,7 +49,7 @@ class QMimeData;
* Also optionally it is possible to provide a tree of items by implementing the methods
* setExpanded(), isExpanded(), isExpandable() and expandedParentsCount().
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemModelBase : public QObject
+class DOLPHIN_EXPORT KItemModelBase : public QObject
{
Q_OBJECT
diff --git a/src/kitemviews/kstandarditem.cpp b/src/kitemviews/kstandarditem.cpp
index 6cb5b049b..f3fd258f9 100644
--- a/src/kitemviews/kstandarditem.cpp
+++ b/src/kitemviews/kstandarditem.cpp
@@ -18,8 +18,8 @@
***************************************************************************/
#include "kstandarditem.h"
-
-#include <KDebug>
+#include <QSet>
+#include <QByteArray>
#include "kstandarditemmodel.h"
KStandardItem::KStandardItem(KStandardItem* parent) :
diff --git a/src/kitemviews/kstandarditem.h b/src/kitemviews/kstandarditem.h
index 689db4251..5bb2bb36f 100644
--- a/src/kitemviews/kstandarditem.h
+++ b/src/kitemviews/kstandarditem.h
@@ -20,11 +20,10 @@
#ifndef KSTANDARDITEM_H
#define KSTANDARDITEM_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QByteArray>
#include <QHash>
-#include <QIcon>
#include <QList>
#include <QVariant>
@@ -37,7 +36,7 @@ class KStandardItemModel;
* used roles. It is possible to assign values for custom
* roles by using setDataValue().
*/
-class LIBDOLPHINPRIVATE_EXPORT KStandardItem
+class DOLPHIN_EXPORT KStandardItem
{
public:
diff --git a/src/kitemviews/kstandarditemlistgroupheader.cpp b/src/kitemviews/kstandarditemlistgroupheader.cpp
index 1e23c0a56..2afaa168c 100644
--- a/src/kitemviews/kstandarditemlistgroupheader.cpp
+++ b/src/kitemviews/kstandarditemlistgroupheader.cpp
@@ -22,7 +22,7 @@
#include "kstandarditemlistgroupheader.h"
-#include <kratingpainter.h>
+#include <KRatingPainter>
#include <QPainter>
KStandardItemListGroupHeader::KStandardItemListGroupHeader(QGraphicsWidget* parent) :
@@ -122,4 +122,3 @@ void KStandardItemListGroupHeader::updateCache()
}
}
-#include "kstandarditemlistgroupheader.moc"
diff --git a/src/kitemviews/kstandarditemlistgroupheader.h b/src/kitemviews/kstandarditemlistgroupheader.h
index 26158d6ba..f0eacfd49 100644
--- a/src/kitemviews/kstandarditemlistgroupheader.h
+++ b/src/kitemviews/kstandarditemlistgroupheader.h
@@ -20,14 +20,14 @@
#ifndef KSTANDARDITEMLISTGROUPHEADER_H
#define KSTANDARDITEMLISTGROUPHEADER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemlistgroupheader.h>
#include <QPixmap>
#include <QStaticText>
-class LIBDOLPHINPRIVATE_EXPORT KStandardItemListGroupHeader : public KItemListGroupHeader
+class DOLPHIN_EXPORT KStandardItemListGroupHeader : public KItemListGroupHeader
{
Q_OBJECT
@@ -35,14 +35,14 @@ public:
KStandardItemListGroupHeader(QGraphicsWidget* parent = 0);
virtual ~KStandardItemListGroupHeader();
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE;
protected:
- virtual void paintRole(QPainter* painter, const QRectF& roleBounds, const QColor& color);
- virtual void paintSeparator(QPainter* painter, const QColor& color);
- virtual void roleChanged(const QByteArray &current, const QByteArray &previous);
- virtual void dataChanged(const QVariant& current, const QVariant& previous);
- virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
+ virtual void paintRole(QPainter* painter, const QRectF& roleBounds, const QColor& color) Q_DECL_OVERRIDE;
+ virtual void paintSeparator(QPainter* painter, const QColor& color) Q_DECL_OVERRIDE;
+ virtual void roleChanged(const QByteArray &current, const QByteArray &previous) Q_DECL_OVERRIDE;
+ virtual void dataChanged(const QVariant& current, const QVariant& previous) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE;
private:
void updateCache();
diff --git a/src/kitemviews/kstandarditemlistview.cpp b/src/kitemviews/kstandarditemlistview.cpp
index 135cd0b7d..6471002c7 100644
--- a/src/kitemviews/kstandarditemlistview.cpp
+++ b/src/kitemviews/kstandarditemlistview.cpp
@@ -19,7 +19,6 @@
#include "kstandarditemlistview.h"
-#include <KDebug>
#include <KIconLoader>
#include "kstandarditemlistwidget.h"
#include "kstandarditemlistgroupheader.h"
@@ -30,7 +29,7 @@ KStandardItemListView::KStandardItemListView(QGraphicsWidget* parent) :
{
setAcceptDrops(true);
setScrollOrientation(Qt::Vertical);
- setVisibleRoles(QList<QByteArray>() << "text");
+ setVisibleRoles({"text"});
}
KStandardItemListView::~KStandardItemListView()
@@ -179,4 +178,3 @@ void KStandardItemListView::updateLayoutOfVisibleItems()
}
}
-#include "kstandarditemlistview.moc"
diff --git a/src/kitemviews/kstandarditemlistview.h b/src/kitemviews/kstandarditemlistview.h
index f5b0bfd8c..2e4c7a0a0 100644
--- a/src/kitemviews/kstandarditemlistview.h
+++ b/src/kitemviews/kstandarditemlistview.h
@@ -20,7 +20,7 @@
#ifndef KSTANDARDITEMLISTVIEW_H
#define KSTANDARDITEMLISTVIEW_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemlistview.h>
@@ -40,7 +40,7 @@
* KItemListContainer* container = new KItemListContainer(controller, parentWidget);
* </code>
*/
-class LIBDOLPHINPRIVATE_EXPORT KStandardItemListView : public KItemListView
+class DOLPHIN_EXPORT KStandardItemListView : public KItemListView
{
Q_OBJECT
@@ -59,15 +59,15 @@ public:
ItemLayout itemLayout() const;
protected:
- virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const;
- virtual KItemListGroupHeaderCreatorBase* defaultGroupHeaderCreator() const;
- virtual void initializeItemListWidget(KItemListWidget* item);
- virtual bool itemSizeHintUpdateRequired(const QSet<QByteArray>& changedRoles) const;
+ virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const Q_DECL_OVERRIDE;
+ virtual KItemListGroupHeaderCreatorBase* defaultGroupHeaderCreator() const Q_DECL_OVERRIDE;
+ virtual void initializeItemListWidget(KItemListWidget* item) Q_DECL_OVERRIDE;
+ virtual bool itemSizeHintUpdateRequired(const QSet<QByteArray>& changedRoles) const Q_DECL_OVERRIDE;
virtual bool itemLayoutSupportsItemExpanding(ItemLayout layout) const;
virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous);
- virtual void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous);
- virtual void onSupportsItemExpandingChanged(bool supportsExpanding);
- virtual void polishEvent();
+ virtual void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous) Q_DECL_OVERRIDE;
+ virtual void onSupportsItemExpandingChanged(bool supportsExpanding) Q_DECL_OVERRIDE;
+ virtual void polishEvent() Q_DECL_OVERRIDE;
private:
void applyDefaultStyleOption(int iconSize, int padding, int horizontalMargin, int verticalMargin);
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index 6407efc22..f663b8725 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -22,19 +22,16 @@
#include "kfileitemlistview.h"
#include "kfileitemmodel.h"
-#include <KIcon>
+#include <QIcon>
#include <KIconEffect>
#include <KIconLoader>
-#include <KLocale>
-#include <kratingpainter.h>
+#include <KRatingPainter>
#include <KStringHandler>
-#include <KDebug>
#include "private/kfileitemclipboard.h"
#include "private/kitemlistroleeditor.h"
#include "private/kpixmapmodifier.h"
-#include <QFontMetricsF>
#include <QGraphicsScene>
#include <QGraphicsSceneResizeEvent>
#include <QGraphicsView>
@@ -120,6 +117,8 @@ QString KStandardItemListWidgetInformant::itemText(int index, const KItemListVie
bool KStandardItemListWidgetInformant::itemIsLink(int index, const KItemListView* view) const
{
+ Q_UNUSED(index);
+ Q_UNUSED(view);
return false;
}
@@ -682,7 +681,7 @@ void KStandardItemListWidget::dataChanged(const QHash<QByteArray, QVariant>& cur
// The URL might have changed (i.e., if the sort order of the items has
// been changed). Therefore, the "is cut" state must be updated.
KFileItemClipboard* clipboard = KFileItemClipboard::instance();
- const KUrl itemUrl = data().value("url").value<KUrl>();
+ const QUrl itemUrl = data().value("url").value<QUrl>();
m_isCut = clipboard->isCut(itemUrl);
// The icon-state might depend from other roles and hence is
@@ -758,10 +757,10 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray& current, const
if (m_roleEditor) {
emit roleEditingCanceled(index(), current, data().value(current));
- disconnect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant)));
- disconnect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(QByteArray,QVariant)));
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled,
+ this, &KStandardItemListWidget::slotRoleEditingCanceled);
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished,
+ this, &KStandardItemListWidget::slotRoleEditingFinished);
if (m_oldRoleEditor) {
m_oldRoleEditor->deleteLater();
@@ -796,10 +795,10 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray& current, const
m_roleEditor->setTextCursor(cursor);
}
- connect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant)));
- connect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(QByteArray,QVariant)));
+ connect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled,
+ this, &KStandardItemListWidget::slotRoleEditingCanceled);
+ connect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished,
+ this, &KStandardItemListWidget::slotRoleEditingFinished);
// Adjust the geometry of the editor
QRectF rect = roleEditingRect(current);
@@ -833,24 +832,24 @@ void KStandardItemListWidget::showEvent(QShowEvent* event)
// Listen to changes of the clipboard to mark the item as cut/uncut
KFileItemClipboard* clipboard = KFileItemClipboard::instance();
- const KUrl itemUrl = data().value("url").value<KUrl>();
+ const QUrl itemUrl = data().value("url").value<QUrl>();
m_isCut = clipboard->isCut(itemUrl);
- connect(clipboard, SIGNAL(cutItemsChanged()),
- this, SLOT(slotCutItemsChanged()));
+ connect(clipboard, &KFileItemClipboard::cutItemsChanged,
+ this, &KStandardItemListWidget::slotCutItemsChanged);
}
void KStandardItemListWidget::hideEvent(QHideEvent* event)
{
- disconnect(KFileItemClipboard::instance(), SIGNAL(cutItemsChanged()),
- this, SLOT(slotCutItemsChanged()));
+ disconnect(KFileItemClipboard::instance(), &KFileItemClipboard::cutItemsChanged,
+ this, &KStandardItemListWidget::slotCutItemsChanged);
KItemListWidget::hideEvent(event);
}
void KStandardItemListWidget::slotCutItemsChanged()
{
- const KUrl itemUrl = data().value("url").value<KUrl>();
+ const QUrl itemUrl = data().value("url").value<QUrl>();
const bool isCut = KFileItemClipboard::instance()->isCut(itemUrl);
if (m_isCut != isCut) {
m_isCut = isCut;
@@ -1415,10 +1414,10 @@ QRectF KStandardItemListWidget::roleEditingRect(const QByteArray& role) const
void KStandardItemListWidget::closeRoleEditor()
{
- disconnect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant)));
- disconnect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(QByteArray,QVariant)));
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled,
+ this, &KStandardItemListWidget::slotRoleEditingCanceled);
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished,
+ this, &KStandardItemListWidget::slotRoleEditingFinished);
if (m_roleEditor->hasFocus()) {
// If the editing was not ended by a FocusOut event, we have
@@ -1440,7 +1439,7 @@ QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStrin
QPixmap pixmap;
if (!QPixmapCache::find(key, pixmap)) {
- const KIcon icon(name);
+ const QIcon icon = QIcon::fromTheme(name);
int requestedSize;
if (size <= KIconLoader::SizeSmall) {
@@ -1497,4 +1496,3 @@ qreal KStandardItemListWidget::columnPadding(const KItemListStyleOption& option)
return option.padding * 6;
}
-#include "kstandarditemlistwidget.moc"
diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h
index 403794fc3..826452255 100644
--- a/src/kitemviews/kstandarditemlistwidget.h
+++ b/src/kitemviews/kstandarditemlistwidget.h
@@ -20,7 +20,7 @@
#ifndef KSTANDARDITEMLISTWIDGET_H
#define KSTANDARDITEMLISTWIDGET_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemlistwidget.h>
@@ -32,17 +32,17 @@ class KItemListRoleEditor;
class KItemListStyleOption;
class KItemListView;
-class LIBDOLPHINPRIVATE_EXPORT KStandardItemListWidgetInformant : public KItemListWidgetInformant
+class DOLPHIN_EXPORT KStandardItemListWidgetInformant : public KItemListWidgetInformant
{
public:
KStandardItemListWidgetInformant();
virtual ~KStandardItemListWidgetInformant();
- virtual void calculateItemSizeHints(QVector<qreal>& logicalHeightHints, qreal& logicalWidthHint, const KItemListView* view) const;
+ virtual void calculateItemSizeHints(QVector<qreal>& logicalHeightHints, qreal& logicalWidthHint, const KItemListView* view) const Q_DECL_OVERRIDE;
virtual qreal preferredRoleColumnWidth(const QByteArray& role,
int index,
- const KItemListView* view) const;
+ const KItemListView* view) const Q_DECL_OVERRIDE;
protected:
/**
* @return The value of the "text" role. The default implementation returns
@@ -83,7 +83,7 @@ protected:
/**
* @brief Itemlist widget implementation for KStandardItemView and KStandardItemModel.
*/
-class LIBDOLPHINPRIVATE_EXPORT KStandardItemListWidget : public KItemListWidget
+class DOLPHIN_EXPORT KStandardItemListWidget : public KItemListWidget
{
Q_OBJECT
@@ -106,13 +106,13 @@ public:
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
- virtual QRectF iconRect() const;
- virtual QRectF textRect() const;
- virtual QRectF textFocusRect() const;
- virtual QRectF selectionRect() const;
- virtual QRectF expansionToggleRect() const;
- virtual QRectF selectionToggleRect() const;
- virtual QPixmap createDragPixmap(const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual QRectF iconRect() const Q_DECL_OVERRIDE;
+ virtual QRectF textRect() const Q_DECL_OVERRIDE;
+ virtual QRectF textFocusRect() const Q_DECL_OVERRIDE;
+ virtual QRectF selectionRect() const Q_DECL_OVERRIDE;
+ virtual QRectF expansionToggleRect() const Q_DECL_OVERRIDE;
+ virtual QRectF selectionToggleRect() const Q_DECL_OVERRIDE;
+ virtual QPixmap createDragPixmap(const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE;
static KItemListWidgetInformant* createInformant();
@@ -172,17 +172,17 @@ protected:
*/
virtual int selectionLength(const QString& text) const;
- virtual void dataChanged(const QHash<QByteArray, QVariant>& current, const QSet<QByteArray>& roles = QSet<QByteArray>());
- virtual void visibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous);
- virtual void columnWidthChanged(const QByteArray& role, qreal current, qreal previous);
- virtual void styleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous);
- virtual void hoveredChanged(bool hovered);
- virtual void selectedChanged(bool selected);
- virtual void siblingsInformationChanged(const QBitArray& current, const QBitArray& previous);
- virtual void editedRoleChanged(const QByteArray& current, const QByteArray& previous);
- virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
- virtual void showEvent(QShowEvent* event);
- virtual void hideEvent(QHideEvent* event);
+ virtual void dataChanged(const QHash<QByteArray, QVariant>& current, const QSet<QByteArray>& roles = QSet<QByteArray>()) Q_DECL_OVERRIDE;
+ virtual void visibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous) Q_DECL_OVERRIDE;
+ virtual void columnWidthChanged(const QByteArray& role, qreal current, qreal previous) Q_DECL_OVERRIDE;
+ virtual void styleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous) Q_DECL_OVERRIDE;
+ virtual void hoveredChanged(bool hovered) Q_DECL_OVERRIDE;
+ virtual void selectedChanged(bool selected) Q_DECL_OVERRIDE;
+ virtual void siblingsInformationChanged(const QBitArray& current, const QBitArray& previous) Q_DECL_OVERRIDE;
+ virtual void editedRoleChanged(const QByteArray& current, const QByteArray& previous) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE;
+ virtual void showEvent(QShowEvent* event) Q_DECL_OVERRIDE;
+ virtual void hideEvent(QHideEvent* event) Q_DECL_OVERRIDE;
private slots:
void slotCutItemsChanged();
@@ -274,5 +274,3 @@ private:
};
#endif
-
-
diff --git a/src/kitemviews/kstandarditemmodel.cpp b/src/kitemviews/kstandarditemmodel.cpp
index e8c1b6204..25288e50f 100644
--- a/src/kitemviews/kstandarditemmodel.cpp
+++ b/src/kitemviews/kstandarditemmodel.cpp
@@ -19,9 +19,9 @@
#include "kstandarditemmodel.h"
-#include <KDebug>
#include "kstandarditem.h"
-
+#include <QSet>
+#include <QByteArray>
KStandardItemModel::KStandardItemModel(QObject* parent) :
KItemModelBase(parent),
m_items(),
@@ -237,5 +237,3 @@ void KStandardItemModel::onItemRemoved(int index, KStandardItem* removedItem)
Q_UNUSED(removedItem);
}
-
-#include "kstandarditemmodel.moc"
diff --git a/src/kitemviews/kstandarditemmodel.h b/src/kitemviews/kstandarditemmodel.h
index 721e15529..58c5a5d88 100644
--- a/src/kitemviews/kstandarditemmodel.h
+++ b/src/kitemviews/kstandarditemmodel.h
@@ -20,7 +20,7 @@
#ifndef KSTANDARDITEMMODEL_H
#define KSTANDARDITEMMODEL_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemmodelbase.h>
#include <QHash>
#include <QList>
@@ -35,7 +35,7 @@ class KStandardItem;
*
* @see KStandardItem
*/
-class LIBDOLPHINPRIVATE_EXPORT KStandardItemModel : public KItemModelBase
+class DOLPHIN_EXPORT KStandardItemModel : public KItemModelBase
{
Q_OBJECT
@@ -69,14 +69,14 @@ public:
*/
void appendItem(KStandardItem* item);
- virtual int count() const;
- virtual QHash<QByteArray, QVariant> data(int index) const;
- virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
- virtual QMimeData* createMimeData(const KItemSet& indexes) const;
- virtual int indexForKeyboardSearch(const QString& text, int startFromIndex = 0) const;
- virtual bool supportsDropping(int index) const;
- virtual QString roleDescription(const QByteArray& role) const;
- virtual QList<QPair<int, QVariant> > groups() const;
+ virtual int count() const Q_DECL_OVERRIDE;
+ virtual QHash<QByteArray, QVariant> data(int index) const Q_DECL_OVERRIDE;
+ virtual bool setData(int index, const QHash<QByteArray, QVariant>& values) Q_DECL_OVERRIDE;
+ virtual QMimeData* createMimeData(const KItemSet& indexes) const Q_DECL_OVERRIDE;
+ virtual int indexForKeyboardSearch(const QString& text, int startFromIndex = 0) const Q_DECL_OVERRIDE;
+ virtual bool supportsDropping(int index) const Q_DECL_OVERRIDE;
+ virtual QString roleDescription(const QByteArray& role) const Q_DECL_OVERRIDE;
+ virtual QList<QPair<int, QVariant> > groups() const Q_DECL_OVERRIDE;
virtual void clear();
protected:
diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp
index c0ae0c544..920ce0671 100644
--- a/src/kitemviews/private/kbaloorolesprovider.cpp
+++ b/src/kitemviews/private/kbaloorolesprovider.cpp
@@ -20,12 +20,12 @@
#include "kbaloorolesprovider.h"
-#include <KDebug>
-#include <KGlobal>
-#include <KLocale>
+#include <QDebug>
+#include <KLocalizedString>
-#include <baloo/file.h>
-#include <kfilemetadata/propertyinfo.h>
+#include <Baloo/File>
+#include <KFileMetaData/PropertyInfo>
+#include <KFileMetaData/UserMetaData>
#include <QTime>
#include <QMap>
@@ -34,7 +34,7 @@ struct KBalooRolesProviderSingleton
{
KBalooRolesProvider instance;
};
-K_GLOBAL_STATIC(KBalooRolesProviderSingleton, s_balooRolesProvider)
+Q_GLOBAL_STATIC(KBalooRolesProviderSingleton, s_balooRolesProvider)
KBalooRolesProvider& KBalooRolesProvider::instance()
@@ -99,14 +99,15 @@ QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const Baloo::File& f
}
}
+ KFileMetaData::UserMetaData md(file.path());
if (roles.contains("tags")) {
- values.insert("tags", tagsFromValues(file.tags()));
+ values.insert("tags", tagsFromValues(md.tags()));
}
if (roles.contains("rating")) {
- values.insert("rating", QString::number(file.rating()));
+ values.insert("rating", QString::number(md.rating()));
}
if (roles.contains("comment")) {
- values.insert("comment", file.userComment());
+ values.insert("comment", md.userComment());
}
return values;
diff --git a/src/kitemviews/private/kbaloorolesprovider.h b/src/kitemviews/private/kbaloorolesprovider.h
index f1ad5c740..9673bff4f 100644
--- a/src/kitemviews/private/kbaloorolesprovider.h
+++ b/src/kitemviews/private/kbaloorolesprovider.h
@@ -21,12 +21,11 @@
#ifndef KBALOO_ROLESPROVIDER_H
#define KBALOO_ROLESPROVIDER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QHash>
#include <QSet>
-#include <QUrl>
-
+#include <QVariant>
namespace Baloo {
class File;
}
@@ -37,7 +36,7 @@ namespace Baloo {
* Is a helper class for KFileItemModelRolesUpdater to retrieve roles that
* are only accessible with Baloo.
*/
-class LIBDOLPHINPRIVATE_EXPORT KBalooRolesProvider
+class DOLPHIN_EXPORT KBalooRolesProvider
{
public:
static KBalooRolesProvider& instance();
diff --git a/src/kitemviews/private/kdirectorycontentscounter.cpp b/src/kitemviews/private/kdirectorycontentscounter.cpp
index 7d1e76999..af7312ad2 100644
--- a/src/kitemviews/private/kdirectorycontentscounter.cpp
+++ b/src/kitemviews/private/kdirectorycontentscounter.cpp
@@ -35,8 +35,8 @@ KDirectoryContentsCounter::KDirectoryContentsCounter(KFileItemModel* model, QObj
m_dirWatcher(0),
m_watchedDirs()
{
- connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved()));
+ connect(m_model, &KFileItemModel::itemsRemoved,
+ this, &KDirectoryContentsCounter::slotItemsRemoved);
if (!m_workerThread) {
m_workerThread = new QThread();
@@ -47,13 +47,13 @@ KDirectoryContentsCounter::KDirectoryContentsCounter(KFileItemModel* model, QObj
m_worker->moveToThread(m_workerThread);
++m_workersCount;
- connect(this, SIGNAL(requestDirectoryContentsCount(QString,KDirectoryContentsCounterWorker::Options)),
- m_worker, SLOT(countDirectoryContents(QString,KDirectoryContentsCounterWorker::Options)));
- connect(m_worker, SIGNAL(result(QString,int)),
- this, SLOT(slotResult(QString,int)));
+ connect(this, &KDirectoryContentsCounter::requestDirectoryContentsCount,
+ m_worker, &KDirectoryContentsCounterWorker::countDirectoryContents);
+ connect(m_worker, &KDirectoryContentsCounterWorker::result,
+ this, &KDirectoryContentsCounter::slotResult);
m_dirWatcher = new KDirWatch(this);
- connect(m_dirWatcher, SIGNAL(dirty(QString)), this, SLOT(slotDirWatchDirty(QString)));
+ connect(m_dirWatcher, &KDirWatch::dirty, this, &KDirectoryContentsCounter::slotDirWatchDirty);
}
KDirectoryContentsCounter::~KDirectoryContentsCounter()
@@ -122,7 +122,7 @@ void KDirectoryContentsCounter::slotResult(const QString& path, int count)
void KDirectoryContentsCounter::slotDirWatchDirty(const QString& path)
{
- const int index = m_model->index(KUrl(path));
+ const int index = m_model->index(QUrl::fromLocalFile(path));
if (index >= 0) {
if (!m_model->fileItem(index).isDir()) {
// If INotify is used, KDirWatch issues the dirty() signal
@@ -151,7 +151,7 @@ void KDirectoryContentsCounter::slotItemsRemoved()
QMutableSetIterator<QString> it(m_watchedDirs);
while (it.hasNext()) {
const QString& path = it.next();
- if (m_model->index(KUrl(path)) < 0) {
+ if (m_model->index(QUrl::fromLocalFile(path)) < 0) {
m_dirWatcher->removeDir(path);
it.remove();
}
@@ -181,4 +181,4 @@ void KDirectoryContentsCounter::startWorker(const QString& path)
}
QThread* KDirectoryContentsCounter::m_workerThread = 0;
-int KDirectoryContentsCounter::m_workersCount = 0; \ No newline at end of file
+int KDirectoryContentsCounter::m_workersCount = 0;
diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.h b/src/kitemviews/private/kdirectorycontentscounterworker.h
index 96831ef81..b2e31ef0f 100644
--- a/src/kitemviews/private/kdirectorycontentscounterworker.h
+++ b/src/kitemviews/private/kdirectorycontentscounterworker.h
@@ -20,7 +20,6 @@
#ifndef KDIRECTORYCONTENTENTSCOUNTERWORKER_H
#define KDIRECTORYCONTENTENTSCOUNTERWORKER_H
-#include <QFlags>
#include <QMetaType>
#include <QObject>
diff --git a/src/kitemviews/private/kfileitemclipboard.cpp b/src/kitemviews/private/kfileitemclipboard.cpp
index 0dcc81f4f..e12767853 100644
--- a/src/kitemviews/private/kfileitemclipboard.cpp
+++ b/src/kitemviews/private/kfileitemclipboard.cpp
@@ -19,17 +19,17 @@
#include "kfileitemclipboard.h"
-#include <KGlobal>
#include <QApplication>
#include <QClipboard>
#include <QMimeData>
+#include <KUrlMimeData>
class KFileItemClipboardSingleton
{
public:
KFileItemClipboard instance;
};
-K_GLOBAL_STATIC(KFileItemClipboardSingleton, s_KFileItemClipboard)
+Q_GLOBAL_STATIC(KFileItemClipboardSingleton, s_KFileItemClipboard)
@@ -38,12 +38,12 @@ KFileItemClipboard* KFileItemClipboard::instance()
return &s_KFileItemClipboard->instance;
}
-bool KFileItemClipboard::isCut(const KUrl& url) const
+bool KFileItemClipboard::isCut(const QUrl& url) const
{
return m_cutItems.contains(url);
}
-QList<KUrl> KFileItemClipboard::cutItems() const
+QList<QUrl> KFileItemClipboard::cutItems() const
{
return m_cutItems.toList();
}
@@ -66,7 +66,7 @@ void KFileItemClipboard::updateCutItems()
const QByteArray data = mimeData->data("application/x-kde-cutselection");
const bool isCutSelection = (!data.isEmpty() && data.at(0) == QLatin1Char('1'));
if (isCutSelection) {
- m_cutItems = KUrl::List::fromMimeData(mimeData).toSet();
+ m_cutItems = KUrlMimeData::urlsFromMimeData(mimeData).toSet();
} else {
m_cutItems.clear();
}
@@ -79,8 +79,6 @@ KFileItemClipboard::KFileItemClipboard() :
{
updateCutItems();
- connect(QApplication::clipboard(), SIGNAL(dataChanged()),
- this, SLOT(updateCutItems()));
+ connect(QApplication::clipboard(), &QClipboard::dataChanged,
+ this, &KFileItemClipboard::updateCutItems);
}
-
-#include "kfileitemclipboard.moc"
diff --git a/src/kitemviews/private/kfileitemclipboard.h b/src/kitemviews/private/kfileitemclipboard.h
index 86eb8e9fc..3ee50d661 100644
--- a/src/kitemviews/private/kfileitemclipboard.h
+++ b/src/kitemviews/private/kfileitemclipboard.h
@@ -20,27 +20,27 @@
#ifndef KFILEITEMCLIPBOARD_H
#define KFILEITEMCLIPBOARD_H
-#include <KUrl>
+#include <QUrl>
#include <QList>
#include <QSet>
#include <QObject>
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
/**
* @brief Wrapper for QClipboard to provide fast access for checking
* whether a KFileItem has been clipped.
*/
-class LIBDOLPHINPRIVATE_EXPORT KFileItemClipboard : public QObject
+class DOLPHIN_EXPORT KFileItemClipboard : public QObject
{
Q_OBJECT
public:
static KFileItemClipboard* instance();
- bool isCut(const KUrl& url) const;
+ bool isCut(const QUrl& url) const;
- QList<KUrl> cutItems() const;
+ QList<QUrl> cutItems() const;
signals:
void cutItemsChanged();
@@ -54,7 +54,7 @@ private slots:
private:
KFileItemClipboard();
- QSet<KUrl> m_cutItems;
+ QSet<QUrl> m_cutItems;
friend class KFileItemClipboardSingleton;
};
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.cpp b/src/kitemviews/private/kfileitemmodeldirlister.cpp
index 3d36386a9..778625573 100644
--- a/src/kitemviews/private/kfileitemmodeldirlister.cpp
+++ b/src/kitemviews/private/kfileitemmodeldirlister.cpp
@@ -18,8 +18,8 @@
***************************************************************************/
#include "kfileitemmodeldirlister.h"
-#include <KLocale>
-#include <KIO/JobClasses>
+#include <KLocalizedString>
+#include <KIO/Job>
KFileItemModelDirLister::KFileItemModelDirLister(QObject* parent) :
KDirLister(parent)
@@ -45,4 +45,3 @@ void KFileItemModelDirLister::handleError(KIO::Job* job)
}
}
-#include "kfileitemmodeldirlister.moc"
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h
index 688ee9c5b..c2c621aed 100644
--- a/src/kitemviews/private/kfileitemmodeldirlister.h
+++ b/src/kitemviews/private/kfileitemmodeldirlister.h
@@ -20,15 +20,16 @@
#ifndef KFILEITEMMODELDIRLISTER_H
#define KFILEITEMMODELDIRLISTER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <KDirLister>
+#include <QUrl>
/**
* @brief Extends the class KDirLister by emitting a signal when an
* error occurred instead of showing an error dialog.
* KDirLister::autoErrorHandlingEnabled() is set to false.
*/
-class LIBDOLPHINPRIVATE_EXPORT KFileItemModelDirLister : public KDirLister
+class DOLPHIN_EXPORT KFileItemModelDirLister : public KDirLister
{
Q_OBJECT
@@ -44,7 +45,7 @@ signals:
* Is emitted when the URL of the directory lister represents a file.
* In this case no signal errorMessage() will be emitted.
*/
- void urlIsFileError(const KUrl& url);
+ void urlIsFileError(const QUrl& url);
protected:
virtual void handleError(KIO::Job* job);
diff --git a/src/kitemviews/private/kfileitemmodelfilter.h b/src/kitemviews/private/kfileitemmodelfilter.h
index e4fb0a2ee..67c1c280c 100644
--- a/src/kitemviews/private/kfileitemmodelfilter.h
+++ b/src/kitemviews/private/kfileitemmodelfilter.h
@@ -21,7 +21,7 @@
#ifndef KFILEITEMMODELFILTER_H
#define KFILEITEMMODELFILTER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QStringList>
class KFileItem;
@@ -35,7 +35,7 @@ class QRegExp;
* property of the KFileItem, but this might get extended in
* future.
*/
-class LIBDOLPHINPRIVATE_EXPORT KFileItemModelFilter
+class DOLPHIN_EXPORT KFileItemModelFilter
{
public:
diff --git a/src/kitemviews/private/kfileitemmodelsortalgorithm.h b/src/kitemviews/private/kfileitemmodelsortalgorithm.h
index 1d5689432..50db9900d 100644
--- a/src/kitemviews/private/kfileitemmodelsortalgorithm.h
+++ b/src/kitemviews/private/kfileitemmodelsortalgorithm.h
@@ -22,7 +22,7 @@
#ifndef KFILEITEMMODELSORTALGORITHM_H
#define KFILEITEMMODELSORTALGORITHM_H
-#include <QtCore>
+#include <QtConcurrent/QtConcurrent>
#include <algorithm>
diff --git a/src/kitemviews/private/kitemlistheaderwidget.cpp b/src/kitemviews/private/kitemlistheaderwidget.cpp
index 1f210ab5a..45ce4e759 100644
--- a/src/kitemviews/private/kitemlistheaderwidget.cpp
+++ b/src/kitemviews/private/kitemlistheaderwidget.cpp
@@ -19,8 +19,6 @@
#include "kitemlistheaderwidget.h"
-#include <KAction>
-#include <KMenu>
#include <kitemviews/kitemmodelbase.h>
#include <QApplication>
@@ -28,7 +26,6 @@
#include <QPainter>
#include <QStyleOptionHeader>
-#include <KDebug>
KItemListHeaderWidget::KItemListHeaderWidget(QGraphicsWidget* parent) :
QGraphicsWidget(parent),
@@ -62,19 +59,19 @@ void KItemListHeaderWidget::setModel(KItemModelBase* model)
}
if (m_model) {
- disconnect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
- disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
+ disconnect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListHeaderWidget::slotSortRoleChanged);
+ disconnect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListHeaderWidget::slotSortOrderChanged);
}
m_model = model;
if (m_model) {
- connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
- connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
+ connect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListHeaderWidget::slotSortRoleChanged);
+ connect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListHeaderWidget::slotSortOrderChanged);
}
}
@@ -569,4 +566,3 @@ qreal KItemListHeaderWidget::roleXPosition(const QByteArray& role) const
return -1;
}
-#include "kitemlistheaderwidget.moc"
diff --git a/src/kitemviews/private/kitemlistheaderwidget.h b/src/kitemviews/private/kitemlistheaderwidget.h
index b99f45f35..307def74d 100644
--- a/src/kitemviews/private/kitemlistheaderwidget.h
+++ b/src/kitemviews/private/kitemlistheaderwidget.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTHEADERWIDGET_H
#define KITEMLISTHEADERWIDGET_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QGraphicsWidget>
#include <QHash>
#include <QList>
@@ -33,7 +33,7 @@ class KItemModelBase;
* The widget is an internal API, the user of KItemListView may only access the
* class KItemListHeader.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListHeaderWidget : public QGraphicsWidget
+class DOLPHIN_EXPORT KItemListHeaderWidget : public QGraphicsWidget
{
Q_OBJECT
diff --git a/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp b/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp
index 3bd1b01f3..ffa92a1cf 100644
--- a/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp
+++ b/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp
@@ -22,8 +22,6 @@
#include "kitemlistkeyboardsearchmanager.h"
-#include <QApplication>
-#include <QElapsedTimer>
KItemListKeyboardSearchManager::KItemListKeyboardSearchManager(QObject* parent) :
QObject(parent),
diff --git a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h
index 661178db8..2a14ca470 100644
--- a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h
+++ b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h
@@ -23,7 +23,7 @@
#ifndef KITEMLISTKEYBOARDSEARCHMANAGER_H
#define KITEMLISTKEYBOARDSEARCHMANAGER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QObject>
#include <QString>
@@ -35,7 +35,7 @@
* @see KItemListController
* @see KItemModelBase
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListKeyboardSearchManager : public QObject
+class DOLPHIN_EXPORT KItemListKeyboardSearchManager : public QObject
{
Q_OBJECT
diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp
index 0a48f1ba0..5ff013429 100644
--- a/src/kitemviews/private/kitemlistroleeditor.cpp
+++ b/src/kitemviews/private/kitemlistroleeditor.cpp
@@ -19,8 +19,7 @@
#include "kitemlistroleeditor.h"
-#include <KDebug>
-#include <kio/global.h>
+#include <KIO/Global>
#include <QKeyEvent>
KItemListRoleEditor::KItemListRoleEditor(QWidget *parent) :
@@ -38,7 +37,7 @@ KItemListRoleEditor::KItemListRoleEditor(QWidget *parent) :
parent->installEventFilter(this);
}
- connect(this, SIGNAL(textChanged()), this, SLOT(autoAdjustSize()));
+ connect(this, &KItemListRoleEditor::textChanged, this, &KItemListRoleEditor::autoAdjustSize);
}
KItemListRoleEditor::~KItemListRoleEditor()
@@ -148,4 +147,3 @@ void KItemListRoleEditor::emitRoleEditingFinished()
}
}
-#include "kitemlistroleeditor.moc"
diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h
index 7c2b61e2d..3b8f96865 100644
--- a/src/kitemviews/private/kitemlistroleeditor.h
+++ b/src/kitemviews/private/kitemlistroleeditor.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTROLEEDITOR_H
#define KITEMLISTROLEEDITOR_H
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
#include <KTextEdit>
@@ -33,7 +33,7 @@
*
* The size automatically gets increased if the text does not fit.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListRoleEditor : public KTextEdit
+class DOLPHIN_EXPORT KItemListRoleEditor : public KTextEdit
{
Q_OBJECT
diff --git a/src/kitemviews/private/kitemlistrubberband.cpp b/src/kitemviews/private/kitemlistrubberband.cpp
index 58567c460..702873126 100644
--- a/src/kitemviews/private/kitemlistrubberband.cpp
+++ b/src/kitemviews/private/kitemlistrubberband.cpp
@@ -88,4 +88,3 @@ bool KItemListRubberBand::isActive() const
return m_active;
}
-#include "kitemlistrubberband.moc"
diff --git a/src/kitemviews/private/kitemlistrubberband.h b/src/kitemviews/private/kitemlistrubberband.h
index aea58af46..b47c30c1f 100644
--- a/src/kitemviews/private/kitemlistrubberband.h
+++ b/src/kitemviews/private/kitemlistrubberband.h
@@ -20,14 +20,14 @@
#ifndef KITEMLISTRUBBERBAND_H
#define KITEMLISTRUBBERBAND_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QObject>
#include <QPointF>
/**
* @brief Manages the rubberband when selecting items.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListRubberBand : public QObject
+class DOLPHIN_EXPORT KItemListRubberBand : public QObject
{
Q_OBJECT
diff --git a/src/kitemviews/private/kitemlistselectiontoggle.cpp b/src/kitemviews/private/kitemlistselectiontoggle.cpp
index accbe5181..d4081a690 100644
--- a/src/kitemviews/private/kitemlistselectiontoggle.cpp
+++ b/src/kitemviews/private/kitemlistselectiontoggle.cpp
@@ -19,11 +19,9 @@
#include "kitemlistselectiontoggle.h"
-#include <KIconEffect>
#include <KIconLoader>
#include <QPainter>
-#include <KDebug>
KItemListSelectionToggle::KItemListSelectionToggle(QGraphicsItem* parent) :
QGraphicsWidget(parent, 0),
@@ -115,4 +113,3 @@ int KItemListSelectionToggle::iconSize() const
return iconSize;
}
-#include "kitemlistselectiontoggle.moc"
diff --git a/src/kitemviews/private/kitemlistselectiontoggle.h b/src/kitemviews/private/kitemlistselectiontoggle.h
index 758dc63bb..d058ee988 100644
--- a/src/kitemviews/private/kitemlistselectiontoggle.h
+++ b/src/kitemviews/private/kitemlistselectiontoggle.h
@@ -20,17 +20,16 @@
#ifndef KITEMLISTSELECTIONTOGGLE_H
#define KITEMLISTSELECTIONTOGGLE_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QGraphicsWidget>
#include <QPixmap>
-class QPropertyAnimation;
/**
* @brief Allows to toggle between the selected and unselected state of an item.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListSelectionToggle : public QGraphicsWidget
+class DOLPHIN_EXPORT KItemListSelectionToggle : public QGraphicsWidget
{
Q_OBJECT
diff --git a/src/kitemviews/private/kitemlistsizehintresolver.h b/src/kitemviews/private/kitemlistsizehintresolver.h
index a0ad033f3..ff17f2de2 100644
--- a/src/kitemviews/private/kitemlistsizehintresolver.h
+++ b/src/kitemviews/private/kitemlistsizehintresolver.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTSIZEHINTRESOLVER_H
#define KITEMLISTSIZEHINTRESOLVER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <kitemviews/kitemmodelbase.h>
#include <QSizeF>
@@ -31,7 +31,7 @@ class KItemListView;
/**
* @brief Calculates and caches the sizehints of items in KItemListView.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListSizeHintResolver
+class DOLPHIN_EXPORT KItemListSizeHintResolver
{
public:
KItemListSizeHintResolver(const KItemListView* itemListView);
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index 491461b80..e70f47890 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.cpp
+++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp
@@ -19,13 +19,11 @@
#include "kitemlistsmoothscroller.h"
-#include <KGlobalSettings>
#include <QEvent>
#include <QPropertyAnimation>
#include <QScrollBar>
#include <QWheelEvent>
-
-#include <KDebug>
+#include <QStyle>
KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
QObject* parent) :
@@ -36,10 +34,10 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar,
m_animation(0)
{
m_animation = new QPropertyAnimation(this);
- const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 100;
+ const int duration = m_scrollBar->style()->styleHint(QStyle::SH_Widget_Animate, nullptr, m_scrollBar) ? 100 : 1;
m_animation->setDuration(duration);
- connect(m_animation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)),
- this, SLOT(slotAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ connect(m_animation, &QPropertyAnimation::stateChanged,
+ this, &KItemListSmoothScroller::slotAnimationStateChanged);
m_scrollBar->installEventFilter(this);
}
@@ -209,4 +207,3 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent* event)
event->accept();
}
-#include "kitemlistsmoothscroller.moc"
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h
index ea5682208..fca4b0c53 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.h
+++ b/src/kitemviews/private/kitemlistsmoothscroller.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTSMOOTHSCROLLER_H
#define KITEMLISTSMOOTHSCROLLER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QAbstractAnimation>
#include <QObject>
@@ -33,7 +33,7 @@ class QWheelEvent;
* @brief Helper class for KItemListContainer to have a smooth
* scrolling when adjusting the scrollbars.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListSmoothScroller : public QObject
+class DOLPHIN_EXPORT KItemListSmoothScroller : public QObject
{
Q_OBJECT
diff --git a/src/kitemviews/private/kitemlistviewanimation.cpp b/src/kitemviews/private/kitemlistviewanimation.cpp
index 5a00c8c3a..67ad192c6 100644
--- a/src/kitemviews/private/kitemlistviewanimation.cpp
+++ b/src/kitemviews/private/kitemlistviewanimation.cpp
@@ -21,22 +21,16 @@
#include <kitemviews/kitemlistview.h>
-#include <KDebug>
-#include <KGlobalSettings>
#include <QGraphicsWidget>
#include <QPropertyAnimation>
KItemListViewAnimation::KItemListViewAnimation(QObject* parent) :
QObject(parent),
- m_animationDuration(200),
m_scrollOrientation(Qt::Vertical),
m_scrollOffset(0),
m_animation()
{
- if (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) {
- m_animationDuration = 1;
- }
}
KItemListViewAnimation::~KItemListViewAnimation()
@@ -123,6 +117,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
stop(widget, type);
QPropertyAnimation* propertyAnim = 0;
+ const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animate) ? 200 : 1;
switch (type) {
case MovingAnimation: {
@@ -132,7 +127,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
}
propertyAnim = new QPropertyAnimation(widget, "pos");
- propertyAnim->setDuration(m_animationDuration);
+ propertyAnim->setDuration(animationDuration);
propertyAnim->setEndValue(newPos);
break;
}
@@ -140,7 +135,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
case CreateAnimation: {
propertyAnim = new QPropertyAnimation(widget, "opacity");
propertyAnim->setEasingCurve(QEasingCurve::InQuart);
- propertyAnim->setDuration(m_animationDuration);
+ propertyAnim->setDuration(animationDuration);
propertyAnim->setStartValue(0.0);
propertyAnim->setEndValue(1.0);
break;
@@ -149,7 +144,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
case DeleteAnimation: {
propertyAnim = new QPropertyAnimation(widget, "opacity");
propertyAnim->setEasingCurve(QEasingCurve::OutQuart);
- propertyAnim->setDuration(m_animationDuration);
+ propertyAnim->setDuration(animationDuration);
propertyAnim->setStartValue(1.0);
propertyAnim->setEndValue(0.0);
break;
@@ -162,7 +157,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
}
propertyAnim = new QPropertyAnimation(widget, "size");
- propertyAnim->setDuration(m_animationDuration);
+ propertyAnim->setDuration(animationDuration);
propertyAnim->setEndValue(newSize);
break;
}
@@ -172,7 +167,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type,
}
Q_ASSERT(propertyAnim);
- connect(propertyAnim, SIGNAL(finished()), this, SLOT(slotFinished()));
+ connect(propertyAnim, &QPropertyAnimation::finished, this, &KItemListViewAnimation::slotFinished);
m_animation[type].insert(widget, propertyAnim);
propertyAnim->start();
@@ -242,4 +237,3 @@ void KItemListViewAnimation::slotFinished()
Q_ASSERT(false);
}
-#include "kitemlistviewanimation.moc"
diff --git a/src/kitemviews/private/kitemlistviewanimation.h b/src/kitemviews/private/kitemlistviewanimation.h
index a3aceb0f5..06c81c9b8 100644
--- a/src/kitemviews/private/kitemlistviewanimation.h
+++ b/src/kitemviews/private/kitemlistviewanimation.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTVIEWANIMATION_H
#define KITEMLISTVIEWANIMATION_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QHash>
#include <QObject>
@@ -28,7 +28,6 @@
class KItemListView;
class QGraphicsWidget;
-class QPointF;
class QPropertyAnimation;
/**
@@ -37,7 +36,7 @@ class QPropertyAnimation;
* Supports item animations for moving, creating, deleting and resizing
* an item. Several applications can be applied to one item in parallel.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListViewAnimation : public QObject
+class DOLPHIN_EXPORT KItemListViewAnimation : public QObject
{
Q_OBJECT
@@ -95,7 +94,6 @@ private slots:
private:
enum { AnimationTypeCount = 4 };
- int m_animationDuration;
Qt::Orientation m_scrollOrientation;
qreal m_scrollOffset;
QHash<QGraphicsWidget*, QPropertyAnimation*> m_animation[AnimationTypeCount];
diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp
index 04325c7d0..d54457908 100644
--- a/src/kitemviews/private/kitemlistviewlayouter.cpp
+++ b/src/kitemviews/private/kitemlistviewlayouter.cpp
@@ -22,7 +22,7 @@
#include <kitemviews/kitemmodelbase.h>
#include "kitemlistsizehintresolver.h"
-#include <KDebug>
+#include "dolphindebug.h"
// #define KITEMLISTVIEWLAYOUTER_DEBUG
@@ -516,7 +516,7 @@ void KItemListViewLayouter::doLayout()
}
#ifdef KITEMLISTVIEWLAYOUTER_DEBUG
- kDebug() << "[TIME] doLayout() for " << m_model->count() << "items:" << timer.elapsed();
+ qCDebug(DolphinDebug) << "[TIME] doLayout() for " << m_model->count() << "items:" << timer.elapsed();
#endif
m_dirty = false;
}
@@ -621,4 +621,3 @@ qreal KItemListViewLayouter::minimumGroupHeaderWidth() const
return 100;
}
-#include "kitemlistviewlayouter.moc"
diff --git a/src/kitemviews/private/kitemlistviewlayouter.h b/src/kitemviews/private/kitemlistviewlayouter.h
index 0efcab12b..3f1cf68d4 100644
--- a/src/kitemviews/private/kitemlistviewlayouter.h
+++ b/src/kitemviews/private/kitemlistviewlayouter.h
@@ -20,7 +20,7 @@
#ifndef KITEMLISTVIEWLAYOUTER_H
#define KITEMLISTVIEWLAYOUTER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
#include <QObject>
#include <QRectF>
@@ -45,7 +45,7 @@ class KItemListSizeHintResolver;
* changing properties of the layouter is not expensive, only the
* first read of a property can get expensive.
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListViewLayouter : public QObject
+class DOLPHIN_EXPORT KItemListViewLayouter : public QObject
{
Q_OBJECT
diff --git a/src/kitemviews/private/kpixmapmodifier.cpp b/src/kitemviews/private/kpixmapmodifier.cpp
index 29aceb66b..c564ecc30 100644
--- a/src/kitemviews/private/kpixmapmodifier.cpp
+++ b/src/kitemviews/private/kpixmapmodifier.cpp
@@ -39,7 +39,6 @@
#include <QPixmap>
#include <QSize>
-#include <KDebug>
#include <config-X11.h> // for HAVE_XRENDER
#if defined(Q_WS_X11) && defined(HAVE_XRENDER)
diff --git a/src/kitemviews/private/kpixmapmodifier.h b/src/kitemviews/private/kpixmapmodifier.h
index 4f863c349..e8ca11ac1 100644
--- a/src/kitemviews/private/kpixmapmodifier.h
+++ b/src/kitemviews/private/kpixmapmodifier.h
@@ -20,12 +20,12 @@
#ifndef KPIXMAPMODIFIER_H
#define KPIXMAPMODIFIER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
class QPixmap;
class QSize;
-class LIBDOLPHINPRIVATE_EXPORT KPixmapModifier
+class DOLPHIN_EXPORT KPixmapModifier
{
public:
static void scale(QPixmap& pixmap, const QSize& scaledSize);