aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-08 17:04:58 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-08 17:04:58 +0200
commitdd683623fd5f5a88a1c9f5adfd6d2fece91ed3dc (patch)
treeb07205fff261ec4e092e28f4327d02fc1492532d
parentDisable Chromium crash handler (diff)
downloadsmolbote-dd683623fd5f5a88a1c9f5adfd6d2fece91ed3dc.tar.xz
Create .profile file when adding a new profile
-rw-r--r--lib/web/profilemanager.h7
-rw-r--r--src/browser.cpp11
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/web/profilemanager.h b/lib/web/profilemanager.h
index ad6fa1f..c7ed660 100644
--- a/lib/web/profilemanager.h
+++ b/lib/web/profilemanager.h
@@ -46,9 +46,12 @@ private:
~ProfileData()
{
- if(!deleteSelf)
+ if(!deleteSelf) {
+#ifdef QT_DEBUG
+ qDebug("sync %s", qUtf8Printable(settings.fileName()));
+#endif
this->settings.sync();
- else {
+ } else {
QFile::remove(path);
if(!profile->isOffTheRecord()) {
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<QString, WebProfile *> 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<QString>("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);