Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Plasma applet for NetworkManager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Plasma applet for NetworkManager
Commits
bc9f70ff
Commit
bc9f70ff
authored
Mar 11, 2018
by
Martin Kacej
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saving new connections prototype, loading active connections settings prototype
parent
a4ef94d7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
26 deletions
+111
-26
libs/handler.cpp
libs/handler.cpp
+41
-1
libs/handler.h
libs/handler.h
+2
-0
mobile/package/contents/ui/ConnectionEditorDialog.qml
mobile/package/contents/ui/ConnectionEditorDialog.qml
+11
-7
mobile/package/contents/ui/IPDetailsSection.qml
mobile/package/contents/ui/IPDetailsSection.qml
+48
-15
mobile/package/contents/ui/NetworkDetailsView.qml
mobile/package/contents/ui/NetworkDetailsView.qml
+6
-3
mobile/package/contents/ui/RowItemDelegate.qml
mobile/package/contents/ui/RowItemDelegate.qml
+3
-0
No files found.
libs/handler.cpp
View file @
bc9f70ff
...
...
@@ -518,10 +518,50 @@ QVariantMap Handler::getConnectionSettings(const QString &connection, const QStr
if
(
!
con
)
return
QVariantMap
();
QVariantMap
map
=
con
->
settings
()
->
toMap
().
value
(
type
);
qCWarning
(
PLASMA_NM
)
<<
"Map:"
<<
con
->
settings
()
->
toMap
().
value
(
type
);
//
qCWarning(PLASMA_NM) << "Map:" <<con->settings()->toMap().value(type);
return
map
;
}
QVariantMap
Handler
::
getActiveConnectionInfo
(
const
QString
&
connection
)
{
if
(
connection
.
isEmpty
())
return
QVariantMap
();
NetworkManager
::
ActiveConnection
::
Ptr
con
=
NetworkManager
::
findActiveConnection
(
connection
);
if
(
!
con
){
qWarning
(
PLASMA_NM
)
<<
"Active"
<<
connection
<<
"not found"
;
return
QVariantMap
();
}
qWarning
(
PLASMA_NM
)
<<
"Active"
<<
con
->
ipV4Config
().
addresses
().
first
().
ip
().
toString
();
return
QVariantMap
();
}
void
Handler
::
addConnectionFromQML
(
const
QVariantMap
&
QMLmap
)
{
if
(
!
QMLmap
.
isEmpty
()){
NMVariantMapMap
map
;
for
(
QVariantMap
::
const_iterator
iter
=
QMLmap
.
begin
();
iter
!=
QMLmap
.
end
();
++
iter
)
{
qWarning
(
PLASMA_NM
)
<<
iter
.
key
()
<<
iter
.
value
();
//map.insert(iter.key(),iter.value());
}
if
(
!
QMLmap
.
contains
(
"uuid"
)){
QVariant
foo
=
QMLmap
.
value
(
"connection"
);
/*for(QVariantMap::const_iterator iter = foo.value<QVariantMap>().begin(); iter != foo.value<QVariantMap>().end(); ++iter) {
qWarning(PLASMA_NM) << iter.key() << iter.value();
map.insert(iter.key(),iter.value());
}
foo.insert("connection",NetworkManager::ConnectionSettings::createNewUuid());
QMLmap.insert("connection",foo);*/
}
map
.
insert
(
"connection"
,
QMLmap
);
//TODO add UUID, SSID
QDBusPendingReply
<
QDBusObjectPath
>
reply
=
NetworkManager
::
addConnection
(
map
);
QDBusPendingCallWatcher
*
watcher
=
new
QDBusPendingCallWatcher
(
reply
,
this
);
watcher
->
setProperty
(
"action"
,
AddConnection
);
watcher
->
setProperty
(
"connection"
,
map
.
value
(
"connection"
).
value
(
"id"
));
connect
(
watcher
,
&
QDBusPendingCallWatcher
::
finished
,
this
,
&
Handler
::
replyFinished
);
}
}
#if WITH_MODEMMANAGER_SUPPORT
void
Handler
::
unlockRequiredChanged
(
MMModemLock
modemLock
)
{
...
...
libs/handler.h
View file @
bc9f70ff
...
...
@@ -88,6 +88,8 @@ public Q_SLOTS:
void
enableWireless
(
bool
enable
);
QVariantMap
getConnectionSettings
(
const
QString
&
connection
,
const
QString
&
type
);
QVariantMap
getActiveConnectionInfo
(
const
QString
&
connection
);
void
addConnectionFromQML
(
const
QVariantMap
&
map
);
void
enableWwan
(
bool
enable
);
...
...
mobile/package/contents/ui/ConnectionEditorDialog.qml
View file @
bc9f70ff
...
...
@@ -26,8 +26,9 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
PlasmaExtras.ScrollArea
{
property
var
details
property
var
str
:
0
property
var
connection
:
{}
property
var
enabledSaving
:
(
editorIpSection
.
enabledSave
&&
editorSecuritySection
.
enabledSave
)
property
var
connection
:
({})
property
var
wirelessSettings
:
({})
property
var
enabledSaving
:
(
editorIpSection
.
enabledSave
&&
editorSecuritySection
.
enabledSave
&&
ssidField
.
text
)
ColumnLayout
{
id
:
columnlayout
...
...
@@ -55,11 +56,14 @@ PlasmaExtras.ScrollArea{
}
function
save
()
{
connection
[
"
ssid
"
]
=
ssidField
.
text
var
m
=
({});
connection
[
"
id
"
]
=
ssidField
.
text
connection
[
"
type
"
]
=
"
802-11-wireless
"
connection
[
"
mode
"
]
=
"
infrastructure
"
connection
[
"
method
"
]
=
editorIpSection
.
ipMethodComb
.
get
(
currentIndex
).
method
// TODO
console
.
info
(
'
Connection saved
'
)
wirelessSettings
[
"
mode
"
]
=
"
infrastructure
"
m
[
"
connection
"
]
=
connection
m
[
"
ipv4
"
]
=
editorIpSection
.
ipmap
m
[
"
802-11-wireless
"
]
=
wirelessSettings
handler
.
addConnectionFromQML
(
m
)
console
.
info
(
'
Connection saved
'
+
connection
[
"
id
"
])
}
}
mobile/package/contents/ui/IPDetailsSection.qml
View file @
bc9f70ff
...
...
@@ -23,32 +23,41 @@ import QtQuick.Layouts 1.2
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents
ColumnLayout
{
property
var
ipmap
:
[]
property
var
address
:
""
property
var
gateway
:
""
property
var
enabledSave
:
false
id
:
ipmain
property
var
ipmap
:
({})
property
alias
address
:
manualIPaddress
.
text
property
alias
gateway
:
manualIPgateway
.
text
property
alias
prefix
:
manualIPprefix
.
text
property
alias
dns
:
manualIPdns
.
text
property
bool
enabledSave
:
false
spacing
:
units
.
gridUnit
ColumnLayout
{
PlasmaComponents.Label
{
anchors.left
:
parent
.
left
text
:
i18n
(
"
IP settings
"
)
font.weight
:
Font
.
Bold
}
Controls.ComboBox
{
id
:
ipMethodComb
model
:
ListModel
{
ListElement
{
text
:
"
Automatic
"
;
method
:
"
auto
"
}
ListElement
{
text
:
"
Manual
"
;
method
:
"
manual
"
}
model
:[
"
Automatic
"
,
"
Manual
"
]
onCurrentIndexChanged
:
{
if
(
ipMethodComb
.
currentIndex
==
0
){
ipmain
.
state
=
"
Automatic
"
}
if
(
ipMethodComb
.
currentIndex
==
1
){
ipmain
.
state
=
"
Manual
"
}
}
}
}
ColumnLayout
{
id
:
manuaIPSettings
enabled
:
ipMethodComb
.
currentText
==
"
Manual
"
visible
:
ipMethodComb
.
currentText
==
"
Manual
"
id
:
manualIPSettings
Layout.fillWidth
:
true
PlasmaComponents.Label
{
...
...
@@ -56,8 +65,9 @@ ColumnLayout{
}
Controls.TextField
{
id
:
manualIPaddress
placeholderText
:
i18n
(
"
193.168.1.128
"
)
text
:
address
?
address
:
""
text
:
address
}
PlasmaComponents.Label
{
...
...
@@ -65,7 +75,9 @@ ColumnLayout{
}
Controls.TextField
{
id
:
manualIPgateway
placeholderText
:
i18n
(
"
192.168.1.1
"
)
text
:
gateway
}
PlasmaComponents.Label
{
...
...
@@ -73,7 +85,9 @@ ColumnLayout{
}
Controls.TextField
{
id
:
manualIPprefix
placeholderText
:
i18n
(
"
24
"
)
text
:
prefix
}
PlasmaComponents.Label
{
...
...
@@ -81,12 +95,31 @@ ColumnLayout{
}
Controls.TextField
{
id
:
manualIPdns
placeholderText
:
i18n
(
"
8.8.8.8
"
)
text
:
dns
}
}
onVisibleChanged
:
{
if
(
visible
==
true
){
address
=
ipmap
[
"
address-data
"
]
states
:
[
State
{
name
:
"
Automatic
"
PropertyChanges
{
target
:
manualIPSettings
;
visible
:
false
}
PropertyChanges
{
target
:
ipmain
;
ipmap
:
{
"
method
"
:
"
auto
"
}}
},
State
{
name
:
"
Manual
"
PropertyChanges
{
target
:
manualIPSettings
;
visible
:
true
}
PropertyChanges
{
target
:
ipmain
;
ipmap
:
{
"
method
"
:
"
manual
"
,
"
address-data
"
:
[{
"
address
"
:
address
,
"
prefix
"
:
prefix
}],
"
gateway
"
:
gateway
,
"
dns
"
:
dns
}
}
}
}
]
}
mobile/package/contents/ui/NetworkDetailsView.qml
View file @
bc9f70ff
...
...
@@ -116,15 +116,18 @@ PlasmaExtras.ScrollArea{
function
fillDetails
()
{
var
d
=
{}
for
(
var
i
=
0
;
i
<
(
details
.
length
/
2
);
i
++
){
//console.info(details[i])
d
[
details
[(
i
*
2
)]]
=
details
[(
i
*
2
)
+
1
]
}
for
(
var
i
in
map
)
{
if
(
map
.
hasOwnProperty
(
i
))
{
console
.
info
(
i
+
'
=
'
+
map
[
i
]);
}
}
if
(
d
[
'
Access point (SSID)
'
])
detailsDialog
.
titleText
=
d
[
'
Access point (SSID)
'
]
signal_strength
=
d
[
'
Signal strength
'
]
if
(
d
[
'
IPv4 Address
'
])
ip_address
=
detailsIP
.
adress
=
d
[
'
IPv4 Address
'
]
ip_address
=
detailsIP
.
ad
d
ress
=
d
[
'
IPv4 Address
'
]
if
(
d
[
'
Security type
'
])
security
=
d
[
'
Security type
'
]
if
(
d
[
'
Connection speed
'
])
...
...
mobile/package/contents/ui/RowItemDelegate.qml
View file @
bc9f70ff
...
...
@@ -103,6 +103,9 @@ Kirigami.SwipeListItem {
detailsDialog
.
titleText
=
i18n
(
"
Network details
"
)
}
map
=
handler
.
getConnectionSettings
(
ConnectionPath
,
"
ipv4
"
)
if
(
ConnectionState
==
PlasmaNM
.
Enums
.
Activated
){
handler
.
getActiveConnectionInfo
(
ConnectionPath
)
}
networkDetailsViewContent
.
map
=
map
console
.
info
(
map
[
"
method
"
])
networkDetailsViewContent
.
fillDetails
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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