When are KMainWindow::saveProperties() and restoreProperties() called?

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sat Jan 15 13:48:41 GMT 2005


The KDevelop C++ KDE app framework has saveProperties() and 
restoreProperties() methods in a KMainWindow subclass to save and restore 
defaults via KConfig. But they don't seem to get called when I run a test 
app. Does anyone know how they can be enabled?

-- Richard

void CppTryProj::saveProperties(KConfig *config)
{
    // the 'config' object points to the session managed
    // config file.  anything you write here will be available
    // later when this app is restored

    if (!m_view->currentURL().isEmpty()) {
#if KDE_IS_VERSION(3,1,3)
        config->writePathEntry("lastURL", m_view->currentURL());
#else
        config->writeEntry("lastURL", m_view->currentURL());
#endif
    }
}

void CppTryProj::readProperties(KConfig *config)
{
    // the 'config' object points to the session managed
    // config file.  this function is automatically called whenever
    // the app is being restored.  read in here whatever you wrote
    // in 'saveProperties'

    QString url = config->readPathEntry("lastURL");

    if (!url.isEmpty())
        m_view->openURL(KURL(url));
}

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list