• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/util

  • KDevelop
  • EnvironmentProfileList
Public Member Functions | Protected Member Functions | List of all members
KDevelop::EnvironmentProfileList Class Reference

#include <environmentprofilelist.h>

Public Member Functions

 EnvironmentProfileList (const EnvironmentProfileList &rhs)
 
 EnvironmentProfileList (const KSharedConfigPtr &config)
 
 EnvironmentProfileList (KConfig *config)
 
 ~EnvironmentProfileList ()
 
QStringList createEnvironment (const QString &profileName, const QStringList &defaultEnvironment) const
 
QString defaultProfileName () const
 
EnvironmentProfileList & operator= (const EnvironmentProfileList &rhs)
 
QStringList profileNames () const
 
QMap< QString, QString > variables (const QString &profileName) const
 

Protected Member Functions

 EnvironmentProfileList ()
 
void loadSettings (KConfig *config)
 
void removeProfile (const QString &profileName)
 
void saveSettings (KConfig *config) const
 
void setDefaultProfile (const QString &profileName)
 
QMap< QString, QString > & variables (const QString &profileName)
 

Detailed Description

This class manages a list of environment profiles, each profile containing a number of environment variables and their values.

The class is constructed from a KConfig object for easy usage in the plugins.

The methods to change the environments is protected to disallow access to those methods from plugins, only the environment widget is allowed to change them.

Example Usage

KSharedConfigPtr config = KSharedConfig::openConfig();
EnvironmentProfileList env(config);
KConfigGroup cfg(config, "QMake Builder");
QMap<QString,QString> myenvVars = env.variables( cfg.readEntry("QMake Environment") );

Two entries are used by this class: "Default Environment Group" and "Environment Variables".

"Default Environment Variables" stores the default profile that should be used if the user didn't select a profile via a plugins configuration dialog.

"Environment Variables" entry stores the actual list of <profilenamevarname=varvalue>. The profilename can't contain '' or '='. For example, suppose that two configuration, say "release" and "debug" exist. Then the actual contents of .kdev4 project file will be

[Environment Settings]
Default Environment Group=debug
Environment Variables=debug_PATH=/home/kde-devel/usr/bin,release_PATH=/usr/bin

Definition at line 71 of file environmentprofilelist.h.

Constructor & Destructor Documentation

◆ EnvironmentProfileList() [1/4]

EnvironmentProfileList::EnvironmentProfileList ( const EnvironmentProfileList &  rhs)

Definition at line 99 of file environmentprofilelist.cpp.

◆ EnvironmentProfileList() [2/4]

EnvironmentProfileList::EnvironmentProfileList ( const KSharedConfigPtr &  config)
explicit

Creates an a list of environment profiles from a KConfig object.

Parameters
configthe KConfig object to read the environment profiles from

Definition at line 112 of file environmentprofilelist.cpp.

◆ EnvironmentProfileList() [3/4]

EnvironmentProfileList::EnvironmentProfileList ( KConfig *  config)
explicit

Definition at line 120 of file environmentprofilelist.cpp.

◆ ~EnvironmentProfileList()

EnvironmentProfileList::~EnvironmentProfileList ( )
default

◆ EnvironmentProfileList() [4/4]

EnvironmentProfileList::EnvironmentProfileList ( )
protected

Definition at line 193 of file environmentprofilelist.cpp.

Member Function Documentation

◆ createEnvironment()

QStringList EnvironmentProfileList::createEnvironment ( const QString &  profileName,
const QStringList &  defaultEnvironment 
) const

Creates a merged environment between the defaults specified by defaultEnvironment and those saved in profileName.

Definition at line 198 of file environmentprofilelist.cpp.

◆ defaultProfileName()

QString EnvironmentProfileList::defaultProfileName ( ) const

returns the name of the default profile The default profile should be used by plugins unless the user chooses a different profile

Returns
the name of the default profile, defaults to "default"

Definition at line 144 of file environmentprofilelist.cpp.

◆ loadSettings()

void EnvironmentProfileList::loadSettings ( KConfig *  config)
protected

Definition at line 171 of file environmentprofilelist.cpp.

◆ operator=()

EnvironmentProfileList & EnvironmentProfileList::operator= ( const EnvironmentProfileList &  rhs)

Definition at line 104 of file environmentprofilelist.cpp.

◆ profileNames()

QStringList EnvironmentProfileList::profileNames ( ) const

Fetch the list of names of known profiles from the list.

Returns
the list of profile names

Definition at line 179 of file environmentprofilelist.cpp.

◆ removeProfile()

void EnvironmentProfileList::removeProfile ( const QString &  profileName)
protected

Definition at line 186 of file environmentprofilelist.cpp.

◆ saveSettings()

void EnvironmentProfileList::saveSettings ( KConfig *  config) const
protected

Stores the environment profiles in this list to the given KConfig object.

Parameters
configa KConfig object to which the environment settings should be stored

Definition at line 163 of file environmentprofilelist.cpp.

◆ setDefaultProfile()

void EnvironmentProfileList::setDefaultProfile ( const QString &  profileName)
protected

Changes the default profile.

Parameters
profileNamethe name of the new default profile, if a profile of this name doesn't exist the default profile is not changed

Definition at line 151 of file environmentprofilelist.cpp.

◆ variables() [1/2]

QMap< QString, QString > & EnvironmentProfileList::variables ( const QString &  profileName)
protected

returns the variables that are set for a given profile.

This function provides write access to the environment, so new variables can be inserted, existing ones changed or deleted

If a non-existing profile is specified this returns a new empty map and that way this function can be used to add a new profile to the list of environment profiles

Parameters
profileNamethe name of the profile for which the environment should be returned
Returns
a map containing the environment variables for this profile, or an empty map if the profile doesn't exist in this list

Definition at line 137 of file environmentprofilelist.cpp.

◆ variables() [2/2]

QMap< QString, QString > EnvironmentProfileList::variables ( const QString &  profileName) const

returns the variables that are set for a given profile.

This function provides read-only access to the environment

Parameters
profileNamethe name of the profile for which the environment should be returned
Returns
a map containing the environment variables for this profile, or an empty map if the profile doesn't exist in this list

Definition at line 130 of file environmentprofilelist.cpp.


The documentation for this class was generated from the following files:
  • environmentprofilelist.h
  • environmentprofilelist.cpp
QMap< QString, QString >
KDevelop::EnvironmentProfileList::EnvironmentProfileList
EnvironmentProfileList()
Definition: environmentprofilelist.cpp:193
debug
const bool debug
The goal of this utility is transforming the abstract unix-socket which is used by dbus into a TCP so...
Definition: dbus_socket_transformer/main.cpp:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:37:29 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/util

Skip menu "kdevplatform/util"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal