Commit 0b1caefa authored by David Faure's avatar David Faure

Implement "TODO: Qt 5: Use QDir::removeRecursively"

parent d8534b28
......@@ -243,29 +243,6 @@ bool FakeAkonadiServer::init()
return true;
}
bool FakeAkonadiServer::deleteDirectory(const QString &path)
{
// TODO: Qt 5: Use QDir::removeRecursively
Q_ASSERT(path.startsWith(basePath()));
QDir dir(path);
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
const QFileInfoList list = dir.entryInfoList();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).isDir() && !list.at(i).isSymLink()) {
deleteDirectory(list.at(i).absoluteFilePath());
const QDir tmpDir(list.at(i).absoluteDir());
tmpDir.rmdir(list.at(i).fileName());
} else {
QFile::remove(list.at(i).absoluteFilePath());
}
}
dir.cdUp();
dir.rmdir(path);
return true;
}
bool FakeAkonadiServer::quit()
{
qDebug() << "==== Fake Akonadi Server shutting down ====";
......@@ -277,8 +254,8 @@ bool FakeAkonadiServer::quit()
const QCommandLineParser &args = AkApplicationBase::instance()->commandLineArguments();
if (!args.isSet(QLatin1String("no-cleanup"))) {
deleteDirectory(basePath());
qDebug() << "Cleaned up" << basePath();
bool ok = QDir(basePath()).removeRecursively();
qDebug() << "Cleaned up" << basePath() << "success=" << ok;
} else {
qDebug() << "Skipping clean up of" << basePath();
}
......
......@@ -118,8 +118,6 @@ protected:
private:
explicit FakeAkonadiServer();
bool deleteDirectory(const QString &path);
FakeDataStore *mDataStore;
FakeSearchManager *mSearchManager;
FakeConnection *mConnection;
......
......@@ -400,6 +400,7 @@ void AgentBasePrivate::init()
mSettings->setValue(QStringLiteral("Agent/Name"), mName);
}
}
Q_ASSERT(mName != QLatin1String("IMAP E-Mail Server"));
connect(mChangeRecorder, &Monitor::itemAdded,
this, &AgentBasePrivate::itemAdded);
......@@ -1236,6 +1237,7 @@ QString AgentBase::identifier() const
void AgentBase::setAgentName(const QString &name)
{
Q_D(AgentBase);
Q_ASSERT(name != QLatin1String("IMAP E-Mail Server"));
if (name == d->mName) {
return;
}
......@@ -1261,8 +1263,10 @@ QString AgentBase::agentName() const
{
Q_D(const AgentBase);
if (d->mName.isEmpty()) {
Q_ASSERT(d->mId != QLatin1String("IMAP E-Mail Server"));
return d->mId;
} else {
Q_ASSERT(d->mName != QLatin1String("IMAP E-Mail Server"));
return d->mName;
}
}
......
......@@ -220,7 +220,7 @@ void ItemRetrievalManager::processRequest()
void ItemRetrievalManager::retrievalJobFinished(ItemRetrievalRequest *request, const QString &errorMsg)
{
qCDebug(AKONADISERVER_LOG) << "ItemRetrievalJob finished for request" << request << ", error:" << errorMsg;
qDebug() << "ItemRetrievalJob finished for request" << request << ", error:" << errorMsg;
mLock->lockForWrite();
request->errorMsg = errorMsg;
request->processed = true;
......
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