From dd683623fd5f5a88a1c9f5adfd6d2fece91ed3dc Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 8 Oct 2018 17:04:58 +0200 Subject: Create .profile file when adding a new profile --- src/browser.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/browser.cpp') diff --git a/src/browser.cpp b/src/browser.cpp index 7295b56..97020bc 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -57,7 +57,16 @@ void Browser::about() QPair Browser::loadProfile(const QString &id) { - WebProfile *profile = m_profileManager->loadProfile(id); + WebProfile *profile = nullptr; + if(QFile::exists(id)) { + //qDebug("id %s exists", qUtf8Printable(id)); + profile = m_profileManager->loadProfile(id); + } else { + QDir profileDir(m_config->value("profile.path").value()); + //qDebug("id %s --> %s", qUtf8Printable(id), qUtf8Printable(profileDir.absoluteFilePath(id + ".profile"))); + profile = m_profileManager->loadProfile(profileDir.absoluteFilePath(id + ".profile")); + profile->setName(id); + } connect(profile, &WebProfile::downloadRequested, m_downloads.get(), &DownloadsWidget::addDownload); auto *interceptor = new UrlRequestInterceptor(m_urlFilter.get(), profile, profile); profile->setRequestInterceptor(interceptor); -- cgit v1.2.1