Commit 95b8d555 authored by Jekyll Wu's avatar Jekyll Wu

Add dbus method for setting and querying history size per session

FEATURE: 120040
FIXED-IN: 4.9
parent debfec2e
......@@ -1275,6 +1275,34 @@ QString Session::tabTitleFormat(int context) const
}
}
void Session::setHistorySize(int lines)
{
if ( lines < 0 ) {
setHistoryType(HistoryTypeFile());
}
else if ( lines == 0 ) {
setHistoryType(HistoryTypeNone());
}
else {
setHistoryType(CompactHistoryType(lines));
}
}
int Session::historySize() const
{
const HistoryType& currentHistory = historyType();
if (currentHistory.isEnabled()) {
if (currentHistory.isUnlimited()) {
return -1;
} else {
return currentHistory.maximumLineCount();
}
} else {
return 0;
}
}
int Session::foregroundProcessId()
{
int pid;
......
......@@ -522,6 +522,23 @@ public slots:
*/
Q_SCRIPTABLE QString tabTitleFormat(int context) const;
/**
* Sets the history capacity of this session.
*
* @param size The history capacity in unit of lines. Its value can be:
* <ul>
* <li> positive integer - fixed size history</li>
* <li> 0 - no history</li>
* <li> negative integer - unlimited history</li>
* </ul>
*/
Q_SCRIPTABLE void setHistorySize(int lines) ;
/**
* Returns the history capacity of this session.
*/
Q_SCRIPTABLE int historySize() const;
signals:
/** Emitted when the terminal process starts. */
......
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