variable renaming

master
Tibor 1 year ago
parent a6ad8e5b3b
commit 44cecabbf6
  1. 14
      config.cpp
  2. 2
      notehandler.cpp

@ -72,12 +72,12 @@ QString config::getNextcloudFolder()
{
QString folderPath {};
std::string key { "0\\Folders\\1\\localPath" };
QString path {};
std::string ncConfigKey { "0\\Folders\\1\\localPath" };
QString ncConfigPath {};
if (QOperatingSystemVersion::currentType() == QOperatingSystemVersion::Windows) {
QString appdata { qgetenv("APPDATA") };
path = appdata.append("\\Nextcloud\\nextcloud.cfg");
ncConfigPath = appdata.append("\\Nextcloud\\nextcloud.cfg");
}
else if (QOperatingSystemVersion::currentType() == QOperatingSystemVersion::MacOS) {
// TODO what are the Nextcloud paths for MacOS?
@ -85,10 +85,10 @@ QString config::getNextcloudFolder()
else {
// we just suppose everything else is Linux
QString homeDir { qgetenv("HOME") };
path = homeDir.append("/.config/Nextcloud/nextcloud.cfg");
ncConfigPath = homeDir.append("/.config/Nextcloud/nextcloud.cfg");
}
QFile ncConfig(path);
QFile ncConfig { ncConfigPath };
if (!ncConfig.open(QFile::ReadOnly)) {
return QString();
@ -98,8 +98,8 @@ QString config::getNextcloudFolder()
ncConfig.close();
if (content.find(key) != std::string::npos) {
int valueStartPos { static_cast<int>(content.find(key) + key.length() + 1) };
if (content.find(ncConfigKey) != std::string::npos) {
int valueStartPos { static_cast<int>(content.find(ncConfigKey) + ncConfigKey.length() + 1) };
int valueEndPos { static_cast<int>(content.find_first_of("\r\n", valueStartPos) - 1) };
folderPath = QString::fromStdString(content.substr(valueStartPos, valueEndPos - valueStartPos));

@ -117,7 +117,7 @@ bool NoteHandler::saveContent(int index, const QString& content)
// I guess it's more expensive to compare old and new content than
// just randomly writing the new content to the file.
QTextStream out(&file);
QTextStream out { &file };
out.setCodec("UTF-8");
LOG_DBG("Writing new content to file " + filename.toStdString() + ": \n---\n" + content.toStdString() + "\n---");

Loading…
Cancel
Save