Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
transfer-engine
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mer-core
transfer-engine
Commits
b0132ebc
Commit
b0132ebc
authored
Aug 05, 2016
by
Slava Monich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[transfer-engine] Added clearTransfer method to the D-Bus interface. Contributes to JB#15452
parent
53895a46
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
4 deletions
+61
-4
dbus/org.nemo.transferengine.xml
dbus/org.nemo.transferengine.xml
+4
-0
declarative/declarativetransfermodel.cpp
declarative/declarativetransfermodel.cpp
+8
-1
declarative/declarativetransfermodel.h
declarative/declarativetransfermodel.h
+2
-1
lib/transferengineclient.cpp
lib/transferengineclient.cpp
+10
-1
lib/transferengineclient.h
lib/transferengineclient.h
+2
-1
src/dbmanager.cpp
src/dbmanager.cpp
+19
-0
src/dbmanager.h
src/dbmanager.h
+2
-0
src/transferengine.cpp
src/transferengine.cpp
+12
-0
src/transferengine.h
src/transferengine.h
+2
-0
No files found.
dbus/org.nemo.transferengine.xml
View file @
b0132ebc
...
...
@@ -99,6 +99,10 @@
<arg
name=
"transferId"
type=
"i"
direction=
"in"
/>
</method>
<method
name=
"clearTransfer"
>
<arg
name=
"transferId"
type=
"i"
direction=
"in"
/>
</method>
# enable or disable notifications
<method
name=
"enableNotifications"
>
<arg
name=
"enable"
type=
"b"
direction=
"in"
/>
...
...
declarative/declarativetransfermodel.cpp
View file @
b0132ebc
/****************************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Copyright (C) 2014
-2016
Jolla Ltd.
** Contact: Marko Mattila <marko.mattila@jolla.com>
** All rights reserved.
**
...
...
@@ -134,6 +134,13 @@ void TransferModel::clearTransfers()
}
}
void
TransferModel
::
clearTransfer
(
int
transferId
)
{
if
(
m_client
)
{
m_client
->
clearTransfer
(
transferId
);
}
}
QHash
<
int
,
QByteArray
>
TransferModel
::
roleNames
()
const
{
return
m_roles
;
...
...
declarative/declarativetransfermodel.h
View file @
b0132ebc
/****************************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Copyright (C) 2014
-2016
Jolla Ltd.
** Contact: Marko Mattila <marko.mattila@jolla.com>
** All rights reserved.
**
...
...
@@ -83,6 +83,7 @@ public:
Q_INVOKABLE
QJSValue
get
(
int
index
)
const
;
Q_INVOKABLE
void
clearTransfers
();
Q_INVOKABLE
void
clearTransfer
(
int
transferId
);
QHash
<
int
,
QByteArray
>
roleNames
()
const
;
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
...
...
lib/transferengineclient.cpp
View file @
b0132ebc
/****************************************************************************************
**
** Copyright (C) 2013 Jolla Ltd.
** Copyright (C) 2013
-2016
Jolla Ltd.
** Contact: Marko Mattila <marko.mattila@jollamobile.com>
** All rights reserved.
**
...
...
@@ -366,6 +366,15 @@ void TransferEngineClient::clearTransfers()
d
->
m_client
->
clearTransfers
();
}
/*!
Private method for QML interface to clear a finished, canceled or interrupted event.
*/
void
TransferEngineClient
::
clearTransfer
(
int
transferId
)
{
Q_D
(
TransferEngineClient
);
d
->
m_client
->
clearTransfer
(
transferId
);
}
/*!
Private method for QML interface to enable notifications.
*/
...
...
lib/transferengineclient.h
View file @
b0132ebc
/****************************************************************************************
**
** Copyright (C) 2013 Jolla Ltd.
** Copyright (C) 2013
-2016
Jolla Ltd.
** Contact: Marko Mattila <marko.mattila@jollamobile.com>
** All rights reserved.
**
...
...
@@ -84,6 +84,7 @@ public:
private:
void
cbCancelTransfer
(
int
transferId
);
void
cbRestartTransfer
(
int
transferId
);
void
clearTransfer
(
int
transferId
);
void
clearTransfers
();
void
enableNotifications
(
bool
enable
);
bool
notificationsEnabled
()
const
;
...
...
src/dbmanager.cpp
View file @
b0132ebc
...
...
@@ -613,6 +613,25 @@ bool DbManager::clearTransfers()
return
true
;
}
bool
DbManager
::
clearTransfer
(
int
key
)
{
QSqlQuery
query
;
TransferEngineData
::
TransferStatus
status
=
transferStatus
(
key
);
switch
(
status
)
{
case
TransferEngineData
:
:
TransferFinished
:
case
TransferEngineData
:
:
TransferCanceled
:
case
TransferEngineData
:
:
TransferInterrupted
:
if
(
query
.
exec
(
QString
(
"DELETE FROM transfers WHERE transfer_id='%1';"
).
arg
(
QString
::
number
(
key
))))
{
return
true
;
}
qWarning
()
<<
"Failed to execute SQL query. Couldn't delete transfer"
<<
key
;
return
false
;
default:
qWarning
()
<<
"Not clearing transfer"
<<
key
<<
"because its status is"
<<
status
;
return
false
;
}
}
int
DbManager
::
transferCount
()
const
{
QSqlQuery
query
;
...
...
src/dbmanager.h
View file @
b0132ebc
...
...
@@ -61,6 +61,8 @@ public:
bool
clearFailedTransfers
(
int
excludeKey
,
TransferEngineData
::
TransferType
type
);
bool
clearTransfer
(
int
key
);
bool
clearTransfers
();
int
transferCount
()
const
;
...
...
src/transferengine.cpp
View file @
b0132ebc
...
...
@@ -1248,6 +1248,18 @@ void TransferEngine::clearTransfers()
}
}
/*!
DBus adaptor calls this method to remove a finished, canceled or interrupted transfer from the database.
*/
void
TransferEngine
::
clearTransfer
(
int
transferId
)
{
Q_D
(
TransferEngine
);
d
->
exitSafely
();
if
(
DbManager
::
instance
()
->
clearTransfer
(
transferId
))
{
emit
transfersChanged
();
}
}
/*!
DBus adaptor calls this method to cancel an existing transfer with a \a transferId.
...
...
src/transferengine.h
View file @
b0132ebc
...
...
@@ -89,6 +89,8 @@ public Q_SLOTS:
void
clearTransfers
();
void
clearTransfer
(
int
transferId
);
void
cancelTransfer
(
int
transferId
);
void
enableNotifications
(
bool
enable
);
...
...
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