Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void KTechlab::saveProperties ( KConfig *  conf  )  [protected]

This function is called when it is time for the app to save its properties for session management purposes.

Definition at line 599 of file ktechlab.cpp.

References SymbolViewer::saveProperties().

Referenced by queryClose().

{
      // Dumbass KMainWindow - can't handle my width/height correctly. Whoever thought of the "+1" hack anyway?!
      conf->setGroup("UI");
      conf->writeEntry( "Width", width() );
      conf->writeEntry( "Height", height() );
      conf->writeEntry( "WinState", KWin::windowInfo( winId(), NET::WMState ).state() );
      
#ifndef NO_GPSIM
      SymbolViewer::self()->saveProperties( conf );
#endif
      
      if ( ProjectManager::self()->currentProject() )
      {
            conf->setGroup("Project");
            conf->writePathEntry( "Open", ProjectManager::self()->currentProject()->url().prettyURL() );
      }
      else
            conf->deleteGroup("Project");
      
      //BEGIN Open Views State
      // Remvoe old entries describing the save state - we don't want a horrible mish-mash of saved states
      const QStringList groupList = conf->groupList();
      const QStringList::const_iterator groupListEnd = groupList.end();
      for ( QStringList::const_iterator it = groupList.begin(); it != groupListEnd; ++it )
      {
            if ( (*it).startsWith("ViewContainer") )
                  conf->deleteGroup(*it);
      }
      
      uint viewContainerId = 1;
      const ViewContainerList::iterator vcEnd = m_viewContainerList.end();
      for ( ViewContainerList::iterator it = m_viewContainerList.begin(); it != vcEnd; ++it )
      {
            if ( !(*it) || !(*it)->canSaveUsefulStateInfo() )
                  continue;
            
            // To make sure the ViewContainers are restored in the right order, we must create them in alphabetical order,
            // as KConfig stores them as such...
            const QString id = QString::number(viewContainerId++).rightJustify( 4, '0' );
                  
            conf->setGroup( "ViewContainer " + id );
            (*it)->saveState(conf);
      }
      //END Open Views State
      
      saveSession( conf, "KateMDI" );
      // Piss off KMainWindow
      conf->setGroup("KateMDI");
      int scnum = QApplication::desktop()->screenNumber(parentWidget());
      QRect desk = QApplication::desktop()->screenGeometry(scnum);
      conf->deleteEntry( QString::fromLatin1("Width %1").arg(desk.width()) );
      conf->deleteEntry( QString::fromLatin1("Height %1").arg(desk.height()) );
      
      conf->sync();
}


Generated by  Doxygen 1.6.0   Back to index