Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
76738c21
Commit
76738c21
authored
Apr 19, 2010
by
Tobias Hunger
Browse files
Add hasKey method to find out whether a envvar exists
Reviewed-by: dt
parent
ee8caa5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/environment.cpp
View file @
76738c21
...
...
@@ -291,6 +291,11 @@ void Environment::modify(const QList<EnvironmentItem> & list)
*
this
=
resultEnvironment
;
}
bool
Environment
::
hasKey
(
const
QString
&
key
)
{
return
m_values
.
contains
(
key
);
}
bool
Environment
::
operator
!=
(
const
Environment
&
other
)
const
{
return
!
(
*
this
==
other
);
...
...
src/plugins/projectexplorer/environment.h
View file @
76738c21
...
...
@@ -71,6 +71,7 @@ public:
void
set
(
const
QString
&
key
,
const
QString
&
value
);
void
unset
(
const
QString
&
key
);
void
modify
(
const
QList
<
EnvironmentItem
>
&
list
);
bool
hasKey
(
const
QString
&
key
);
void
appendOrSet
(
const
QString
&
key
,
const
QString
&
value
,
const
QString
&
sep
=
QString
());
void
prependOrSet
(
const
QString
&
key
,
const
QString
&
value
,
const
QString
&
sep
=
QString
());
...
...
src/plugins/projectexplorer/environmenteditmodel.cpp
View file @
76738c21
...
...
@@ -271,7 +271,7 @@ QModelIndex EnvironmentModel::addVariable()
QModelIndex
EnvironmentModel
::
addVariable
(
const
EnvironmentItem
&
item
)
{
bool
existsInBaseEnvironment
=
(
m_baseEnvironment
.
find
(
item
.
name
)
!=
m_baseEnvironment
.
constEnd
())
;
bool
existsInBaseEnvironment
=
m_baseEnvironment
.
hasKey
(
item
.
name
);
int
rowInResult
;
if
(
existsInBaseEnvironment
)
rowInResult
=
findInResult
(
item
.
name
);
...
...
@@ -301,7 +301,7 @@ void EnvironmentModel::removeVariable(const QString &name)
{
int
rowInResult
=
findInResult
(
name
);
int
rowInChanges
=
findInChanges
(
name
);
bool
existsInBaseEnvironment
=
m_baseEnvironment
.
find
(
name
)
!=
m_baseEnvironment
.
constEnd
(
);
bool
existsInBaseEnvironment
=
m_baseEnvironment
.
hasKey
(
name
);
if
(
existsInBaseEnvironment
)
{
m_items
.
removeAt
(
rowInChanges
);
updateResultEnvironment
();
...
...
@@ -347,7 +347,7 @@ bool EnvironmentModel::isUnset(const QString &name)
bool
EnvironmentModel
::
isInBaseEnvironment
(
const
QString
&
name
)
{
return
m_baseEnvironment
.
find
(
name
)
!=
m_baseEnvironment
.
constEnd
(
);
return
m_baseEnvironment
.
hasKey
(
name
);
}
QList
<
EnvironmentItem
>
EnvironmentModel
::
userChanges
()
const
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment