Make it compiles without deprecated method

Summary: compile without deprecated method

Test Plan: all autotest ok

Reviewers: dfaure, apol

Reviewed By: apol

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19418
This commit is contained in:
Laurent Montel 2019-02-28 13:55:40 +01:00
parent b6a6bb8e17
commit 9fc663d9f0
18 changed files with 36 additions and 26 deletions

View File

@ -140,8 +140,7 @@ ecm_setup_qtplugin_macro_names(
CONFIG_CODE_VARIABLE
PACKAGE_SETUP_AUTOMOC_VARIABLES
)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050c00)
#add_definitions(-Wno-deprecated)

View File

@ -23,7 +23,7 @@
void DialogNativeTest::initTestCase()
{
QStandardPaths::enableTestMode(true);
QStandardPaths::setTestModeEnabled(true);
m_cacheDir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
m_cacheDir.removeRecursively();

View File

@ -24,7 +24,7 @@
void FrameSvgTest::initTestCase()
{
QStandardPaths::enableTestMode(true);
QStandardPaths::setTestModeEnabled(true);
m_cacheDir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
m_cacheDir.removeRecursively();

View File

@ -457,12 +457,12 @@ void ModelTest::data()
}
// General Purpose roles that should return a QColor
QVariant colorVariant = model->data(model->index(0, 0), Qt::BackgroundColorRole);
QVariant colorVariant = model->data(model->index(0, 0), Qt::BackgroundRole);
if (colorVariant.isValid()) {
Q_ASSERT(qVariantCanConvert<QColor> (colorVariant));
}
colorVariant = model->data(model->index(0, 0), Qt::TextColorRole);
colorVariant = model->data(model->index(0, 0), Qt::ForegroundRole);
if (colorVariant.isValid()) {
Q_ASSERT(qVariantCanConvert<QColor> (colorVariant));
}

View File

@ -33,7 +33,7 @@
void PlasmoidPackageTest::initTestCase()
{
QStandardPaths::enableTestMode(true);
QStandardPaths::setTestModeEnabled(true);
}
void PlasmoidPackageTest::init()

View File

@ -24,7 +24,7 @@
void StorageTest::initTestCase()
{
QStandardPaths::enableTestMode(true);
QStandardPaths::setTestModeEnabled(true);
m_data.insert(QStringLiteral("String 1"), "Fork");
m_data.insert(QStringLiteral("String 2"), "Spoon");

View File

@ -186,7 +186,7 @@ int Calendar::currentWeek() const
QString Calendar::dayName(int weekday) const
{
return QDate::shortDayName(weekday);
return QLocale::system().dayName(weekday, QLocale::ShortFormat);
}
QString Calendar::monthName() const

View File

@ -58,11 +58,15 @@ void SortFilterModel::syncRoleNames()
m_roleIds[QString::fromUtf8(i.value())] = i.key();
}
setRoleNames(sourceModel()->roleNames());
setFilterRole(m_filterRole);
setSortRole(m_sortRole);
}
QHash<int,QByteArray> SortFilterModel::roleNames() const
{
return sourceModel()->roleNames();
}
int SortFilterModel::roleNameToId(const QString &name) const
{
return m_roleIds.value(name, Qt::DisplayRole);
@ -419,8 +423,6 @@ void DataModel::setItems(const QString &sourceName, const QVariantList &list)
}
}
setRoleNames(m_roleNames);
if (firstRun) {
endResetModel();
} else if (delta > 0) {
@ -432,6 +434,11 @@ void DataModel::setItems(const QString &sourceName, const QVariantList &list)
createIndex(sourceIndex + qMin(list.length(), oldLength), 0));
}
QHash<int, QByteArray> DataModel::roleNames() const
{
return m_roleNames;
}
void DataModel::removeSource(const QString &sourceName)
{
//FIXME: find a way to remove only the proper things also in the case where sources are items

View File

@ -139,7 +139,8 @@ Q_SIGNALS:
protected:
int roleNameToId(const QString &name) const;
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
QHash<int, QByteArray> roleNames() const override;
protected Q_SLOTS:
void syncRoleNames();
@ -227,7 +228,7 @@ public:
protected:
void setItems(const QString &sourceName, const QVariantList &list);
inline int countItems() const;
QHash<int, QByteArray> roleNames() const override;
Q_SIGNALS:
void countChanged();
void sourceModelChanged(QObject *);

View File

@ -265,7 +265,7 @@ void Containment::restoreContents(KConfigGroup &group)
//restore the applets ordered by id
QStringList groups = applets.groupList();
qSort(groups.begin(), groups.end());
std::sort(groups.begin(), groups.end());
// Sort the applet configs in order of geometry to ensure that applets
// are added from left to right or top to bottom for a panel containment
@ -275,7 +275,7 @@ void Containment::restoreContents(KConfigGroup &group)
KConfigGroup appletConfig(&applets, appletGroup);
appletConfigs.append(appletConfig);
}
qStableSort(appletConfigs.begin(), appletConfigs.end(), appletConfigLessThan);
std::stable_sort(appletConfigs.begin(), appletConfigs.end(), appletConfigLessThan);
QMutableListIterator<KConfigGroup> it(appletConfigs);
while (it.hasNext()) {

View File

@ -599,7 +599,7 @@ QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &con
KConfigGroup containmentsGroup(&conf, "Containments");
QStringList groups = containmentsGroup.groupList();
qSort(groups.begin(), groups.end());
std::sort(groups.begin(), groups.end());
foreach (const QString &group, groups) {
KConfigGroup containmentConfig(&containmentsGroup, group);

View File

@ -320,12 +320,12 @@ void StorageThread::expire(QPointer<StorageJob> wcaller, const QVariantMap &para
if (valueGroup.isEmpty()) {
query.prepare(QStringLiteral("delete from ") + caller->clientName() + QStringLiteral(" where accessTime < :date"));
QDateTime time(QDateTime::currentDateTime().addSecs(-params[QStringLiteral("age")].toUInt()));
query.bindValue(QStringLiteral(":date"), time.toTime_t());
query.bindValue(QStringLiteral(":date"), time.toSecsSinceEpoch());
} else {
query.prepare(QStringLiteral("delete from ") + caller->clientName() + QStringLiteral(" where valueGroup=:valueGroup and accessTime < :date"));
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
QDateTime time(QDateTime::currentDateTime().addSecs(-params[QStringLiteral("age")].toUInt()));
query.bindValue(QStringLiteral(":date"), time.toTime_t());
query.bindValue(QStringLiteral(":date"), time.toSecsSinceEpoch());
}
const bool success = query.exec();

View File

@ -244,8 +244,8 @@ bool ThemePrivate::useCache()
const QFileInfo metadataFileInfo(themeMetadataPath);
const QFileInfo iconThemeMetadataFileInfo(iconThemeMetadataPath);
cachesTooOld = (cacheFileInfo.lastModified().toTime_t() < metadataFileInfo.lastModified().toTime_t()) ||
(cacheFileInfo.lastModified().toTime_t() < iconThemeMetadataFileInfo.lastModified().toTime_t());
cachesTooOld = (cacheFileInfo.lastModified().toSecsSinceEpoch() < metadataFileInfo.lastModified().toSecsSinceEpoch()) ||
(cacheFileInfo.lastModified().toSecsSinceEpoch() < iconThemeMetadataFileInfo.lastModified().toSecsSinceEpoch());
}
}

View File

@ -268,7 +268,7 @@ bool SvgPrivate::setImagePath(const QString &imagePath)
if (!themed) {
QFile f(actualPath);
QFileInfo info(f);
lastModified = info.lastModified().toTime_t();
lastModified = info.lastModified().toSecsSinceEpoch();
}
q->resize();

View File

@ -294,7 +294,7 @@ bool Theme::useGlobalSettings() const
bool Theme::findInCache(const QString &key, QPixmap &pix, unsigned int lastModified)
{
if (lastModified != 0 && d->useCache() && lastModified > uint(d->pixmapCache->lastModifiedTime().toTime_t())) {
if (lastModified != 0 && d->useCache() && lastModified > uint(d->pixmapCache->lastModifiedTime().toSecsSinceEpoch())) {
return false;
}

View File

@ -255,7 +255,7 @@ Qt::HANDLE DialogShadows::Private::createPixmap(const QPixmap &source)
_connection, XCB_IMAGE_FORMAT_Z_PIXMAP, pixmap, _gc,
image.width(), image.height(), 0, 0,
0, 32,
image.byteCount(), image.constBits());
image.sizeInBytes(), image.constBits());
return (Qt::HANDLE)pixmap;

View File

@ -688,7 +688,10 @@ QVariantList AppletInterface::availableScreenRegion() const
reg = applet()->containment()->corona()->availableScreenRegion(screenId);
}
foreach (QRect rect, reg.rects()) {
auto it = reg.begin();
const auto itEnd = reg.end();
for (; it != itEnd; ++it) {
QRect rect = *it;
//make it relative
QRect geometry = applet()->containment()->corona()->screenGeometry(screenId);
rect.moveTo(rect.topLeft() - geometry.topLeft());

View File

@ -987,7 +987,7 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
Plasma::Applet *applet = nullptr;
foreach (QObject *appletObject, m_appletInterfaces) {
if (AppletInterface *ai = qobject_cast<AppletInterface *>(appletObject)) {
if (ai->isVisible() && ai->contains(ai->mapFromItem(this, event->posF()))) {
if (ai->isVisible() && ai->contains(ai->mapFromItem(this, event->localPos()))) {
applet = ai->applet();
break;
} else {