Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Weixuan Xiao
kdeconnect-kde
Commits
8fafdad5
Commit
8fafdad5
authored
Feb 27, 2014
by
Samoilenko Yuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some little crash fixes
parent
19740588
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
15 deletions
+18
-15
kded/kdeconnectd.cpp
kded/kdeconnectd.cpp
+9
-4
kded/plugins/pluginloader.cpp
kded/plugins/pluginloader.cpp
+2
-1
kded/plugins/sftp/sftpplugin.cpp
kded/plugins/sftp/sftpplugin.cpp
+7
-10
No files found.
kded/kdeconnectd.cpp
View file @
8fafdad5
...
@@ -43,11 +43,11 @@ void sighandler(int signum)
...
@@ -43,11 +43,11 @@ void sighandler(int signum)
}
}
}
}
void
initializeTermHandlers
(
QCoreApplication
*
app
)
void
initializeTermHandlers
(
QCoreApplication
*
app
,
Daemon
*
daemon
)
{
{
::
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
sigtermfd
);
::
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
sigtermfd
);
QSocketNotifier
*
snTerm
=
new
QSocketNotifier
(
sigtermfd
[
1
],
QSocketNotifier
::
Read
,
app
);
QSocketNotifier
*
snTerm
=
new
QSocketNotifier
(
sigtermfd
[
1
],
QSocketNotifier
::
Read
,
app
);
QObject
::
connect
(
snTerm
,
SIGNAL
(
activated
(
int
)),
app
,
SLOT
(
quit
()));
QObject
::
connect
(
snTerm
,
SIGNAL
(
activated
(
int
)),
daemon
,
SLOT
(
deleteLater
()));
action
.
sa_handler
=
sighandler
;
action
.
sa_handler
=
sighandler
;
sigemptyset
(
&
action
.
sa_mask
);
sigemptyset
(
&
action
.
sa_mask
);
...
@@ -73,8 +73,13 @@ int main(int argc, char* argv[])
...
@@ -73,8 +73,13 @@ int main(int argc, char* argv[])
KApplication
app
(
true
);
// WARNING GUI required for QClipboard access
KApplication
app
(
true
);
// WARNING GUI required for QClipboard access
app
.
disableSessionManagement
();
app
.
disableSessionManagement
();
initializeTermHandlers
(
&
app
);
new
Daemon
(
&
app
);
//Force daemon to destroy when KApplications in alive
//belongs to bug KApplications resoure freeing
Daemon
*
daemon
=
new
Daemon
(
0
);
QObject
::
connect
(
daemon
,
SIGNAL
(
destroyed
(
QObject
*
)),
&
app
,
SLOT
(
quit
()));
initializeTermHandlers
(
&
app
,
daemon
);
return
app
.
exec
();
return
app
.
exec
();
}
}
...
...
kded/plugins/pluginloader.cpp
View file @
8fafdad5
...
@@ -77,7 +77,8 @@ PluginData PluginLoader::instantiatePluginForDevice(const QString& name, Device*
...
@@ -77,7 +77,8 @@ PluginData PluginLoader::instantiatePluginForDevice(const QString& name, Device*
QVariant
deviceVariant
=
QVariant
::
fromValue
<
Device
*>
(
device
);
QVariant
deviceVariant
=
QVariant
::
fromValue
<
Device
*>
(
device
);
ret
.
plugin
=
(
KdeConnectPlugin
*
)
factory
->
create
<
QObject
>
(
device
,
QVariantList
()
<<
deviceVariant
);
//FIXME any reason to use QObject in template param instead KdeConnectPlugin?
ret
.
plugin
=
factory
->
create
<
KdeConnectPlugin
>
(
device
,
QVariantList
()
<<
deviceVariant
);
if
(
!
ret
.
plugin
)
{
if
(
!
ret
.
plugin
)
{
kDebug
(
kdeconnect_kded
())
<<
"Error loading plugin"
;
kDebug
(
kdeconnect_kded
())
<<
"Error loading plugin"
;
return
ret
;
return
ret
;
...
...
kded/plugins/sftp/sftpplugin.cpp
View file @
8fafdad5
...
@@ -44,13 +44,10 @@ static const QSet<QString> fields_c = QSet<QString>() << "ip" << "port" << "user
...
@@ -44,13 +44,10 @@ static const QSet<QString> fields_c = QSet<QString>() << "ip" << "port" << "user
struct
SftpPlugin
::
Pimpl
struct
SftpPlugin
::
Pimpl
{
{
Pimpl
()
Pimpl
()
{}
{
//Add KIO entry to Dolphin's Places
placesModel
=
new
KFilePlacesModel
();
}
KFilePlacesModel
*
placesModel
;
//Add KIO entry to Dolphin's Places
KFilePlacesModel
placesModel
;
QPointer
<
Mounter
>
mounter
;
QPointer
<
Mounter
>
mounter
;
};
};
...
@@ -74,17 +71,17 @@ void SftpPlugin::addToDolphin()
...
@@ -74,17 +71,17 @@ void SftpPlugin::addToDolphin()
{
{
removeFromDolphin
();
removeFromDolphin
();
KUrl
kioUrl
(
"kdeconnect://"
+
device
()
->
id
()
+
"/"
);
KUrl
kioUrl
(
"kdeconnect://"
+
device
()
->
id
()
+
"/"
);
m_d
->
placesModel
->
addPlace
(
device
()
->
name
(),
kioUrl
,
"kdeconnect"
);
m_d
->
placesModel
.
addPlace
(
device
()
->
name
(),
kioUrl
,
"kdeconnect"
);
kDebug
(
kdeconnect_kded
())
<<
"add to dolphin"
;
kDebug
(
kdeconnect_kded
())
<<
"add to dolphin"
;
}
}
void
SftpPlugin
::
removeFromDolphin
()
void
SftpPlugin
::
removeFromDolphin
()
{
{
KUrl
kioUrl
(
"kdeconnect://"
+
device
()
->
id
()
+
"/"
);
KUrl
kioUrl
(
"kdeconnect://"
+
device
()
->
id
()
+
"/"
);
QModelIndex
index
=
m_d
->
placesModel
->
closestItem
(
kioUrl
);
QModelIndex
index
=
m_d
->
placesModel
.
closestItem
(
kioUrl
);
while
(
index
.
row
()
!=
-
1
)
{
while
(
index
.
row
()
!=
-
1
)
{
m_d
->
placesModel
->
removePlace
(
index
);
m_d
->
placesModel
.
removePlace
(
index
);
index
=
m_d
->
placesModel
->
closestItem
(
kioUrl
);
index
=
m_d
->
placesModel
.
closestItem
(
kioUrl
);
}
}
}
}
...
...
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