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
Unmaintained
Network Management
Commits
0d6d7cb3
Commit
0d6d7cb3
authored
Jul 08, 2011
by
Lamarque Vieira Souza
Browse files
I think this is not actually needed.
BUG: 276406
parent
db25291c
Changes
2
Hide whitespace changes
Inline
Side-by-side
backends/NetworkManager/nmdbussettingsconnectionprovider.cpp
View file @
0d6d7cb3
...
...
@@ -28,8 +28,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include
<QUuid>
#include
<KDebug>
#include
<KAuth/Action>
#include
<kauthactionreply.h>
#include
<KMessageBox>
#include
<KLocale>
...
...
@@ -246,36 +244,6 @@ void NMDBusSettingsConnectionProvider::handleRemove(Knm::Activatable *)
}
bool
NMDBusSettingsConnectionProvider
::
checkAuthorization
(
const
Operation
oper
)
{
// See /usr/share/polkit-1/actions/org.freedesktop.network-manager-settings.system.policy
// KAuth is the KDE's Polkit wrapper.
KAuth
::
Action
action
(
QLatin1String
(
"org.freedesktop.network-manager-settings.system.modify"
));
QWidget
*
w
=
qobject_cast
<
QWidget
*>
(
parent
());
if
(
w
)
{
action
.
setParentWidget
(
w
);
}
KAuth
::
ActionReply
reply
=
action
.
execute
(
QLatin1String
(
"org.freedesktop.network-manager-settings.system"
));
if
(
reply
.
failed
())
{
QString
errorMessage
;
switch
(
oper
)
{
case
Add
:
errorMessage
=
i18n
(
"Adding connection failed. Error code is %1/%2 (%3)."
,
QString
::
number
(
reply
.
type
()),
QString
::
number
(
reply
.
errorCode
()),
reply
.
errorDescription
());
break
;
case
Remove
:
errorMessage
=
i18n
(
"Removing connection failed. Error code is %1/%2 (%3)."
,
QString
::
number
(
reply
.
type
()),
QString
::
number
(
reply
.
errorCode
()),
reply
.
errorDescription
());
break
;
case
Update
:
errorMessage
=
i18n
(
"Updating connection failed. Error code is %1/%2 (%3)."
,
QString
::
number
(
reply
.
type
()),
QString
::
number
(
reply
.
errorCode
()),
reply
.
errorDescription
());
break
;
}
KMessageBox
::
error
(
0
,
errorMessage
,
i18n
(
"Error"
));
return
false
;
}
return
true
;
}
void
NMDBusSettingsConnectionProvider
::
updateConnection
(
const
QString
&
uuid
,
Knm
::
Connection
*
newConnection
)
{
Q_D
(
NMDBusSettingsConnectionProvider
);
...
...
@@ -289,10 +257,6 @@ void NMDBusSettingsConnectionProvider::updateConnection(const QString &uuid, Knm
return
;
}
if
(
getuid
()
!=
0
&&
!
checkAuthorization
(
Update
))
{
return
;
}
QPair
<
Knm
::
Connection
*
,
RemoteConnection
*>
pair
=
d
->
connections
.
value
(
objPath
.
path
());
RemoteConnection
*
remote
=
pair
.
second
;
...
...
@@ -347,10 +311,6 @@ bool NMDBusSettingsConnectionProvider::addConnection(Knm::Connection *newConnect
if
(
newConnection
&&
newConnection
->
name
().
isEmpty
())
kWarning
()
<<
"Trying to add connection without a name!"
;
if
(
getuid
()
!=
0
&&
!
checkAuthorization
(
Add
))
{
return
false
;
}
QDBusPendingCall
reply
=
d
->
iface
->
AddConnection
(
map
);
reply
.
waitForFinished
();
...
...
@@ -492,10 +452,6 @@ bool NMDBusSettingsConnectionProvider::removeConnection(const QString &uuid)
return
false
;
}
if
(
getuid
()
!=
0
&&
!
checkAuthorization
(
Remove
))
{
return
false
;
}
QPair
<
Knm
::
Connection
*
,
RemoteConnection
*>
pair
=
d
->
connections
.
value
(
objPath
.
path
());
RemoteConnection
*
remote
=
pair
.
second
;
...
...
libs/ui/connectioneditor.cpp
View file @
0d6d7cb3
...
...
@@ -77,9 +77,6 @@ void ConnectionEditor::editConnection(Knm::Connection::Type type, const QVariant
cprefs
->
load
();
cprefs
->
validate
();
// For KAuth (KDE's Polkit wrapper): this seems to have no effect in the Ok button though.
configDialog
.
button
(
KDialog
::
Ok
)
->
setAuthAction
(
QLatin1String
(
"org.freedesktop.network-manager-settings.system.modify"
));
if
(
cprefs
&&
configDialog
.
exec
()
==
QDialog
::
Accepted
)
{
QStringList
changedConnections
;
changedConnections
<<
cprefs
->
connection
()
->
uuid
();
...
...
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