summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <[email protected]>2017-04-24 22:38:09 -0400
committerKurt Hindenburg <[email protected]>2017-05-05 08:06:15 -0400
commitab75e68b1122d03a189af1d199ee8a0fc7fefa29 (patch)
treeb29eceb17378bb84eb5cf2786147946b760939e7
parent8b4802edb3aa03001edfe21b9b24d59f828d0af7 (diff)
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
-rw-r--r--src/History.cpp11
-rw-r--r--src/settings/FileLocationSettings.cpp1
-rw-r--r--src/settings/FileLocationSettings.ui46
-rw-r--r--src/settings/konsole.kcfg8
4 files changed, 64 insertions, 2 deletions
diff --git a/src/History.cpp b/src/History.cpp
index 64b589e..c2660ee 100644
--- a/src/History.cpp
+++ b/src/History.cpp
@@ -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");
diff --git a/src/settings/FileLocationSettings.cpp b/src/settings/FileLocationSettings.cpp
index 008f502..65f454b 100644
--- a/src/settings/FileLocationSettings.cpp
+++ b/src/settings/FileLocationSettings.cpp
@@ -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);
}
diff --git a/src/settings/FileLocationSettings.ui b/src/settings/FileLocationSettings.ui
index 5d566dd..c2c71b0 100644
--- a/src/settings/FileLocationSettings.ui
+++ b/src/settings/FileLocationSettings.ui
@@ -114,6 +114,52 @@
</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">
<font>
diff --git a/src/settings/konsole.kcfg b/src/settings/konsole.kcfg
index 3c85f6c..79f05a4 100644
--- a/src/settings/konsole.kcfg
+++ b/src/settings/konsole.kcfg
@@ -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>