Commit ab75e68b authored by Kurt Hindenburg's avatar Kurt Hindenburg

Allow user to enter location to store Konsole's scrollback files

Add a third option which allows the user to enter any folder to store
the scrollback files.

BUG: 373664

Differential Revision: https://phabricator.kde.org/D5575
parent 8b4802ed
......@@ -22,6 +22,7 @@
#include "History.h"
#include "konsoledebug.h"
#include "KonsoleSettings.h"
// System
#include <stdlib.h>
......@@ -70,15 +71,21 @@ HistoryFile::HistoryFile()
// Determine the temp directory once
// This class is called 3 times for each "unlimited" scrollback.
// This has the down-side that users must restart to
// load changes (currently only 2 choices).
// load changes.
if (!historyFileLocation.exists()) {
KConfigGroup configGroup(KSharedConfig::openConfig(), "FileLocation");
if (configGroup.readEntry("scrollbackUseCacheLocation", false)) {
*historyFileLocation() = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
} else if (configGroup.readEntry("scrollbackUseSpecifiedLocation", false)) {
const QUrl specifiedUrl = KonsoleSettings::scrollbackUseSpecifiedLocationDirectory();
*historyFileLocation() = specifiedUrl.path();
} else {
*historyFileLocation() = QDir::tempPath();
}
QDir().mkpath(*historyFileLocation());
if (!QDir().mkpath(*historyFileLocation())) {
qCWarning(KonsoleDebug)<<"Unable to create scrollback folder "<<*historyFileLocation()<<" using "<<QDir::homePath();
*historyFileLocation() = QDir::homePath();
}
}
const QString tmpDir = *historyFileLocation();
const QString tmpFormat = tmpDir + QLatin1Char('/') + QLatin1String("konsole-XXXXXX.history");
......
......@@ -33,6 +33,7 @@ FileLocationSettings::FileLocationSettings(QWidget* aParent) : QWidget(aParent)
// TODO: worth adding gauge on free disk space?
useSystemLocationText->setText(QDir::tempPath());
useUsersHomeLocationText->setText(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
kcfg_scrollbackUseSpecifiedLocationDirectory->setMode(KFile::Directory);
}
......
......@@ -113,6 +113,52 @@
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="kcfg_scrollbackUseSpecifiedLocation">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use specified loca&amp;tion</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KUrlRequester" name="kcfg_scrollbackUseSpecifiedLocationDirectory">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="filter" stdset="0">
<string>text/css</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
......
......@@ -124,5 +124,13 @@
<label>For scrollback files, use user's specific folder location</label>
<default>false</default>
</entry>
<entry name="scrollbackUseSpecifiedLocation" type="Bool">
<label>For scrollback files, use specified folder location</label>
<default>false</default>
</entry>
<entry name="scrollbackUseSpecifiedLocationDirectory" type="Url">
<label>For scrollback files, use this folder</label>
<default></default>
</entry>
</group>
</kcfg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment