equal
deleted
inserted
replaced
256 } |
256 } |
257 |
257 |
258 void HWChatWidget::saveList(QStringList & list, const QString & file) |
258 void HWChatWidget::saveList(QStringList & list, const QString & file) |
259 { |
259 { |
260 QFile txt(cfgdir->absolutePath() + "/" + file); |
260 QFile txt(cfgdir->absolutePath() + "/" + file); |
|
261 |
|
262 // list empty? => rather have no file for the list than an empty one |
|
263 if (list.isEmpty()) |
|
264 { |
|
265 if (txt.exists()) |
|
266 { |
|
267 // try to remove file, if successful we're done here. |
|
268 if (txt.remove()) |
|
269 return; |
|
270 } |
|
271 else |
|
272 // there is no file |
|
273 return; |
|
274 } |
|
275 |
261 if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate)) |
276 if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate)) |
262 return; |
277 return; |
263 QTextStream stream(&txt); |
278 QTextStream stream(&txt); |
264 stream.setCodec("UTF-8"); |
279 stream.setCodec("UTF-8"); |
265 |
280 |