Changeset View
Changeset View
Standalone View
Standalone View
lgpl/generic/kpColorCollection.cpp
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | |||||
83 | 83 | | |||
84 | QStringList | 84 | QStringList | ||
85 | kpColorCollection::installedCollections() | 85 | kpColorCollection::installedCollections() | ||
86 | { | 86 | { | ||
87 | QStringList paletteList; | 87 | QStringList paletteList; | ||
88 | 88 | | |||
89 | QStringList paths = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, "colors", | 89 | QStringList paths = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, "colors", | ||
90 | QStandardPaths::LocateDirectory); | 90 | QStandardPaths::LocateDirectory); | ||
91 | foreach (const QString &path, paths) { | 91 | for (const auto &path : paths) { | ||
92 | paletteList.append(QDir(path).entryList(QStringList(), QDir::Files)); | 92 | paletteList.append(QDir(path).entryList(QStringList(), QDir::Files)); | ||
93 | } | 93 | } | ||
94 | 94 | | |||
95 | return paletteList; | 95 | return paletteList; | ||
96 | } | 96 | } | ||
97 | 97 | | |||
98 | kpColorCollection::kpColorCollection() | 98 | kpColorCollection::kpColorCollection() | ||
99 | { | 99 | { | ||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 248 | { | |||
250 | // Bug in KColorCollection too. | 250 | // Bug in KColorCollection too. | ||
251 | QTextStream str (device); | 251 | QTextStream str (device); | ||
252 | 252 | | |||
253 | QString description = d->desc.trimmed(); | 253 | QString description = d->desc.trimmed(); | ||
254 | description = '#'+description.split( '\n', QString::KeepEmptyParts).join("\n#"); | 254 | description = '#'+description.split( '\n', QString::KeepEmptyParts).join("\n#"); | ||
255 | 255 | | |||
256 | str << "KDE RGB Palette\n"; | 256 | str << "KDE RGB Palette\n"; | ||
257 | str << description << "\n"; | 257 | str << description << "\n"; | ||
258 | foreach (const ColorNode &node, d->colorList) | 258 | for (const auto &node : d->colorList) | ||
259 | { | 259 | { | ||
260 | // Added for KolourPaint. | 260 | // Added for KolourPaint. | ||
261 | if(!node.color.isValid ()) | 261 | if(!node.color.isValid ()) | ||
262 | continue; | 262 | continue; | ||
263 | 263 | | |||
264 | int r,g,b; | 264 | int r,g,b; | ||
265 | node.color.getRgb(&r, &g, &b); | 265 | node.color.getRgb(&r, &g, &b); | ||
266 | str << r << " " << g << " " << b << " " << node.name << "\n"; | 266 | str << r << " " << g << " " << b << " " << node.name << "\n"; | ||
Show All 30 Lines | 291 | const QString filename = url.toLocalFile (); | |||
297 | { | 297 | { | ||
298 | if (!atomicFileWriter.open (QIODevice::WriteOnly)) | 298 | if (!atomicFileWriter.open (QIODevice::WriteOnly)) | ||
299 | { | 299 | { | ||
300 | // We probably don't need this as <filename> has not been | 300 | // We probably don't need this as <filename> has not been | ||
301 | // opened. | 301 | // opened. | ||
302 | atomicFileWriter.cancelWriting (); | 302 | atomicFileWriter.cancelWriting (); | ||
303 | 303 | | |||
304 | qCDebug(kpLogMisc) << "\treturning false because could not open QSaveFile" | 304 | qCDebug(kpLogMisc) << "\treturning false because could not open QSaveFile" | ||
305 | << " error=" << atomicFileWriter.error () << endl; | 305 | << " error=" << atomicFileWriter.error (); | ||
306 | ::CouldNotSaveDialog (url, parent); | 306 | ::CouldNotSaveDialog (url, parent); | ||
307 | return false; | 307 | return false; | ||
308 | } | 308 | } | ||
309 | 309 | | |||
310 | // Write to local temporary file. | 310 | // Write to local temporary file. | ||
311 | ::SaveToFile (d, &atomicFileWriter); | 311 | ::SaveToFile (d, &atomicFileWriter); | ||
312 | 312 | | |||
313 | // Atomically overwrite local file with the temporary file | 313 | // Atomically overwrite local file with the temporary file | ||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |