Changeset View
Changeset View
Standalone View
Standalone View
src/qtquick/PeruseConfig.cpp
Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Line(s) | |||||
155 | QString PeruseConfig::homeDir() const | 155 | QString PeruseConfig::homeDir() const | ||
156 | { | 156 | { | ||
157 | return QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first(); | 157 | return QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first(); | ||
158 | } | 158 | } | ||
159 | 159 | | |||
160 | void PeruseConfig::setFilesystemProperty(QString fileName, QString propertyName, QString value) | 160 | void PeruseConfig::setFilesystemProperty(QString fileName, QString propertyName, QString value) | ||
161 | { | 161 | { | ||
162 | KFileMetaData::UserMetaData data(fileName); | 162 | KFileMetaData::UserMetaData data(fileName); | ||
163 | if (propertyName == "rating") { | ||||
164 | data.setRating(value.toInt()); | ||||
165 | } else if (propertyName == "tags") { | ||||
166 | data.setTags(value.split(",")); | ||||
167 | } else if (propertyName == "comment") { | ||||
168 | data.setUserComment(value); | ||||
169 | } else { | ||||
163 | data.setAttribute(QString("peruse.").append(propertyName), value); | 170 | data.setAttribute(QString("peruse.").append(propertyName), value); | ||
164 | } | 171 | } | ||
172 | } | ||||
173 | | ||||
174 | QString PeruseConfig::getFilesystemProperty(QString fileName, QString propertyName) | ||||
175 | { | ||||
176 | QString value; | ||||
177 | KFileMetaData::UserMetaData data(fileName); | ||||
178 | if (propertyName == "rating") { | ||||
179 | value = QString::number(data.rating()); | ||||
180 | } else if (propertyName == "tags") { | ||||
181 | value = data.tags().join(","); | ||||
182 | } else if (propertyName == "comment") { | ||||
183 | value = data.userComment(); | ||||
184 | } else { | ||||
185 | value = data.attribute(QString("peruse.").append(propertyName)); | ||||
186 | } | ||||
187 | return value; | ||||
188 | } |