File indexing completed on 2024-04-28 15:22:09
0001 /* 0002 Test base class 0003 0004 SPDX-FileCopyrightText: 2002-2005 The Kopete developers <kopete-devel@kde.org> 0005 SPDX-FileCopyrightText: 2004 Richard Smith <kde@metafoo.co.uk> 0006 SPDX-FileCopyrightText: 2005 Duncan Mac-Vicar <duncan@kde.org> 0007 SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #ifndef AUTOTESTBASE_H 0013 #define AUTOTESTBASE_H 0014 0015 #include <QDebug> 0016 #include <QDir> 0017 0018 static bool copyTheme(const QString &dir, const QDir &baseThemeDir, const QString &themeName) 0019 { 0020 QDir sourceThemeDir(dir); 0021 if (!sourceThemeDir.exists()) { 0022 return false; 0023 } 0024 QDir themeDir(baseThemeDir.absolutePath() + QLatin1Char('/') + themeName); 0025 themeDir.removeRecursively(); 0026 themeDir.mkpath(QStringLiteral(".")); 0027 0028 const auto files = sourceThemeDir.entryList(QDir::Files); 0029 for (const QString &fileName : files) { 0030 if (!QFile::copy(sourceThemeDir.filePath(fileName), 0031 themeDir.filePath(fileName))) { 0032 qWarning() << "couldn't copy" << dir << "/" << fileName; 0033 return false; 0034 } 0035 } 0036 return true; 0037 } 0038 0039 #endif // AUTOTESTBASE_H