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:
parent
b6a6bb8e17
commit
9fc663d9f0
@ -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)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
void DialogNativeTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::enableTestMode(true);
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
m_cacheDir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
|
||||
m_cacheDir.removeRecursively();
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
void FrameSvgTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::enableTestMode(true);
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
m_cacheDir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
|
||||
m_cacheDir.removeRecursively();
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
void PlasmoidPackageTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::enableTestMode(true);
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
}
|
||||
|
||||
void PlasmoidPackageTest::init()
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 *);
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
@ -320,12 +320,12 @@ void StorageThread::expire(QPointer<StorageJob> wcaller, const QVariantMap ¶
|
||||
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();
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user