~neon/kdeplasma-addons/trunk

« back to all changes in this revision

Viewing changes to applets/kimpanel/src/kimpanelsettings.cpp

  • Committer: asouza
  • Date: 2011-02-01 19:41:58 UTC
  • Revision ID: svn-v4:283d02a7-25f6-0310-bc7c-ecb5cbfe19da:trunk/KDE/kdeplasma-addons:1218275
Move kdeplasma-addons to git

- You can find information about the project in the link below:

https://projects.kde.org/projects/kde/kdeplasma-addons/repository

- And you can clone the repository using:

git clone git://anongit.kde.org/kdeplasma-addons


Thanks eean and all the sysadmins for the help.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2009 by Wang Hoi <zealot.hoi@gmail.com>                 *
3
 
 *                                                                         *
4
 
 *   This program is free software; you can redistribute it and/or modify  *
5
 
 *   it under the terms of the GNU General Public License as published by  *
6
 
 *   the Free Software Foundation; either version 2 of the License, or     *
7
 
 *   (at your option) any later version.                                   *
8
 
 *                                                                         *
9
 
 *   This program is distributed in the hope that it will be useful,       *
10
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 
 *   GNU General Public License for more details.                          *
13
 
 *                                                                         *
14
 
 *   You should have received a copy of the GNU General Public License     *
15
 
 *   along with this program; if not, write to the                         *
16
 
 *   Free Software Foundation, Inc.,                                       *
17
 
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
18
 
 ***************************************************************************/
19
 
 
20
 
#include "kimpanelsettings.h"
21
 
#include <kdirwatch.h>
22
 
#include <kstandarddirs.h>
23
 
#include <kdebug.h>
24
 
 
25
 
namespace KIM
26
 
{
27
 
    class SettingsHelper
28
 
    {
29
 
      public:
30
 
        SettingsHelper() : q(0) {}
31
 
        // q is also static, no need to delete it here
32
 
        ~SettingsHelper() {}
33
 
        Settings *q;
34
 
    };
35
 
    K_GLOBAL_STATIC(SettingsHelper, s_globalSettings)
36
 
    Settings *Settings::self()
37
 
    {
38
 
      if (!s_globalSettings->q) {
39
 
        s_globalSettings->q = new Settings;
40
 
        s_globalSettings->q->readConfig();
41
 
      }
42
 
 
43
 
      return s_globalSettings->q;
44
 
    }
45
 
 
46
 
    Settings::Settings()
47
 
    {
48
 
        //FIXME: if/when kconfig gets change notification, this will be unnecessary
49
 
        KDirWatch::self()->addFile(KStandardDirs::locateLocal("config", "kimpanelrc"));
50
 
        connect(KDirWatch::self(), SIGNAL(created(const QString &)), this, SLOT(settingsFileChanged()));
51
 
        connect(KDirWatch::self(), SIGNAL(dirty(const QString &)), this, SLOT(settingsFileChanged()));
52
 
    }
53
 
 
54
 
    Settings::~Settings()
55
 
    {
56
 
    }
57
 
 
58
 
    void Settings::settingsFileChanged()
59
 
    {
60
 
        readConfig();
61
 
        emit configChanged();
62
 
    }
63
 
} // namespace KIM
64
 
 
65
 
// vim: sw=4 sts=4 et tw=100