~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to lib/util/settings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2005 by Jens Dagerbo                                    *
3
 
 *   jens.dagerbo@swipnet.se                                               *
4
 
 *                                                                         *
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.                                   *
9
 
 *                                                                         *
10
 
 ***************************************************************************/
11
 
 
12
 
#include <kconfig.h>
13
 
#include <kglobal.h>
14
 
#include <kstandarddirs.h>
15
 
 
16
 
#include "settings.h"
17
 
 
18
 
QString Settings::terminalEmulatorName( KConfig & config )
19
 
{
20
 
        config.setGroup("TerminalEmulator");
21
 
        bool useKDESetting = config.readBoolEntry( "UseKDESetting", true );
22
 
        QString terminal;
23
 
 
24
 
        if ( useKDESetting )
25
 
        {
26
 
                KConfigGroup confGroup( KGlobal::config(), QString::fromLatin1("General") );
27
 
                terminal = confGroup.readEntry("TerminalApplication", QString::fromLatin1("konsole"));
28
 
        }
29
 
        else
30
 
        {
31
 
                terminal = config.readEntry( "TerminalApplication", QString::fromLatin1("konsole"));
32
 
        }
33
 
        return terminal;
34
 
}
35
 
 
36
 
QString Settings::profileByAttributes(const QString &language, const QStringList &keywords)
37
 
{
38
 
    KConfig config(locate("data", "kdevelop/profiles/projectprofiles"));
39
 
    config.setGroup(language);
40
 
 
41
 
    QStringList profileKeywords = QStringList::split("/", "Empty");
42
 
    if (config.hasKey("Keywords"))
43
 
        profileKeywords = config.readListEntry("Keywords");
44
 
 
45
 
    int idx = 0;
46
 
    for (QStringList::const_iterator it = profileKeywords.constBegin();
47
 
        it != profileKeywords.constEnd(); ++it)
48
 
    {
49
 
        if (keywords.contains(*it))
50
 
        {
51
 
            idx = profileKeywords.findIndex(*it);
52
 
            break;
53
 
        }
54
 
    }
55
 
 
56
 
    QStringList profiles;
57
 
    if (config.hasKey("Profiles"))
58
 
    {
59
 
        profiles = config.readListEntry("Profiles");
60
 
        return profiles[idx];
61
 
    }
62
 
    return "KDevelop";
63
 
}