Bug 53969

Summary: kate doesn't position to remembered line like version with KDE-3.05a
Product: [Applications] kate Reporter: James <bjlockie>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: l.savernik
Priority: NOR    
Version First Reported In: 2.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description James 2003-02-03 07:22:56 UTC
Version:           2.1 (using KDE KDE 3.1)
Installed from:    Gentoo Packages
Compiler:          2.95.3 
OS:          Linux

Kate used to remember all files that were last open and position the current line on the last use line.
The version of kate included with KDE-3.1 no longer does this.
The version with KDE-3.05a did this.
Comment 1 Christoph Cullmann 2003-07-22 20:25:42 UTC
anders, have you some ideas ? needs to be redone after the "create views on using" 
changes to make starting faster 
Comment 2 Anders Lund 2003-07-23 21:56:53 UTC
Subject: Re:  kate doesn't position to remembered line like version with KDE-3.05a

On Tuesday 22 July 2003 20:25, Christoph Cullmann wrote:
> anders, have you some ideas ? needs to be redone after the "create views on
> using" changes to make starting faster

Locally fixed, I'll commit after checking tomorrow ;)

-anders

Comment 3 Anders Lund 2003-07-28 00:14:50 UTC
Partially fixed in CVS. It will work now, as long as you has actually had a view for the 
file in your current session. 
Comment 4 Christoph Cullmann 2003-08-05 00:44:58 UTC
atm out of order I guess in cvs after my session rework, we need to adjust the view 
restore to the latest changes 
Comment 5 Christoph Cullmann 2003-08-09 23:36:08 UTC
back to work again 
Comment 6 Leo Savernik 2004-02-24 09:26:37 UTC
Cursor positions aren't remembered for all open files except the current one. See dupe bug 75997 for details.
Comment 7 Leo Savernik 2004-02-24 09:27:04 UTC
*** Bug 75997 has been marked as a duplicate of this bug. ***
Comment 8 Anders Lund 2004-03-07 10:12:13 UTC
CVS commit by alund: 

restore view configuration in addview if possible
This should be backported to branch -- christoph?

CCMAIL: 53969-done@bugs.kde.org


  M +22 -2     kateviewspace.cpp   1.34
  M +1 -0      kateviewspace.h   1.19


--- kdebase/kate/app/kateviewspace.h  #1.18:1.19
@@ -102,4 +102,5 @@ class KateViewSpace : public QVBox
     KVSSBSep *sep;
     KateViewManager *m_viewManager;
+    QString m_group;
 
   private slots:

--- kdebase/kate/app/kateviewspace.cpp  #1.33:1.34
@@ -91,4 +91,5 @@ KateViewSpace::KateViewSpace( KateViewMa
 
   setMinimumWidth (mStatusBar->minimumWidth());
+  m_group = QString::null;
 }
 
@@ -104,4 +105,21 @@ void KateViewSpace::polish()
 void KateViewSpace::addView(Kate::View* v, bool show)
 {
+  // restore the config of this view if possible
+  if ( !m_group.isEmpty() )
+  {
+    QString fn = v->getDoc()->url().prettyURL();
+    if ( ! fn.isEmpty() )
+    {
+      QString vgroup = QString("%1 %2").arg(m_group).arg(fn);
+      KConfig *config = new KConfig("katesessionrc");
+      if ( config->hasGroup( vgroup ) ) {
+        config->setGroup( vgroup );
+        v->readSessionConfig( config );
+      }
+      delete config; // nessecary? nice?
+    }
+  }
+
+
   uint id = mViewList.count();
   stack->addWidget(v, id);
@@ -212,4 +230,5 @@ void KateViewSpace::slotStatusChanged (K
 void KateViewSpace::saveConfig ( KConfig* config, int myIndex ,const QString& viewConfGrp)
 {
+  kdDebug()<<"KateViewSpace::saveConfig("<<myIndex<<", "<<viewConfGrp<<") - currentView: "<<currentView()<<")"<<endl;
   QString group = QString(viewConfGrp+"-ViewSpace %1").arg( myIndex );
 
@@ -273,4 +291,6 @@ void KateViewSpace::restoreConfig ( Kate
   if (mViewList.isEmpty())
     viewMan->createView (viewMan->m_docManager->document(0));
+
+  m_group = group; // used for restroing view configs later
 }
 //END KateViewSpace