File indexing completed on 2024-12-15 05:02:05

0001 /*
0002     SPDX-FileCopyrightText: 2016 Ivan Čukić <ivan.cukic(at)kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "AbstractRunner.h"
0008 
0009 #include <QDebug>
0010 #include <QCoreApplication>
0011 
0012 AbstractRunner::AbstractRunner(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 AbstractRunner::~AbstractRunner()
0018 {
0019 }
0020 
0021 void AbstractRunner::reportNewResults(const ResultList &results)
0022 {
0023     Q_EMIT newResultsAppeared(results);
0024 
0025     yield();
0026 }
0027 
0028 void AbstractRunner::cancelQuery()
0029 {
0030     m_queryString.clear();
0031 }
0032 
0033 void AbstractRunner::runQuery(const QString &queryString)
0034 {
0035     if (m_queryString == queryString) return;
0036 
0037     if (!m_queryString.isEmpty()) {
0038         cancelQuery();
0039     }
0040 
0041     m_queryString = queryString;
0042 
0043     query();
0044 }
0045 
0046 QString AbstractRunner::queryString() const
0047 {
0048     return m_queryString;
0049 }
0050