Commit c8ee79a7 authored by Henrik Fehlauer's avatar Henrik Fehlauer Committed by Luigi Toscano

Port more deprecated functions and fix warnings

Summary:
KFileItem(mode, permissions, ...) is deprecated.
Port deprecated KRun::run to KRun:runService.
Replace deprecated std::auto_ptr with std::unique_ptr.
Add Q_DECL_OVERRIDE to MainWindow::eventFilter.

Depends on D5750
Depends on D5751

Test Plan: Tests pass.

Reviewers: ltoscano, sandsmark, gateau

Reviewed By: gateau

Differential Revision: https://phabricator.kde.org/D5752
parent 7dc3595d
......@@ -409,7 +409,7 @@ void FileOpsContextManagerItem::openWith(QAction* action)
}
Q_ASSERT(service);
KRun::run(*service, list, mGroup);
KRun::runService(*service, list, mGroup);
}
} // namespace
......@@ -78,7 +78,7 @@ public:
KIPIImageInfo(KIPI::Interface* interface, const QUrl &url)
: KIPI::ImageInfoShared(interface, url)
{
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item(url);
mAttributes.insert("name", url.fileName());
mAttributes.insert("comment", comment());
......
......@@ -78,7 +78,7 @@ protected:
virtual void resizeEvent(QResizeEvent*) Q_DECL_OVERRIDE;
virtual void saveProperties(KConfigGroup&) Q_DECL_OVERRIDE;
virtual void readProperties(const KConfigGroup&) Q_DECL_OVERRIDE;
bool eventFilter(QObject *, QEvent *);
bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
private Q_SLOTS:
void setActiveViewModeAction(QAction* action);
......
......@@ -146,7 +146,7 @@ public:
if (!service) {
qCritical() << "Could not find gwenview";
} else {
KRun::run(*service, {mThumbnailPage->destinationUrl()}, 0 /* window */);
KRun::runService(*service, {mThumbnailPage->destinationUrl()}, 0 /* window */);
}
}
......
......@@ -51,7 +51,7 @@ struct ImporterPrivate
{
Importer* q;
QWidget* mAuthWindow;
std::auto_ptr<FileNameFormater> mFileNameFormater;
std::unique_ptr<FileNameFormater> mFileNameFormater;
QUrl mTempImportDirUrl;
/* @defgroup reset Should be reset in start()
......@@ -112,7 +112,8 @@ struct ImporterPrivate
QUrl dst = src.resolved(QUrl(".."));
QString fileName;
if (mFileNameFormater.get()) {
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, src, true /* delayedMimeTypes */);
KFileItem item(src);
item.setDelayedMimeTypes(true);
// Get the document time, but do not cache the result because the
// 'src' url is temporary: if we import "foo/image.jpg" and
// "bar/image.jpg", both images will be temporarily saved in the
......
......@@ -46,7 +46,7 @@ private Q_SLOTS:
void testRenamedCount();
private:
std::auto_ptr<QTemporaryDir> mTempDir;
std::unique_ptr<QTemporaryDir> mTempDir;
QList<QUrl> mDocumentList;
};
......
......@@ -122,7 +122,7 @@ void ThumbnailProviderTest::testLoadLocal()
KFileItemList list;
Q_FOREACH(const QFileInfo & info, dir.entryInfoList(QDir::Files)) {
QUrl url("file://" + info.absoluteFilePath());
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item(url);
list << item;
}
......@@ -198,7 +198,7 @@ void ThumbnailProviderTest::testUseEmbeddedOrNot()
KFileItemList list;
QUrl url("file://" + QDir(sandBox.mPath).absoluteFilePath("embedded-thumbnail.jpg"));
list << KFileItem(KFileItem::Unknown, KFileItem::Unknown, url);
list << KFileItem(url);
// Loading a normal thumbnail should bring the white one
{
......@@ -239,7 +239,7 @@ void ThumbnailProviderTest::testLoadRemote()
url.setPath(url.path() + '/' + "test.png");
KFileItemList list;
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item(url);
list << item;
ThumbnailProvider provider;
......@@ -263,7 +263,7 @@ void ThumbnailProviderTest::testRemoveItemsWhileGenerating()
KFileItemList list;
Q_FOREACH(const QFileInfo & info, dir.entryInfoList(QDir::Files)) {
QUrl url("file://" + info.absoluteFilePath());
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item(url);
list << item;
}
......
......@@ -52,7 +52,7 @@ void TimeUtilsTest::testBasic_data()
NEW_ROW("date/exif-datetime-only.jpg", QDateTime::fromString("2003-03-25T02:02:21", Qt::ISODate));
QUrl url = urlForTestFile("test.png");
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item(url);
NEW_ROW("test.png", item.time(KFileItem::ModificationTime));
}
......@@ -62,7 +62,7 @@ void TimeUtilsTest::testBasic()
QFETCH(QDateTime, expectedDateTime);
QDateTime dateTime;
QUrl url = urlForTestFile(fileName);
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item(url);
dateTime = TimeUtils::dateTimeForFileItem(item);
QCOMPARE(dateTime, expectedDateTime);
......@@ -76,14 +76,14 @@ void TimeUtilsTest::testCache()
QTemporaryFile tempFile;
QVERIFY(tempFile.open());
QUrl url = QUrl::fromLocalFile(tempFile.fileName());
KFileItem item1(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item1(url);
QDateTime dateTime1 = TimeUtils::dateTimeForFileItem(item1);
QCOMPARE(dateTime1, item1.time(KFileItem::ModificationTime));
QTest::qWait(1200);
touchFile(url.toLocalFile());
KFileItem item2(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItem item2(url);
QDateTime dateTime2 = TimeUtils::dateTimeForFileItem(item2);
QVERIFY(dateTime1 != dateTime2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment