Bug 116511 - "Documents" tool view does not retain open/close state for empty session
Summary: "Documents" tool view does not retain open/close state for empty session
Status: RESOLVED DUPLICATE of bug 156330
Alias: None
Product: kate
Classification: Applications
Component: sessions (show other bugs)
Version: 2.5
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-16 19:04 UTC by Eike Hein
Modified: 2010-10-26 13:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eike Hein 2005-11-16 19:04:24 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Gentoo Packages
Compiler:          GCC 3.3.6 
OS:                Linux

Since I have opted to use the Tar Bar plug-in in Kate, the "Documents" tool view has become a redundancy for me. Therefore, in an empty session, I closed it, expecting it to retain its state for the next time I run Kate. Unfortunately it does not, so I need to close the tool view manually each time to get the valuable screen real estate back.

This is symptomatic of a larger problem: It is not possible to specify tool view state defaults for empty sessions. While session management does appear to allow me to save the state of the tool views, this does not help with the (for me) standard situation of running Kate to create a new document of modifying a file on the run.
Comment 1 Anders Lund 2005-11-16 19:08:12 UTC
I think this is a correct observation, we need a way to change the default settings for use with new/unsaved sessions.
Comment 2 Fikret Skrgic 2005-11-17 11:13:11 UTC
This annoyed me a lot too, even though I just installed KDE 3.5 a couple of days ago. I found a way around it. I changed the settings so that the window configuration is remembered as a part of a session. I also set it to not save sessions on exit so that the stored window configuration never changes. It worked. I was happy. I could start Kate without the Documents tool opened. But, I soon realized that I had not solved the problem completely. When I double-clicked a file, which opened in Kate, the Documents tool opened again. For someone, who just opens the same exact set of files and nothing else, this might not be a problem. Such a person would never have to double-click anything. There's probably more people like me, who open files randomly and by clicking on them. I am also wondering why one would make this tool open at start in first place. What kind of a scenario would justify it? If I just opened Kate without opening any files, there would be nothing in the Documents tool anyway. If I clicked on a file, that file would be open and I would want to do something with it. It is highly unlikely that after having just opened a file the first thing one would want to do is to open another. If I opened Kate and Kate just opened a saved session (for example, I am a programmer and I work all day long every day on the same set of files), then the file I would want to work on is already open and there is no need for opening the Document tool at start. Why the hack did you, guys, do this? Enlighten me.
Comment 3 Eike Hein 2005-11-17 14:25:58 UTC
Just for clarity's sake, of course I meant the "Tab Bar plug-in". Typo. :-)
Comment 4 Stolz 2005-12-06 15:59:33 UTC
Same problem here. 

As Fikret, I've defined my own default session with custom layout (toolbar,filelist, windows size,...). Whenever I run kate without opening any file, it loads my layout, but if I open a file from konqueror or command line, it uses a new session with the default layout!!! It's really annoying!!!

Kate help shows:
# kate --help
...
  -s, --start <name>        Start Kate with a given session
...

But it doesn't work. If <name> is an existing session, instead of using it, kate creates a new session with the same name.

If someone knows how to force kate to use the session layout I've created not only when opening a blank session but also when opening an existing file please tell me.

A solution could be setting the default session name customizable, as suggested in bug #114602
Comment 5 Stolz 2006-01-08 19:57:16 UTC
In the SVN version of kate the bug seems solved

# cd /usr/portage/distfiles/
# tar -xvjpf kdebase-3.5.0.tar.bz2
# rm kdebase-3.5.0.tar.bz2
# cd kde-base/
# rm kate -r
# svn co svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/kdebase/kate
# cd /usr/portage/distfiles/
# tar -c kdebase-3.5.0/ | bzip2 > kdebase-3.5.0.tar.bz2
# ebuild /usr/portage/kde-base/kate/kate-3.5.0.ebuild digest
# emerge kate

Then, open the default session, configure kate to inlude window decoration when  a session is saved and go to "Sessions->Save"

Hope it helps.
Comment 6 Anders Lund 2006-01-08 21:14:43 UTC
On Sunday 08 January 2006 19:57, Stolz wrote:
> Then, open the default session, configure kate to inlude window decoration
> when 
Comment 7 Anders Lund 2006-01-14 15:01:25 UTC
SVN commit 497995 by alund:

Read window configuration from default session when starting a new one.
CCBUG: 116511


 M  +9 -0      README  
 M  +30 -0     app/katesession.cpp  


--- branches/KDE/3.5/kdebase/kate/README #497994:497995
@@ -17,3 +17,12 @@
 
 Licensing:
 The Kate app/utils/interfaces and KWrite app are licensed under the LGPL VERSION 2.
+
+                *** Undocumented features in Kate version 2.5.1 ***
+The following changes didn't make it into the documentation for version 2.5.1
+
+* When starting a new session, the GUI configuration of default session is loaded.
+To save window configuration in the default session, you need to enable saving
+window configuration in the sessions configuration page of the configuration
+dialog and then load the default sesison, set up the window as desired and save
+the session again.
--- branches/KDE/3.5/kdebase/kate/app/katesession.cpp #497994:497995
@@ -43,6 +43,7 @@
 #include <qhbox.h>
 #include <qcheckbox.h>
 #include <qdatetime.h>
+#include <qmap.h>
 
 #include <unistd.h>
 #include <time.h>
@@ -85,8 +86,10 @@
   }
 
   // filename not empty, create the file
+  // anders: When will this ever happen???
   if (!m_sessionFileRel.isEmpty())
   {
+    kdDebug(13001)<<"Kate::Session: initializing unexisting file!"<<endl;
      // uhh, no name given
     if (m_sessionName.isEmpty())
     {
@@ -100,6 +103,27 @@
     KSimpleConfig config (sessionFile ());
     config.setGroup ("General");
     config.writeEntry ("Name", m_sessionName);
+
+    // If this is not the default session, copy GUI properties from that.
+    if ( m_sessionFileRel != "default.katesession" )
+    {
+      int cnt = 0;
+      QString group;
+      KSimpleConfig defaultConfig( m_manager->sessionsDir() + "/default.katesession" );
+      while ( defaultConfig.hasGroup( group = QString("MainWindow%1").arg(cnt) ) )
+      {
+        config.setGroup( group );
+        QMap<QString,QString> map = defaultConfig.entryMap( group );
+        QMap<QString,QString>::ConstIterator it;
+        for ( it = map.begin(); it != map.end(); ++it )
+          config.writeEntry( it.key(), it.data() );
+
+        cnt++;
+      }
+      config.setGroup( "Open MainWindows" );
+      config.writeEntry( "Count", cnt );
+    }
+
     config.sync ();
   }
 }
@@ -278,6 +302,11 @@
     if (sc)
       KateApp::self()->documentManager()->restoreDocumentList (sc);
 
+    // if we have no session config object, try to load the default
+    // (anonymous/unnamed sessions)
+    if ( ! sc )
+      sc = new KSimpleConfig( sessionsDir() + "/default.katesession" );
+
     // window config
     if (sc)
     {
@@ -891,3 +920,4 @@
 
   KateSessionManager::self()->activateSession(slist[(uint)i]);
 }
+// kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;
Comment 8 Dominik Haumann 2010-10-26 13:50:24 UTC
This should be fixed by applying the patch attached to bug #156330. Can you confirm?

*** This bug has been marked as a duplicate of bug 156330 ***