Class for modifing information of transfer shown in transfer-ui. More...
Public Slots |
|
void | cancelSlot () |
Slot used by client. |
|
void | errorRepairSlot () |
Slot uesd by client for error repair. |
|
void | pauseSlot () |
Slot used by client. |
|
void | sendLastProgress () |
user opened transfer-ui and send the last stored progress value to the transfer-ui |
|
void | startSlot () |
Slot used by client. |
|
void | tuiLaunched () |
Slot connecting to the signal from TUI when it launches. |
|
Signals |
|
void | cancel () |
Signal emited when user has asked transfer to be cancelled. |
|
void | pause () |
Signal emited when user has asked transfer to be paused. |
|
void | repairError () |
Signal emited when user has asked to retry or to fix the failed transfer. |
|
void | start () |
Signal emited when user has asked transfer to be started. |
|
Public Member Functions |
|
virtual bool | commit () |
commit any previous set functions after waitForCommit called |
|
virtual QString | lastError () const |
Get last error message of class (note: this is not error messages you send to TransferUI). |
|
virtual bool | markCancelFailed (const QString &message) |
set the transfer cancel as failed |
|
virtual bool | markCancelled () |
Mark transfer cancelled. |
|
bool | markCompleted (bool showInHistory=false, const QString &replaceId="", const QString &resultUri=QString()) |
markCompleted. |
|
bool | markCompletedTemporary (const QString &resultUri, const QString &resultMimeType, bool removeWhenCleared) |
mark transfer completed, and provide temporary file details This assumes the transfers is shown in history. |
|
virtual bool | markDone (const QString &message="") |
markDone transfer Done |
|
virtual bool | markFailure (const QString &headerMessage, const QString &description) |
Marks the transfer as failed. |
|
virtual bool | markPaused () |
Mark transfer paused. |
|
virtual bool | markRepairableFailure (const QString &headerMessage, const QString &description, const QString &actionName) |
Marks the transfer as failed. |
|
virtual bool | markResumed () |
Mark transfer resumed. |
|
virtual bool | setActive (float done=0.0) |
Move transfer to active state. |
|
virtual bool | setCancelButtonText (const QString &text) |
set the custom cancel text for the transfer. |
|
virtual bool | setCanPause (bool canPause) |
Define if transfer can be paused. |
|
virtual bool | setCurrentFileIndex (int index) |
Define current file index which being transferred. |
|
virtual bool | setEstimate (int seconds) |
Define how much time will transfer last. |
|
virtual bool | setFilesCount (int count) |
Define how many total files are present in transfer. |
|
virtual bool | setIcon (const QString &iconId) |
set icon id for the transfer. |
|
bool | setImageFromFilePath (const QString &filePath) |
set transfer image from the give filename path. |
|
virtual bool | setMessage (const QString &message) |
Define current state message. |
|
virtual bool | setName (const QString &name) |
Set name for transfer. |
|
virtual bool | setPending (const QString &reason) |
Move transfer back to pending state. |
|
virtual bool | setProgress (float done) |
Define how much of transfer is done. |
|
virtual bool | setSendNow (bool canSendNow) |
Define if transfer can be sent immediately. |
|
virtual bool | setSize (quint64 bytes) |
Define size of transfer. |
|
virtual bool | setTargetName (const QString &name) |
Set the name of the account or target used in transfer. |
|
virtual bool | setThumbnailForFile (const QString &fileName, const QString &mimeType) |
set thumbnail file for the transfer. |
|
virtual bool | setTransferType (Client::TransferType transferType) |
set the Type of the Transfer |
|
virtual bool | setTransferTypeString (const QString &title) |
set the transfer type string. |
|
Transfer (Client *parent) | |
constructor |
|
virtual QString | transferId () const |
Get unique id of transfer. |
|
virtual bool | updateStatus (float done, int seconds) |
Update how much of transfer is done and what is the current estimate. |
|
virtual void | waitForCommit () |
wait for the commit call. |
|
Protected Attributes |
|
TransferPrivate *const | d_ptr |
private class |
Class for modifing information of transfer shown in transfer-ui.
TransferUI::Transfer::Transfer | ( | Client * | parent | ) |
constructor
parent |
virtual bool TransferUI::Transfer::commit | ( | ) | [virtual] |
commit any previous set functions after waitForCommit called
void TUITestClient::registerTransfer() { //Add a new upload transfer in TransferUI uploadTransfer = client->registerTransfer("New Upload Transfer",TransferUI::Client::TRANSFER_TYPES_UPLOAD); //Add a new download transfer in TransferUI downloadTransfer = client->registerTransfer("New Download Transfer", TransferUI::Client::TRANSFER_TYPES_DOWNLOAD); //Add a new Sync transfer in TransferUI syncTransfer = client->registerTransfer("Synchronizing", TransferUI::Client::TRANSFER_TYPES_SYNC); //Commit usage uploadTransfer->waitForCommit(); //start commit uploadTransfer->setName("filename.jpg"); uploadTransfer->setTargetName("picasa"); uploadTransfer->setFilesCount(10); uploadTransfer->setSize(1000); uploadTransfer->commit(); //end commit //Reduces three dbus calls to transfer-ui }
virtual QString TransferUI::Transfer::lastError | ( | ) | const [virtual] |
Get last error message of class (note: this is not error messages you send to TransferUI).
virtual bool TransferUI::Transfer::markCancelFailed | ( | const QString & | message | ) | [virtual] |
set the transfer cancel as failed
message | localized string describing what went wrong |
void TUITestClient::transferCancelled(Transfer * transfer) { //User has cancelled the transfer, take neccessary action and mark transfer //as cancelled //eg uploadTransfer was cancelled by the user //eg. send the cancel notification to the service //if cancel was sucessful transfer->markCancelled(); //else //% "Something went wrong in cancel process" QString cancelErrMsg = qtTrid("qtn_tui_cancel_errxxxx"); transfer->markCancelFailed(cancelErrMsg); //Remove from the list of client transfers client->removeTransfer(uploadTransfer->transferId()); }
virtual bool TransferUI::Transfer::markCancelled | ( | ) | [virtual] |
Mark transfer cancelled.
void TUITestClient::transferCancelled(Transfer * transfer) { //User has cancelled the transfer, take neccessary action and mark transfer //as cancelled //eg uploadTransfer was cancelled by the user //eg. send the cancel notification to the service //if cancel was sucessful transfer->markCancelled(); //else //% "Something went wrong in cancel process" QString cancelErrMsg = qtTrid("qtn_tui_cancel_errxxxx"); transfer->markCancelFailed(cancelErrMsg); //Remove from the list of client transfers client->removeTransfer(uploadTransfer->transferId()); }
bool TransferUI::Transfer::markCompleted | ( | bool | showInHistory = false , |
|
const QString & | replaceId = "" , |
|||
const QString & | resultUri = QString() |
|||
) |
markCompleted.
mark the transfer as completed. This function removes transfer from the transfer-ui or shown in the history list. Completed transfers can be shown in the history list depeneding on the parameters set.
showInHistory | If this parameter is set to true, then the transfer is shown in the history list. Default value of this parameter is set to false, by default completed transfer will not be shown in history list. If showInHistory is set to false, transfer will be displayed for 2 secs with "Completed" message and will be removed from the transfers list. | |
replaceId | If showInHistory is set to false, this parameter has no effect. If replace Id is provided, then the transfer is replaced in the history list view for the given replaceId. If there is no transfer with the given replaceId, then the transfer is added to history list view. Default value is empty, transfers will be added into history list and not replaced. | |
resultUri | uri of the result file. If provided, transfer-ui launches the application associated with the given uri. If the Uri is not valid, default dialog is displayed when the user taps on the transfers. resultUri can be of type i) Tracker object uri Uri represents a resource with nie:url and nie:mimeType properties. If there is a default action provided for the given mimeType, default action will be triggered. ii) File uri object Default action for the given file will be triggered iii) Uri with some scheme Default action for the given scheme will be triggered iv) Relative file path Default action for the given file will be triggered. |
bool TransferUI::Transfer::markCompletedTemporary | ( | const QString & | resultUri, | |
const QString & | resultMimeType, | |||
bool | removeWhenCleared | |||
) |
mark transfer completed, and provide temporary file details This assumes the transfers is shown in history.
When this function is used to mark the transfer as completed, Transfer UI will try to launch the result file from the system provided quick viewers, for the given mimetype of the result uri. If removeWhenCleared is set, Transfer UI takes the responsibility to clean up the temp files, when the transfers are cleared from the transfer-ui using "clear" button.
resultUri | local file path of the file | |
resultMimeType | mime type of the result file. This used to get the appropriate quick viewer from the content action. If the mime type does not have a x-temp- prefix, it is added by Transfer UI. | |
removeWhenCleared | If true, the file referred to by the resultUri is deleted by Transfer UI when the transfer is cleared from the list of completed transfers. |
virtual bool TransferUI::Transfer::markDone | ( | const QString & | message = "" |
) | [virtual] |
markDone transfer Done
message | localized string describing the completion message. Default message is set to "Completed" in TransferUI. |
void TUITestClient::transferDone() { //Transfer is completed , update TransferUI uploadTransfer->markDone(); //Remove from the list of client transfers client->removeTransfer(uploadTransfer->transferId()); }
virtual bool TransferUI::Transfer::markFailure | ( | const QString & | headerMessage, | |
const QString & | description | |||
) | [virtual] |
Marks the transfer as failed.
This error can't be repaired. The messages are not localized in TransferUI, it should be done in the applications.
headerMessage | localized string describing error header message | |
description | localized string describing error details message |
void TUITestClient::transferError() { //Something went wrong in the transfer, update error in TransferUI //% "Some header here" QString headerMsg = qtTrId("qtn_tui_err_headerxxxx"); //% "Some details description here" QString detailsMsg = qtTrId("qtn_tui_err_msgxxxx"); //if error is non - repairable uploadTransfer->markFailure(headerMsg, detailsMsg); //if error is repairable //% "Retry" QString actionName = qtTrId("qtn_tui_repairxx"); uploadTransfer->markRepairableFailure(headerMsg, detailsMsg, actionName); }
virtual bool TransferUI::Transfer::markPaused | ( | ) | [virtual] |
Mark transfer paused.
void TUITestClient::transferPaused(Transfer * transfer) { //User requested transfer to pause, pause transfer and update TransferUI transfer->markPaused(); }
virtual bool TransferUI::Transfer::markRepairableFailure | ( | const QString & | headerMessage, | |
const QString & | description, | |||
const QString & | actionName | |||
) | [virtual] |
Marks the transfer as failed.
This error can be repaired. Signal Client::repairErrorTransfer \ Transfer::repairError is emitted if user requested to repair error.
headerMessage | Error Message Header | |
description | Error Message details | |
actionName | Action Name displayed in the Action Button |
void TUITestClient::transferError() { //Something went wrong in the transfer, update error in TransferUI //% "Some header here" QString headerMsg = qtTrId("qtn_tui_err_headerxxxx"); //% "Some details description here" QString detailsMsg = qtTrId("qtn_tui_err_msgxxxx"); //if error is non - repairable uploadTransfer->markFailure(headerMsg, detailsMsg); //if error is repairable //% "Retry" QString actionName = qtTrId("qtn_tui_repairxx"); uploadTransfer->markRepairableFailure(headerMsg, detailsMsg, actionName); }
virtual bool TransferUI::Transfer::markResumed | ( | ) | [virtual] |
Mark transfer resumed.
void TUITestClient::transferResumed(Transfer * transfer) { //User requested transfer to resume, resume transfer and update TransferUI transfer->markResumed(); }
void TransferUI::Transfer::repairError | ( | ) | [signal] |
Signal emited when user has asked to retry or to fix the failed transfer.
virtual bool TransferUI::Transfer::setActive | ( | float | done = 0.0 |
) | [virtual] |
Move transfer to active state.
done | How much of tranfer is done |
void TUITestClient::updateStatusActive() { //Update the transfer state to active and set progress to 75% uploadTransfer->setActive(0.75); }
virtual bool TransferUI::Transfer::setCancelButtonText | ( | const QString & | text | ) | [virtual] |
set the custom cancel text for the transfer.
This text will be displayed both in Details Dialog as well as in Error Dialog
text | custom localized cancel text for the transfer.void TUITestClient::updateFileTypeIcon() { //If the thumbnail image is not availabe for the transfer provide transfer //file type icon downloadTransfer->setIcon("icon-m-file-unknown"); } |
virtual bool TransferUI::Transfer::setCanPause | ( | bool | canPause | ) | [virtual] |
Define if transfer can be paused.
This is not applicable for uploads. Default implementation is set to false, and transfers can't be paused. If pause is enabled, when user pauses the transfer in TransferUI , Signals Client::pauseTransfer / Transfer::pause are emitted.
canPause | true if transfer can be paused |
void TUITestClient::updateCanPause() { //Update if transfer can pause, this is not applicable for uploads downloadTransfer->setCanPause(true); }
virtual bool TransferUI::Transfer::setCurrentFileIndex | ( | int | index | ) | [virtual] |
Define current file index which being transferred.
index | current file index |
void TUITestClient::updateCurrentFileIndex() { //Update current file index, this is the index of the current file being //transferred, TransferUI displays 2/10 in its list view and 1/10 in the //dialog view uploadTransfer->setCurrentFileIndex(2); }
virtual bool TransferUI::Transfer::setEstimate | ( | int | seconds | ) | [virtual] |
Define how much time will transfer last.
seconds | How many seconds transfer will still take (values bigger than 0). Other values will tell that estimation can't be calculated and will not be shown in TransferUI. |
void TUITestClient::updateEstimate() { //Update the transfer estimate is seconds //set estimate to 2 secs uploadTransfer->setEstimate(100); //set estimate to 2 secs downloadTransfer->setEstimate(100); //set estimate to 2 secs syncTransfer->setEstimate(100); }
virtual bool TransferUI::Transfer::setFilesCount | ( | int | count | ) | [virtual] |
Define how many total files are present in transfer.
count | Number of files in the transfer |
void TUITestClient::updateFilesCount() { //Update total files count in the transfer uploadTransfer->setFilesCount(10); }
virtual bool TransferUI::Transfer::setIcon | ( | const QString & | iconId | ) | [virtual] |
set icon id for the transfer.
This function igonres any previous requests made to show thumbnail using setThumbnailForFile function.
iconId | icon id which will be displayed in transfer-ui |
void TUITestClient::updateFileTypeIcon() { //If the thumbnail image is not availabe for the transfer provide transfer //file type icon downloadTransfer->setIcon("icon-m-file-unknown"); }
bool TransferUI::Transfer::setImageFromFilePath | ( | const QString & | filePath | ) |
set transfer image from the give filename path.
filePath | absolute path of the file name from which Image will be loaded |
virtual bool TransferUI::Transfer::setMessage | ( | const QString & | message | ) | [virtual] |
Define current state message.
This function returns false if the state of the transfer is not inactive.
message | New state message |
void TUITestClient::updateMessage() { //Update message in TransferUI. Message should be localized string //% "New Message" QString newMsgString = qtTrid("qtn_tui_xxxx_xxxx"); uploadTransfer->setMessage(newMsgString); }
virtual bool TransferUI::Transfer::setName | ( | const QString & | name | ) | [virtual] |
Set name for transfer.
name | New name for transfer. Empty string will disable name |
void TUITestClient::updateTransferName() { //Update upload transfer name uploadTransfer->setName("filename.jpg"); //Update download transfer name downloadTransfer->setName("Downloading filename.pdf"); }
virtual bool TransferUI::Transfer::setPending | ( | const QString & | reason | ) | [virtual] |
Move transfer back to pending state.
reason | Reason why transfer went back to pending state, for example "Waiting for connection..." |
void TUITestClient::updateStatusPending() { //Update the transfer state to pending, Msg is localized string //% "Waiting for connection" QString uploadMsg = qtTrid("qtn_tui_xxxxx_xxxxx"); uploadTransfer->setPending(uploadMsg); //% "Connecting to the service" QString downloadMsg = qtTrid("qtn_tui_xxxxx_xxxxx"); downloadTransfer->setPending(downloadMsg); }
virtual bool TransferUI::Transfer::setProgress | ( | float | done | ) | [virtual] |
Define how much of transfer is done.
done | From 0.0 (=0.0%) to 1.0 (=100%) how much of transfer is done. Other values will change progress to undefined. |
void TUITestClient::updateProgress() { //Update upload transfer progress to 56% uploadTransfer->setProgress(.56); }
virtual bool TransferUI::Transfer::setSendNow | ( | bool | canSendNow | ) | [virtual] |
Define if transfer can be sent immediately.
This is not applicable for downloads. Default implementation is set to false. If send now is enabled, when user clicks on send now in TransferUI , Signals Client::startTransfer / Transfer::start is emitted
canSendNow | set if transfer can be sent immediately. |
virtual bool TransferUI::Transfer::setSize | ( | quint64 | bytes | ) | [virtual] |
Define size of transfer.
bytes | Size in bytes. If size is set to 0, no size will be displayed. |
void TUITestClient::updateSize() { //Update total size of the transfer in bytes uploadTransfer->setSize(1000); //if Size is set to 0, if the transfer is active, then the progress bar in //TransferUI will be shown in RUN_UNKNOWN state syncTransfer->setSize(0); }
virtual bool TransferUI::Transfer::setTargetName | ( | const QString & | name | ) | [virtual] |
Set the name of the account or target used in transfer.
name | Name of the service or target of the file |
void TUITestClient::updateTargetName() { //Update target name for upload transfer uploadTransfer->setTargetName("picasa"); }
virtual bool TransferUI::Transfer::setThumbnailForFile | ( | const QString & | fileName, | |
const QString & | mimeType | |||
) | [virtual] |
set thumbnail file for the transfer.
transfer-ui try to resolve thumbnail for the give file. Resolving thumbnail is asyncronus call, any new setIcon function call or a new setThumbnailForFile function call will ignore this request. fileName should be tracker indexed for thumbnailer to fetch the thumbnail. For non tracker indexed file use setImageFromFilePath
fileName | file path for which transfer-ui will fetch thumbnail from the thumbnailer | |
mimeType | file mime type used to fetch thumbnail from thumbnailer |
void TUITestClient::updateThumbnail() { //Update the thumbnail image uploadTransfer->setThumbnailForFile("file://user/home/MyDocs/.images/somefile.jpg", "image/jpeg"); }
virtual bool TransferUI::Transfer::setTransferType | ( | Client::TransferType | transferType | ) | [virtual] |
set the Type of the Transfer
transferType | type of the transfer. Client::TransferType enum |
virtual bool TransferUI::Transfer::setTransferTypeString | ( | const QString & | title | ) | [virtual] |
set the transfer type string.
This string will be displayed in title of transfer details dialog in transfer-ui. e.g. for bluetooth, if the transfer is from device , then the title can be "Send" , if the transfer is to device, then the title can be "Receive".
title | localized title which will be displayed in the transfer details dialog |
void TransferUI::Transfer::start | ( | ) | [signal] |
Signal emited when user has asked transfer to be started.
In case of failed transfer repairError signal is used instead of this.
virtual QString TransferUI::Transfer::transferId | ( | ) | const [virtual] |
Get unique id of transfer.
virtual bool TransferUI::Transfer::updateStatus | ( | float | done, | |
int | seconds | |||
) | [virtual] |
Update how much of transfer is done and what is the current estimate.
done | How much of transfer is done [0.0 ... 1.0] | |
seconds | How many seconds until transfer is done |
void TUITestClient::updateStatus() { //Update the current status of the transfer w.r.t to progress and estimate //Set progress to 76% and estimate to 2 mins uploadTransfer->updateStatus(0.76,100); }
virtual void TransferUI::Transfer::waitForCommit | ( | ) | [virtual] |
wait for the commit call.
Once the commit is recvd forward set functions to transfer-ui. All set functions can be commitable functions. When this function is called, all the subsequent set function will be queued. After recieving commit() call, these set functions will be forwarded to transfer-ui.
These are the functions which are commitable
Commitable functions |
setTargetName |
setFilesCount |
setSize |
setCurrentFileIndex |
setThumbnailForFile |
setMessage |
setEstimate |
setCanPause |
setName |
setIcon |
setCancelButtonText |
setProgress has a different mechanism, hence setProgress can not be a commitable functions.
Note on auto commit
When the state change functions
Auto Commit functions |
setPending |
setActive |
markFailed |
markCancelled |
markResumed |
markDone |
markFailure |
markRepairableFailure |
are called , previous set functions after waitForCommit will be sent to transfer-ui automatically.
void TUITestClient::registerTransfer() { //Add a new upload transfer in TransferUI uploadTransfer = client->registerTransfer("New Upload Transfer",TransferUI::Client::TRANSFER_TYPES_UPLOAD); //Add a new download transfer in TransferUI downloadTransfer = client->registerTransfer("New Download Transfer", TransferUI::Client::TRANSFER_TYPES_DOWNLOAD); //Add a new Sync transfer in TransferUI syncTransfer = client->registerTransfer("Synchronizing", TransferUI::Client::TRANSFER_TYPES_SYNC); //Commit usage uploadTransfer->waitForCommit(); //start commit uploadTransfer->setName("filename.jpg"); uploadTransfer->setTargetName("picasa"); uploadTransfer->setFilesCount(10); uploadTransfer->setSize(1000); uploadTransfer->commit(); //end commit //Reduces three dbus calls to transfer-ui }
(c) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). GNU Lesser General Public License, version 2.1 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
MeeGo 1.2 Harmattan API
|