Fix the issue of being unable to make secondary modifications to the config file
This commit is contained in:
parent
bd1e907277
commit
1861e6993e
|
@ -121,8 +121,9 @@ bool ConfigFileManager::modifyAccentColorConf(QColor accentcolor)
|
|||
file.close();
|
||||
|
||||
// 修改内容
|
||||
content.replace("accent=#3790FA", "accent="+colorString);
|
||||
|
||||
int startIndex = content.indexOf("accent=") + QString("accent=").size();
|
||||
content.remove(startIndex, 7);
|
||||
content.insert(startIndex, colorString);
|
||||
// 写入文件
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&file);
|
||||
|
@ -150,7 +151,13 @@ bool ConfigFileManager::modifyWallPaperConf(QString wallpaperpath)
|
|||
file.close();
|
||||
|
||||
// 修改内容
|
||||
content.replace("wallPaperPath=/usr/share/backgrounds/ubuntukylin-default-settings.jpg", "wallPaperPath="+wallpaperpath);
|
||||
int startIndex = content.indexOf("wallPaperPath=");
|
||||
if (startIndex != -1) {
|
||||
QString substr = "wallPaperPath="+wallpaperpath;
|
||||
content.replace(startIndex, content.indexOf('\n', startIndex) - startIndex, substr);
|
||||
}
|
||||
|
||||
qDebug() << content;
|
||||
|
||||
// 写入文件
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
|
|
Loading…
Reference in New Issue