karambasessionmanaged.cpp
00001 /**************************************************************************** 00002 * karambasessionmanaged.cpp - Karamba session management 00003 * 00004 * Copyright (C) 2004 - 00005 * 00006 * This file is part of SuperKaramba. 00007 * 00008 * SuperKaramba is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * SuperKaramba is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with SuperKaramba; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 ****************************************************************************/ 00022 00023 #include <kapplication.h> 00024 #include <kconfig.h> 00025 #include "karambasessionmanaged.h" 00026 #include "karamba.h" 00027 #include "tqwidgetlist.h" 00028 00029 bool KarambaSessionManaged::saveState(TQSessionManager&) 00030 { 00031 KConfig* config = kapp->sessionConfig(); 00032 00033 config->setGroup("General Options"); 00034 00035 TQString openThemes=""; 00036 00037 TQWidgetList *list = TQApplication::allWidgets(); 00038 TQWidgetListIt it( *list ); // iterate over the widgets 00039 TQWidget * w; 00040 while ( (w=it.current()) != 0 ) // for each widget... 00041 { 00042 ++it; 00043 if (TQString(w->name()).startsWith("karamba")) 00044 { 00045 karamba* k = (karamba*) w; 00046 if (k->isSubTheme()) 00047 continue; 00048 openThemes += TQFileInfo(k->theme().file()).absFilePath(); 00049 k->writeConfigData(); 00050 openThemes += ";"; 00051 } 00052 } 00053 delete list; // delete the list, not the widgets 00054 00055 qDebug("Open themes %s", openThemes.ascii()); 00056 config->writeEntry("OpenThemes", openThemes); 00057 return true; 00058 } 00059 00060 bool KarambaSessionManaged::commitData(TQSessionManager&) 00061 { 00062 return true; 00063 }