Commit cb26274f authored by Christian Loose's avatar Christian Loose

* Remove restorePseudo() hack

* We always want to save "Current Directory". So move the
   handling out of the session management methods.

svn path=/trunk/kdesdk/cervisia/; revision=200643
parent 353c290b
2003-01-17 Christian Loose <christian.loose@hamburg.de>
* Remove restorePseudo() hack
* We always want to save "Current Directory". So move out
of the session management methods.
2003-01-16 Christian Loose <christian.loose@hamburg.de>
* Changed main window size handling. The window size is now
......
......@@ -15,4 +15,9 @@ Id=kde3.2/20030116
File=cervisiapartrc
RemoveGroup=Main window
File=cervisiarc
RemoveGroup=Main window
\ No newline at end of file
RemoveGroup=Main window
#
Id=kde3.2/20030117
File=cervisiapartrc,cervisiarc
Group=Session
Key=Current Directory
......@@ -85,6 +85,8 @@ CervisiaShell::CervisiaShell( const char *name )
// enable auto-save of toolbar/menubar/statusbar and window size settings
// and apply the previously saved settings
setAutoSaveSettings("MainWindow", true);
readSettings();
}
CervisiaShell::~CervisiaShell()
......@@ -169,46 +171,44 @@ void CervisiaShell::slotChangeFilterStatus(QString status)
bool CervisiaShell::queryExit()
{
KConfig *config = part->config();
part->saveDialogProperties(config);
config->setGroup("Session");
saveProperties(config);
config->sync();
writeSettings();
return true;
}
void CervisiaShell::restorePseudo(const QString &dirname)
{
KConfig *config = part->config();
part->readDialogProperties(config);
void CervisiaShell::readSettings()
{
KConfig *config = part->config(); // FIXME: remove later
part->readDialogProperties(config); // -dito-
config->setGroup("Session"); // -dito-
part->readProperties( config ); // -dito-
config = KGlobal::config();
config->setGroup("Session");
// Explicitly override the loaded directory if
// a command line argument is given
if (!dirname.isEmpty())
config->writeEntry("Current Directory", dirname);
readProperties(config);
}
void CervisiaShell::readProperties(KConfig *config)
{
part->readProperties( config );
QString currentDir = config->readEntry("Current Directory");
if (!currentDir.isEmpty())
part->openURL( KURL::fromPathOrURL(currentDir) );
if( !currentDir.isEmpty() )
openURL( KURL::fromPathOrURL(currentDir) );
}
void CervisiaShell::saveProperties(KConfig *config)
void CervisiaShell::writeSettings()
{
part->saveProperties(config);
KConfig *config = part->config(); // FIXME: remove later
part->saveDialogProperties(config); // -dito-
config->setGroup("Session"); // -dito-
part->saveProperties(config); // -dito-
config = KGlobal::config();
config->setGroup("Session");
config->writeEntry("Current Directory", part->sandBox());
// write to disk
config->sync();
}
#include "cervisiashell.moc"
......
......@@ -47,12 +47,13 @@ protected slots:
protected:
void setupActions();
bool queryExit();
virtual void readProperties(KConfig *config);
virtual void saveProperties(KConfig *config);
private:
void readSettings();
void writeSettings();
CervisiaPart *part;
QLabel *filterLabel;
......
......@@ -65,9 +65,6 @@ int main(int argc, char **argv)
} else {
CervisiaShell* shell = new CervisiaShell();
QString dirname; // TODO: remove later
shell->restorePseudo(dirname); // - dito -
const KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
QString dirName = args->count() ? args->arg(0) : QString::null;
......
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