File indexing completed on 2024-12-01 08:18:36
0001 /*************************************************************************** 0002 * Copyright (C) 2023 by Friedrich W. H. Kossebau * 0003 * kossebau@kde.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #include "filefilters.h" 0012 0013 #if KIO_VERSION >= QT_VERSION_CHECK(5, 108, 0) 0014 0015 QString FileFilters::toQtStyleString() const 0016 { 0017 return toQtStyleStringList().join(QLatin1String(";;")); 0018 } 0019 0020 QStringList FileFilters::toQtStyleStringList() const 0021 { 0022 QStringList filters; 0023 for (const FileFilter &filter : *this) { 0024 filters.append(filter.name + QLatin1String(" (") + filter.patterns + QLatin1Char(')')); 0025 } 0026 return filters; 0027 } 0028 0029 #else 0030 0031 QString FileFilters::toQtStyleString() const 0032 { 0033 QStringList filters; 0034 for (const FileFilter &filter : *this) { 0035 filters.append(filter.name + QLatin1String(" (") + filter.patterns + QLatin1Char(')')); 0036 } 0037 return filters.join(QLatin1String(";;")); 0038 } 0039 0040 QString FileFilters::toKDEStyleString() const 0041 { 0042 QStringList filters; 0043 for (const FileFilter &filter : *this) { 0044 filters.append(filter.patterns + QLatin1Char('|') + filter.name); 0045 } 0046 return filters.join(QLatin1Char('\n')); 0047 } 0048 0049 #endif