]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinsettings.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at), *
3 * Cvetoslav Ludmiloff and Patrice Tremblay *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "dolphinsettings.h"
26 #include <kbookmark.h>
27 #include <kbookmarkmanager.h>
28 #include <kicontheme.h>
29 #include <kinstance.h>
31 #include <kstandarddirs.h>
33 #include "generalsettings.h"
34 #include "iconsmodesettings.h"
35 #include "detailsmodesettings.h"
39 DolphinSettings
& DolphinSettings::instance()
41 static DolphinSettings
* instance
= 0;
43 instance
= new DolphinSettings();
48 KBookmark
DolphinSettings::bookmark(int index
) const
51 KBookmarkGroup root
= bookmarkManager()->root();
52 KBookmark bookmark
= root
.first();
53 while (!bookmark
.isNull()) {
58 bookmark
= root
.next(bookmark
);
64 KBookmarkManager
* DolphinSettings::bookmarkManager() const
66 QString basePath
= KGlobal::instance()->instanceName();
67 basePath
.append("/bookmarks.xml");
68 const QString file
= KStandardDirs::locateLocal("data", basePath
);
70 return KBookmarkManager::managerForFile(file
, "dolphin", false);
73 void DolphinSettings::save()
75 m_generalSettings
->writeConfig();
76 m_iconsModeSettings
->writeConfig();
77 m_detailsModeSettings
->writeConfig();
79 QString basePath
= KGlobal::instance()->instanceName();
80 basePath
.append("/bookmarks.xml");
81 const QString file
= KStandardDirs::locateLocal( "data", basePath
);
83 KBookmarkManager
* manager
= KBookmarkManager::managerForFile(file
, "dolphin", false);
87 DolphinSettings::DolphinSettings()
89 m_generalSettings
= new GeneralSettings();
90 m_iconsModeSettings
= new IconsModeSettings();
91 m_detailsModeSettings
= new DetailsModeSettings();
94 DolphinSettings::~DolphinSettings()
96 delete m_generalSettings
;
97 m_generalSettings
= 0;
99 delete m_iconsModeSettings
;
100 m_iconsModeSettings
= 0;
102 delete m_detailsModeSettings
;
103 m_detailsModeSettings
= 0;