Skip to content

Commit

Permalink
improve proposeLocalDir feature
Browse files Browse the repository at this point in the history
  • Loading branch information
rwalke committed Dec 4, 2024
1 parent faab1c6 commit 6b24b06
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/gui/owncloudsetupwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,20 @@ void OwncloudSetupWizard::startWizard()
if (!QDir(localFolder).isAbsolute()) {
localFolder = QDir::homePath() + QLatin1Char('/') + localFolder;
}

localFolder = "Please select folder";

_ocWizard->setProperty("localFolder", localFolder);

{
ConfigFile cfg;
if (!cfg.proposeLocalDir().isEmpty()) {
qCInfo(lcWizard) << "cfg.proposeLocalDir() " << cfg.proposeLocalDir();
if (cfg.proposeLocalDir() == "false") {
localFolder = "Please select folder";
}
_ocWizard->setProperty("localFolder", localFolder);
}
}

{
ConfigFile cfg;
if (!cfg.overrideLocalDir().isEmpty()) {
Expand Down
13 changes: 13 additions & 0 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static constexpr char updateSegmentC[] = "updateSegment";
static constexpr char updateChannelC[] = "updateChannel";
static constexpr char overrideServerUrlC[] = "overrideServerUrl";
static constexpr char overrideLocalDirC[] = "overrideLocalDir";
static constexpr char proposeLocalDirC[] = "proposeLocalDir";
static constexpr char isVfsEnabledC[] = "isVfsEnabled";
static constexpr char geometryC[] = "geometry";
static constexpr char timeoutC[] = "timeout";
Expand Down Expand Up @@ -779,6 +780,18 @@ void ConfigFile::setOverrideLocalDir(const QString &localDir)
settings.setValue(QLatin1String(overrideLocalDirC), localDir);
}

[[nodiscard]] QString ConfigFile::proposeLocalDir() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(proposeLocalDirC), {}).toString();
}

void ConfigFile::setProposeLocalDir(const QString &localDir)
{
QSettings settings(configFile(), QSettings::IniFormat);
settings.setValue(QLatin1String(proposeLocalDirC), localDir);
}

bool ConfigFile::isVfsEnabled() const
{
QSettings settings(configFile(), QSettings::IniFormat);
Expand Down
3 changes: 3 additions & 0 deletions src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
[[nodiscard]] QString overrideLocalDir() const;
void setOverrideLocalDir(const QString &localDir);

[[nodiscard]] QString proposeLocalDir() const;
void setProposeLocalDir(const QString &localDir);

[[nodiscard]] bool isVfsEnabled() const;
void setVfsEnabled(bool enabled);

Expand Down

0 comments on commit 6b24b06

Please sign in to comment.