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
kdeconnect-kde
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
1
Merge Requests
1
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
Weixuan Xiao
kdeconnect-kde
Commits
2054288c
Commit
2054288c
authored
Sep 16, 2013
by
Albert Vaca Cintora
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KCM updated when pairing state changes externally
Added an unpaired() signal to KDED's Device exported by dbus
parent
dfe6c127
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
20 deletions
+49
-20
kcm/kcm.cpp
kcm/kcm.cpp
+44
-20
kcm/kcm.h
kcm/kcm.h
+1
-0
kded/device.cpp
kded/device.cpp
+3
-0
kded/device.h
kded/device.h
+1
-0
No files found.
kcm/kcm.cpp
View file @
2054288c
...
...
@@ -89,6 +89,15 @@ void KdeConnectKcm::resetSelection()
void
KdeConnectKcm
::
deviceSelected
(
const
QModelIndex
&
current
)
{
if
(
currentDevice
)
{
disconnect
(
currentDevice
,
SIGNAL
(
pairingSuccesful
()),
this
,
SLOT
(
pairingSuccesful
()));
disconnect
(
currentDevice
,
SIGNAL
(
pairingFailed
(
QString
)),
this
,
SLOT
(
pairingFailed
(
QString
)));
disconnect
(
currentDevice
,
SIGNAL
(
unpaired
()),
this
,
SLOT
(
unpaired
()));
}
//Store previous device config
pluginsConfigChanged
();
...
...
@@ -134,6 +143,13 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
kcmUi
->
name_label
->
setText
(
currentDevice
->
name
());
kcmUi
->
status_label
->
setText
(
currentDevice
->
isPaired
()
?
i18n
(
"(paired)"
)
:
i18n
(
"(unpaired)"
));
connect
(
currentDevice
,
SIGNAL
(
pairingSuccesful
()),
this
,
SLOT
(
pairingSuccesful
()));
connect
(
currentDevice
,
SIGNAL
(
pairingFailed
(
QString
)),
this
,
SLOT
(
pairingFailed
(
QString
)));
connect
(
currentDevice
,
SIGNAL
(
unpaired
()),
this
,
SLOT
(
unpaired
()));
KService
::
List
offers
=
KServiceTypeTrader
::
self
()
->
query
(
"KdeConnect/Plugin"
);
QList
<
KPluginInfo
>
scriptinfos
=
KPluginInfo
::
fromServices
(
offers
);
...
...
@@ -143,64 +159,72 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
connect
(
kcmUi
->
pluginSelector
,
SIGNAL
(
changed
(
bool
)),
this
,
SLOT
(
pluginsConfigChanged
()));
}
void
KdeConnectKcm
::
requestPair
()
{
if
(
!
currentDevice
)
return
;
if
(
!
currentDevice
)
{
return
;
}
kcmUi
->
messages
->
hide
();
kcmUi
->
pair_button
->
setVisible
(
false
);
kcmUi
->
progressBar
->
setVisible
(
true
);
connect
(
currentDevice
,
SIGNAL
(
pairingSuccesful
()),
this
,
SLOT
(
pairingSuccesful
()));
connect
(
currentDevice
,
SIGNAL
(
pairingFailed
(
QString
)),
this
,
SLOT
(
pairingFailed
(
QString
)));
currentDevice
->
requestPair
();
}
void
KdeConnectKcm
::
unpair
()
{
if
(
!
currentDevice
)
return
;
if
(
!
currentDevice
)
{
return
;
}
currentDevice
->
unpair
();
}
void
KdeConnectKcm
::
unpaired
()
{
DeviceDbusInterface
*
senderDevice
=
(
DeviceDbusInterface
*
)
sender
();
devicesModel
->
deviceStatusChanged
(
senderDevice
->
id
());
if
(
senderDevice
!=
currentDevice
)
return
;
kcmUi
->
pair_button
->
setVisible
(
true
);
kcmUi
->
unpair_button
->
setVisible
(
false
);
kcmUi
->
progressBar
->
setVisible
(
false
);
kcmUi
->
ping_button
->
setVisible
(
false
);
currentDevice
->
unpair
();
kcmUi
->
status_label
->
setText
(
i18n
(
"(unpaired)"
));
devicesModel
->
deviceStatusChanged
(
currentDevice
->
id
());
}
void
KdeConnectKcm
::
pairingFailed
(
const
QString
&
error
)
{
if
(
sender
()
!=
currentDevice
)
return
;
kcmUi
->
pair_button
->
setVisible
(
true
);
kcmUi
->
unpair_button
->
setVisible
(
false
);
kcmUi
->
progressBar
->
setVisible
(
false
);
kcmUi
->
ping_button
->
setVisible
(
false
);
kcmUi
->
status_label
->
setText
(
i18n
(
"(unpaired)"
));
kcmUi
->
messages
->
setText
(
i18n
(
"Error trying to pair: %1"
,
error
));
kcmUi
->
messages
->
animatedShow
();
kcmUi
->
progressBar
->
setVisible
(
false
);
kcmUi
->
pair_button
->
setVisible
(
true
);
}
void
KdeConnectKcm
::
pairingSuccesful
()
{
DeviceDbusInterface
*
sender
=
(
DeviceDbusInterface
*
)
sender
();
devicesModel
->
deviceStatusChanged
(
sender
->
id
());
DeviceDbusInterface
*
sender
Device
=
(
DeviceDbusInterface
*
)
sender
();
devicesModel
->
deviceStatusChanged
(
sender
Device
->
id
());
if
(
sender
!=
currentDevice
)
return
;
if
(
sender
Device
!=
currentDevice
)
return
;
kcmUi
->
progressBar
->
setVisible
(
false
);
kcmUi
->
unpair_button
->
setVisible
(
true
);
kcmUi
->
pair_button
->
setVisible
(
false
);
kcmUi
->
unpair_button
->
setVisible
(
true
);
kcmUi
->
progressBar
->
setVisible
(
false
);
kcmUi
->
ping_button
->
setVisible
(
true
);
kcmUi
->
status_label
->
setText
(
i18n
(
"(paired)"
));
}
...
...
kcm/kcm.h
View file @
2054288c
...
...
@@ -61,6 +61,7 @@ private Q_SLOTS:
void
resetSelection
();
void
pairingSuccesful
();
void
pairingFailed
(
const
QString
&
error
);
void
unpaired
();
private:
Ui
::
KdeConnectKcmUi
*
kcmUi
;
...
...
kded/device.cpp
View file @
2054288c
...
...
@@ -177,6 +177,8 @@ void Device::unpair()
reloadPlugins
();
//Will unload the plugins
Q_EMIT
unpaired
();
}
void
Device
::
pairingTimeout
()
...
...
@@ -333,6 +335,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
KSharedConfigPtr
config
=
KSharedConfig
::
openConfig
(
"kdeconnectrc"
);
config
->
group
(
"trusted_devices"
).
deleteGroup
(
id
());
reloadPlugins
();
Q_EMIT
unpaired
();
}
m_pairStatus
=
Device
::
NotPaired
;
...
...
kded/device.h
View file @
2054288c
...
...
@@ -100,6 +100,7 @@ Q_SIGNALS:
Q_SCRIPTABLE
void
pluginsChanged
();
Q_SCRIPTABLE
void
pairingSuccesful
();
Q_SCRIPTABLE
void
pairingFailed
(
const
QString
&
error
);
Q_SCRIPTABLE
void
unpaired
();
private:
QString
m_deviceId
;
...
...
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