Commit d860b5c9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to Q_EMIT + increase version

parent 3bcbc979
......@@ -8,11 +8,11 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(kfind VERSION ${RELEASE_SERVICE_VERSION})
set (KF5_MIN_VERSION "5.77.0")
set (KF5_MIN_VERSION "5.83.0")
# ECM setup
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(QT_REQUIRED_VERSION "5.14.0")
set(QT_REQUIRED_VERSION "5.15.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Concurrent)
include(KDEInstallDirs)
......
......@@ -15,8 +15,8 @@ ecm_add_app_icon(kfind_SRCS ICONS ${ICONS_SRCS})
add_executable(kfind ${kfind_SRCS})
target_link_libraries(kfind
Qt5::Concurrent
Qt5::Widgets
Qt::Concurrent
Qt::Widgets
KF5::Archive
KF5::CoreAddons
KF5::FileMetaData
......
......@@ -135,8 +135,8 @@ void KfindDlg::startSearch()
// Reset count - use the same i18n as below
setProgressMsg(i18n("0 items found"));
emit resultSelected(false);
emit haveResults(false);
Q_EMIT resultSelected(false);
Q_EMIT haveResults(false);
m_findButton->setEnabled(false); // Disable "Find"
m_stopButton->setEnabled(true); // Enable "Stop"
......@@ -155,7 +155,7 @@ void KfindDlg::startSearch()
// 1) addDir() keeps looping on recursive symlinks
// 2) addDir() scans all subdirectories, so it basically does the same as the process that
// is started by KQuery but in-process, undoing the advantages of using a separate find process
// A solution could be to let KQuery emit all the directories it has searched in.
// A solution could be to let KQuery Q_EMIT all the directories it has searched in.
// Either way, putting dirwatchers on a whole file system is probably just too much.
// 3) FAM has a tendency to deadlock with so many files (See BR77854) This has hopefully
// been fixed in KDirWatch, but that has not yet been confirmed.
......@@ -188,8 +188,8 @@ void KfindDlg::newSearch()
tabWidget->setDefaults();
emit haveResults(false);
emit resultSelected(false);
Q_EMIT haveResults(false);
Q_EMIT resultSelected(false);
setFocus();
}
......@@ -224,7 +224,7 @@ void KfindDlg::addFiles(const QList< QPair<KFileItem, QString> > &pairs)
win->insertItems(pairs);
if (!isResultReported) {
emit haveResults(true);
Q_EMIT haveResults(true);
isResultReported = true;
}
......
......@@ -184,7 +184,7 @@ QMimeData *KFindItemModel::mimeData(const QModelIndexList &indexes) const
{
QList<QUrl> uris;
foreach (const QModelIndex &index, indexes) {
for (const QModelIndex &index : indexes) {
if (index.isValid()) {
if (index.column() == 0) { //Only use the first column item
uris.append(m_itemList.at(index.row()).getFileItem().url());
......@@ -300,7 +300,7 @@ bool KFindSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn
KFindTreeView::KFindTreeView(QWidget *parent, KfindDlg *findDialog)
: QTreeView(parent)
, m_contextMenu(Q_NULLPTR)
, m_contextMenu(nullptr)
, m_kfindDialog(findDialog)
{
//Configure model and proxy model
......@@ -524,7 +524,7 @@ void KFindTreeView::slotExecuteSelected()
}
//TODO if >X add a warn ?
Q_FOREACH (const QModelIndex &index, selected) {
for (const QModelIndex &index : selected) {
if (index.column() == 0) {
KFindItem item = m_model->itemAtIndex(index);
if (item.isValid()) {
......@@ -566,7 +566,7 @@ void KFindTreeView::contextMenuRequested(const QPoint &p)
return;
}
Q_FOREACH (const QModelIndex &index, selected) {
for (const QModelIndex &index : selected) {
if (index.column() == 0) {
const KFindItem item = m_model->itemAtIndex(index);
if (item.isValid()) {
......@@ -612,7 +612,7 @@ QList<QUrl> KFindTreeView::selectedUrls()
QList<QUrl> uris;
const QModelIndexList indexes = m_proxyModel->mapSelectionToSource(selectionModel()->selection()).indexes();
Q_FOREACH (const QModelIndex &index, indexes) {
for (const QModelIndex &index : indexes) {
if (index.column() == 0 && index.isValid()) {
KFindItem item = m_model->itemAtIndex(index);
if (item.isValid()) {
......
......@@ -346,7 +346,7 @@ KfindTabWidget::KfindTabWidget(QWidget *parent)
MimeTypes mimeTypes;
const auto types = QMimeDatabase().allMimeTypes();
foreach (const QMimeType &type, types) {
for (const QMimeType &type : types) {
if ((!type.comment().isEmpty())
&& (!type.name().startsWith(QLatin1String("kdedevice/")))
&& (!type.name().startsWith(QLatin1String("all/")))) {
......
......@@ -172,22 +172,22 @@ void KQuery::checkEntries()
/* This is a workaround. As the qApp->processEvents() call inside processQuery
* will bring more KIO entries, m_fileItems will increase even inside this loop
* and that will lead to a big loop, it will take time to report found items to the GUI
* so we are going to force emit results every 100 files processed */
* so we are going to force Q_EMIT results every 100 files processed */
if (processingCount == 100) {
processingCount = 0;
if (m_foundFilesList.size() > 0) {
emit foundFileList(m_foundFilesList);
Q_EMIT foundFileList(m_foundFilesList);
m_foundFilesList.clear();
}
}
}
if (m_foundFilesList.size() > 0) {
emit foundFileList(m_foundFilesList);
Q_EMIT foundFileList(m_foundFilesList);
}
if (job == nullptr) {
emit result(m_result);
Q_EMIT result(m_result);
}
m_insideCheckEntries = false;
......@@ -208,7 +208,7 @@ void KQuery::slotListEntries(const QStringList &list)
}
if (!m_foundFilesList.isEmpty()) {
emit foundFileList(m_foundFilesList);
Q_EMIT foundFileList(m_foundFilesList);
}
}
......@@ -340,9 +340,9 @@ void KQuery::processQuery(const KFileItem &file)
QString strmetakeycontent;
KFileMetaData::ExtractorCollection extractors;
QList<KFileMetaData::Extractor*> exList = extractors.fetchExtractors(mimetype);
const QList<KFileMetaData::Extractor*> exList = extractors.fetchExtractors(mimetype);
Q_FOREACH (KFileMetaData::Extractor* ex, exList) {
for (KFileMetaData::Extractor* ex : exList) {
KFileMetaData::SimpleExtractionResult result(filename, mimetype,
KFileMetaData::ExtractionResult::ExtractMetaData);
ex->extract(&result);
......@@ -601,5 +601,5 @@ void KQuery::slotendProcessLocate(int code, QProcess::ExitStatus)
slotListEntries(str.split(QLatin1Char('\n'), Qt::SkipEmptyParts));
}
}
emit result(0);
Q_EMIT result(0);
}
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