[prev in list] [next in list] [prev in thread] [next in thread]
List: konsole-devel
Subject: Re: [Konsole-devel] Session managment
From: Stephan Binner <binner () kde ! org>
Date: 2002-03-28 13:28:07
[Download RAW message or body]
On Thursday 28 March 2002 03:21, Waldo Bastian wrote:
> > Seems like a bug or change in behaviour of KSimpleConfig, in konsole.cpp
> > KSimpleConfig *co = new KSimpleConfig(QString::null, true);
> That's the price you pay for abusing the API. You don't have write access
> to the file "QString::null" so your changes will be ignored.
We should force the committer to fix it but nevertheless how is this looking?
Bye,
Steve
["konsole-screen.diff" (text/x-diff)]
Index: konsole/konsole.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/konsole.cpp,v
retrieving revision 1.264
diff -u -3 -p -r1.264 konsole.cpp
--- konsole/konsole.cpp 2002/03/26 21:39:27 1.264
+++ konsole/konsole.cpp 2002/03/28 13:16:37
@@ -228,6 +228,7 @@ DCOPObject( "konsole" )
connect( kapp,SIGNAL(backgroundChanged(int)),this, SLOT(slotBackgroundChanged(int)));
no2command.setAutoDelete(true);
+ no2tempFile.setAutoDelete(true);
no2filename.setAutoDelete(true);
menubar = menuBar();
@@ -312,6 +313,7 @@ Konsole::~Konsole()
// Delete the session if isn't in the session list any longer.
sessions.setAutoDelete(true);
+ resetScreenSessions();
if (no2command.isEmpty())
delete m_defaultSession;
@@ -1576,7 +1578,10 @@ QString Konsole::newSession()
void Konsole::newSession(int i)
{
KSimpleConfig* co = no2command.find(i);
- if (co) newSession(co);
+ if (co) {
+ newSession(co);
+ resetScreenSessions();
+ }
}
void Konsole::newSessionToolbar(int i)
@@ -1585,6 +1590,7 @@ void Konsole::newSessionToolbar(int i)
if (co) {
setDefaultSession(*no2filename.find(i));
newSession(co);
+ resetScreenSessions();
}
}
@@ -1989,8 +1995,9 @@ void Konsole::loadSessionCommands()
void Konsole::addScreenSession(const QString &socket)
{
- // In-memory only
- KSimpleConfig *co = new KSimpleConfig(QString::null, true);
+ KTempFile *tmpFile = new KTempFile();
+ tmpFile->setAutoDelete(true);
+ KSimpleConfig *co = new KSimpleConfig(tmpFile->name());
co->setDesktopGroup();
co->writeEntry("Name", socket);
QString txt = i18n("Screen is a program controlling screens!", "Screen at %1").arg(socket);
@@ -2001,6 +2008,7 @@ void Konsole::addScreenSession(const QSt
m_session->insertItem( SmallIconSet( icon ), txt, cmd_serial, cmd_serial - 1 );
m_toolbarSessionsCommands->insertItem( SmallIconSet( icon ), txt, cmd_serial );
no2command.insert(cmd_serial,co);
+ no2tempFile.insert(cmd_serial,tmpFile);
no2filename.insert(cmd_serial,new QString(""));
}
@@ -2032,6 +2040,13 @@ void Konsole::loadScreenSessions()
}
closedir(dir);
}
+ resetScreenSessions();
+ for (QStringList::ConstIterator it = sessions.begin(); it != sessions.end(); ++it)
+ addScreenSession(*it);
+}
+
+void Konsole::resetScreenSessions()
+{
if (cmd_first_screen == -1)
cmd_first_screen = cmd_serial + 1;
else
@@ -2041,12 +2056,11 @@ void Konsole::loadScreenSessions()
m_session->removeItem(i);
m_toolbarSessionsCommands->removeItem(i);
no2command.remove(i);
+ no2tempFile.remove(i);
no2filename.remove(i);
}
cmd_serial = cmd_first_screen - 1;
}
- for (QStringList::ConstIterator it = sessions.begin(); it != sessions.end(); ++it)
- addScreenSession(*it);
}
// --| Schema support |-------------------------------------------------------
Index: konsole/konsole.h
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/konsole.h,v
retrieving revision 1.105
diff -u -3 -p -r1.105 konsole.h
--- konsole/konsole.h 2002/03/26 21:39:28 1.105
+++ konsole/konsole.h 2002/03/28 13:16:38
@@ -154,7 +154,7 @@ private slots:
void slotSelectFont();
void slotSelectScrollbar();
void loadScreenSessions();
-
+
void slotSaveSettings();
void slotConfigure();
void reparseConfiguration();
@@ -187,6 +187,7 @@ private:
void addSessionCommand(const QString & path);
void loadSessionCommands();
void addScreenSession(const QString & socket);
+ void resetScreenSessions();
QPtrDict<TESession> action2session;
QPtrDict<KRadioAction> session2action;
@@ -194,6 +195,7 @@ private:
QPtrList<TESession> sessions;
QPtrList<KonsoleChild> detached;
QIntDict<KSimpleConfig> no2command;
+ QIntDict<KTempFile> no2tempFile;
QIntDict<QString> no2filename;
KSimpleConfig* m_defaultSession;
QString m_defaultSessionFilename;
_______________________________________________
konsole-devel mailing list
konsole-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/konsole-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic