summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Fehlauer <[email protected]>2017-05-15 00:35:54 +0200
committerLuigi Toscano <[email protected]>2017-05-15 00:51:20 +0200
commitc8ee79a76ab53c7793f2fb387b9e6eb887e60786 (patch)
tree4e716a4e276133e7e044498abc1cd56a9cca4b93
parent7dc3595d8c452f5342775e7daa83e39a0503ce6c (diff)
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
-rw-r--r--app/fileopscontextmanageritem.cpp2
-rw-r--r--app/kipiinterface.cpp2
-rw-r--r--app/mainwindow.h2
-rw-r--r--importer/importdialog.cpp2
-rw-r--r--importer/importer.cpp5
-rw-r--r--tests/auto/importertest.h2
-rw-r--r--tests/auto/thumbnailprovidertest.cpp8
-rw-r--r--tests/auto/timeutilstest.cpp8
8 files changed, 16 insertions, 15 deletions
diff --git a/app/fileopscontextmanageritem.cpp b/app/fileopscontextmanageritem.cpp
index 83ce7d9..8cda295 100644
--- a/app/fileopscontextmanageritem.cpp
+++ b/app/fileopscontextmanageritem.cpp
@@ -409,7 +409,7 @@ void FileOpsContextManagerItem::openWith(QAction* action)
}
Q_ASSERT(service);
- KRun::run(*service, list, mGroup);
+ KRun::runService(*service, list, mGroup);
}
} // namespace
diff --git a/app/kipiinterface.cpp b/app/kipiinterface.cpp
index 7bbc347..069d831 100644
--- a/app/kipiinterface.cpp
+++ b/app/kipiinterface.cpp
@@ -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());
diff --git a/app/mainwindow.h b/app/mainwindow.h
index 023a74e..967f972 100644
--- a/app/mainwindow.h
+++ b/app/mainwindow.h
@@ -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);
diff --git a/importer/importdialog.cpp b/importer/importdialog.cpp
index 5e9e847..808be48 100644
--- a/importer/importdialog.cpp
+++ b/importer/importdialog.cpp
@@ -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 */);
}
}
diff --git a/importer/importer.cpp b/importer/importer.cpp
index a7e1d4e..fa64982 100644
--- a/importer/importer.cpp
+++ b/importer/importer.cpp
@@ -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
diff --git a/tests/auto/importertest.h b/tests/auto/importertest.h
index 57ad615..e7732f4 100644
--- a/tests/auto/importertest.h
+++ b/tests/auto/importertest.h
@@ -46,7 +46,7 @@ private Q_SLOTS:
void testRenamedCount();
private:
- std::auto_ptr<QTemporaryDir> mTempDir;
+ std::unique_ptr<QTemporaryDir> mTempDir;
QList<QUrl> mDocumentList;
};
diff --git a/tests/auto/thumbnailprovidertest.cpp b/tests/auto/thumbnailprovidertest.cpp
index b194fad..363aeca 100644
--- a/tests/auto/thumbnailprovidertest.cpp
+++ b/tests/auto/thumbnailprovidertest.cpp
@@ -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;
}
diff --git a/tests/auto/timeutilstest.cpp b/tests/auto/timeutilstest.cpp
index 5b61cb0..93d81d2 100644
--- a/tests/auto/timeutilstest.cpp
+++ b/tests/auto/timeutilstest.cpp
@@ -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);