Bug 120046 - history information not used from saved profile
Summary: history information not used from saved profile
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-13 16:28 UTC by Richard Bos
Modified: 2006-01-22 07:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Bos 2006-01-13 16:28:20 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    SuSE RPMs
OS:                Linux

This history information 'settings -> history ->
number of lines' is not read from a saved profile.

To reproduce:
- start konsole
- change number of lines in history buffer to 250 (e.g.)
- save profile (as let's say hist)
- start konsole again, but now with:
  konsole --profile hist

Check the history setting in konsole, it is set to 1000.
Check the profile information, the history field is
set to the save no of lines in history buffer (in this
case 250).

It seems that konsole neglects the history information
saved in the profile.
Comment 1 Philip Rodrigues 2006-01-14 16:44:05 UTC
Confirmed with 3.5 branch r496940
Comment 2 Kurt Hindenburg 2006-01-14 17:34:46 UTC
Konsole ignores the history line in the profile.

% grep -i history $KDEHOME/share/apps/konsole/profiles/testhistory
history=500
historyenabled=true

Konsole currently uses the history in the konsolerc file.
% grep -i history /home/kvh/.kdehome-3.5/share/config/konsolerc
history=250
historyenabled=true


To Fix: Save each sessions history (ie History0 ,History1, etc...).

Comment 3 Kurt Hindenburg 2006-01-14 19:28:11 UTC
SVN commit 498108 by hindenburg:

The history options (line #/enabled) are now used in the profiles.

BUG: 120046


 M  +16 -0     konsole.cpp  
 M  +1 -0      konsole.h  
 M  +8 -0      main.cpp  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #498107:498108
@@ -1458,6 +1458,10 @@
         config->writeEntry(key, sessions.current()->isMasterMode());
         key = QString("TabColor%1").arg(counter);
         config->writeEntry(key, tabwidget->tabColor((sessions.current())->widget()));
+        key = QString("History%1").arg(counter);
+        config->writeEntry(key, sessions.current()->history().getSize());
+        key = QString("HistoryEnabled%1").arg(counter);
+        config->writeEntry(key, sessions.current()->history().isOn());
 
         QString cwd=sessions.current()->getCwd();
         if (cwd.isEmpty())
@@ -3184,6 +3188,18 @@
     tabwidget->setTabColor( se->widget(), color );
 }
 
+void Konsole::initHistory(int lines, bool enable)
+{
+   // If no History#= is given in the profile, use the history
+   // parameter saved in konsolerc.
+   if ( lines < 0 ) lines = m_histSize;
+
+   if ( enable )
+      se->setHistory( HistoryTypeBuffer( lines ) );
+   else
+      se->setHistory( HistoryTypeNone() );
+}
+
 void Konsole::slotToggleMasterMode()
 {
   setMasterMode( masterMode->isChecked() );
--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.h #498107:498108
@@ -82,6 +82,7 @@
   void initMonitorSilence(bool on);
   void initMasterMode(bool on);
   void initTabColor(QColor color);
+  void initHistory(int lines, bool enable);
   void newSession(const QString &program, const QStrList &args, const QString &term, const QString &icon, const QString &title, const QString &cwd);
   void setSchema(const QString & path);
   void setEncoding(int);
--- branches/KDE/3.5/kdebase/konsole/konsole/main.cpp #498107:498108
@@ -514,6 +514,9 @@
         m->initMonitorSilence(sessionconfig->readBoolEntry("MonitorSilence0",false));
         m->initMasterMode(sessionconfig->readBoolEntry("MasterMode0",false));
         m->initTabColor(sessionconfig->readColorEntry("TabColor0"));
+        // -1 will be changed to the default history in konsolerc
+        m->initHistory(sessionconfig->readNumEntry("History0", -1), 
+                       sessionconfig->readBoolEntry("HistoryEnabled0", true));
         counter++;
 
         // show() before 2nd+ sessions are created allows --profile to
@@ -553,6 +556,11 @@
           m->initMasterMode(sessionconfig->readBoolEntry(key,false));
           key = QString("TabColor%1").arg(counter);
           m->initTabColor(sessionconfig->readColorEntry(key));
+          // -1 will be changed to the default history in konsolerc
+          key = QString("History%1").arg(counter);
+          QString key2 = QString("HistoryEnabled%1").arg(counter);
+          m->initHistory(sessionconfig->readNumEntry(key, -1), 
+                         sessionconfig->readBoolEntry(key2, true));
           counter++;
         }
         m->setDefaultSession( sessionconfig->readEntry("DefaultSession","shell.desktop") );
Comment 4 Richard Bos 2006-01-14 20:46:44 UTC
Wow, that's fast!  Thanks for the swift followup.
Comment 5 Kurt Hindenburg 2006-01-14 21:58:15 UTC
SVN commit 498170 by hindenburg:

Forward port: The history options (line #/enabled) are now used in 
the profiles.  Currently Konsole crashes with --profile=.  The dialogs
don't work know anyway... test later.

CCBUG: 120046 


 M  +20 -1     konsole.cpp  
 M  +1 -0      konsole.h  
 M  +12 -0     main.cpp  


--- trunk/KDE/kdebase/konsole/konsole/konsole.cpp #498169:498170
@@ -1467,8 +1467,14 @@
         config->writeEntry(key, sessions.current()->isMonitorSilence());
         key = QString("MasterMode%1").arg(counter);
         config->writeEntry(key, sessions.current()->isMasterMode());
-        key = QString("TabColor%1").arg(counter);
+        //key = QString("TabColor%1").arg(counter);
         //config->writeEntry(key, tabwidget->tabColor((sessions.current())->widget()));
+/* Test this when dialogs work again
+        key = QString("History%1").arg(counter);
+        config->writeEntry(key, sessions.current()->history().getSize());
+        key = QString("HistoryEnabled%1").arg(counter);
+        config->writeEntry(key, sessions.current()->history().isOn());
+*/
 
         QString cwd=sessions.current()->getCwd();
         if (cwd.isEmpty())
@@ -3127,6 +3133,19 @@
    ; //tabwidget->setTabColor( se->widget(), color );
 }
 
+void Konsole::initHistory(int lines, bool enable)
+{
+return;
+   // If no History#= is given in the profile, use the history
+   // parameter saved in konsolerc.
+   if ( lines < 0 ) lines = m_histSize;
+
+   if ( enable )
+      se->setHistory( HistoryTypeBuffer( lines ) );
+   else
+      se->setHistory( HistoryTypeNone() );
+}
+
 void Konsole::slotToggleMasterMode()
 {
   setMasterMode( masterMode->isChecked() );
--- trunk/KDE/kdebase/konsole/konsole/konsole.h #498169:498170
@@ -87,6 +87,7 @@
   void initMonitorSilence(bool on);
   void initMasterMode(bool on);
   void initTabColor(QColor color);
+  void initHistory(int lines, bool enable);
   void newSession(const QString &program, const QStringList &args, const QString &term, const QString &icon, const QString &title, const QString &cwd);
   void setSchema(const QString & path);
   void setEncoding(int);
--- trunk/KDE/kdebase/konsole/konsole/main.cpp #498169:498170
@@ -519,6 +519,9 @@
         //FIXME: Verify this code when KDE4 supports tab colors... kvh
         QVariant v_tabColor = sessionconfig->readEntry("TabColor0");
         m->initTabColor( v_tabColor.value<QColor>() );
+        // -1 will be changed to the default history in konsolerc
+//        m->initHistory(sessionconfig->readNumEntry("History0", -1),
+//                       sessionconfig->readBoolEntry("HistoryEnabled0", true));
 
         counter++;
 
@@ -566,6 +569,15 @@
           //FIXME: Verify this code when KDE4 supports tab colors... kvh
 //          QVariant v_tabColor = sessionconfig->readEntry(key));
 //          m->initTabColor( v_tabColor.value<QColor>() );
+
+/* Test this when the dialogs work again...kvh
+          // -1 will be changed to the default history in konsolerc
+          key = QString("History%1").arg(counter);
+          QString key2 = QString("HistoryEnabled%1").arg(counter);
+          m->initHistory(sessionconfig->readNumEntry(key, -1),
+                         sessionconfig->readBoolEntry(key2, true));
+*/
+
           counter++;
         }
         m->setDefaultSession( sessionconfig->readEntry("DefaultSession","shell.desktop") );
Comment 6 Kurt Hindenburg 2006-01-22 07:48:13 UTC
SVN commit 501108 by hindenburg:

Fix issue where history size is unlimited.

Please make sure this goes into 3.5.1.

CCBUG: 120046



 M  +3 -1      konsole.cpp  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #501107:501108
@@ -3194,8 +3194,10 @@
    // parameter saved in konsolerc.
    if ( lines < 0 ) lines = m_histSize;
 
-   if ( enable )
+   if ( enable && lines > 0 )
       se->setHistory( HistoryTypeBuffer( lines ) );
+   else if ( enable )  // Unlimited buffer
+      se->setHistory(HistoryTypeFile());
    else
       se->setHistory( HistoryTypeNone() );
 }