NDBDbus Class

(NDB::NDBDbus)

The NDBDbus class registers a service on d-bus of Kobo e-readers. More...

Header: #include <NDB>

Public Slots

void bwmOpenBrowser(bool modal = false, QString const & url = QString(), QString const & css = QString())
void dlgConfirmAccept(QString const & title, QString const & body, QString const & acceptText)
void dlgConfirmAcceptReject(QString const & title, QString const & body, QString const & acceptText, QString const & rejectText)
void dlgConfirmClose()
void dlgConfirmCreate(bool createLineEdit = false)
void dlgConfirmNoBtn(QString const & title, QString const & body)
void dlgConfirmReject(QString const & title, QString const & body, QString const & rejectText)
void dlgConfirmSetAccept(QString const & acceptText)
void dlgConfirmSetBody(QString const & body)
void dlgConfirmSetLEPassword(bool password)
void dlgConfirmSetLEPlaceholder(QString const & placeholder)
void dlgConfirmSetModal(bool modal)
void dlgConfirmSetProgress(int min, int max, int val, QString const & format = "")
void dlgConfirmSetReject(QString const & rejectText)
void dlgConfirmSetTitle(QString const & title)
void dlgConfirmShow()
void dlgConfirmShowClose(bool show)
void mwcHome()
void mwcToast(int toastDuration, QString const & msgMain, QString const & msgSub = QStringLiteral( "" ))
QString ndbCurrentView()
QString ndbFirmwareVersion()
QString ndbNickelClassDetails(QString const & staticMetaobjectSymbol)
bool ndbSignalConnected(QString const & signalName)
QString ndbVersion()
void nsAutoUSBGadget(QString const & action)
void nsForceWifi(QString const & action)
void nsInvert(QString const & action)
void nsLockscreen(QString const & action)
void nsScreenshots(QString const & action)
void pfmRescanBooks()
void pfmRescanBooksFull()
void pwrReboot()
void pwrShutdown()
void pwrSleep()
void wfmConnectWireless()
void wfmConnectWirelessSilently()
void wfmSetAirplaneMode(QString const & action)

Signals

void dlgConfirmResult(int result)
void dlgConfirmTextInput(QString input)
void ndbViewChanged(QString newView)
void pfmAboutToConnect()
void pfmDoneProcessing()
void rvPageChanged(int pageNum)
void wmLinkQualityForConnectedNetwork(double quality)
void wmMacAddressAvailable(QString mac)
void wmNetworkConnected()
void wmNetworkDisconnected()
void wmNetworkFailedToConnect()
void wmNetworkForgotten()
void wmScanningAborted()
void wmScanningFinished()
void wmScanningStarted()
void wmTryingToConnect()
void wmWifiEnabled(bool enabled)

Detailed Description

The NDBDbus class registers a service on d-bus of Kobo e-readers.

NDBDbus provides a bridge between Kobo's proprietary software, libnickel, and other software running on Kobo e-readers. It registers itself as a service on d-bus, and provides methods and signals to monitor and interact with nickel.

Member Function Documentation

void NDBDbus::bwmOpenBrowser(bool modal = false, QString const & url = QString(), QString const & css = QString()) [slot]

Open the web browser.

Note, this is the same as the NickelMenu browser options

Opens the web browser to the default homepage. if modal is true then the browser will be opened as a modal box with a close button. If url is set, the browser will open it on open. If css is set, additional CSS is supplied to the browser

void NDBDbus::dlgConfirmAccept(QString const & title, QString const & body, QString const & acceptText) [slot]

Show a confirmation dialog with accept and close buttons

Create a dialog box with title and body. This dialog has a close button, and an accept button labeled with acceptText

When the dialog is closed, or the accept button is pressed, a dlgConfirmResult() signal is emitted.

void NDBDbus::dlgConfirmAcceptReject(QString const & title, QString const & body, QString const & acceptText, QString const & rejectText) [slot]

Show a confirmation dialog with reject and close buttons

Create a dialog box with title and body. This dialog has a close button, a reject button labeled with rejectText, and an accept button labeled with acceptText.

When the dialog is closed, either button is pressed, a dlgConfirmResult() signal is emitted.

void NDBDbus::dlgConfirmClose() [slot]

Close the currently opened dialog

Closes the currently open dialog. Will return an error if the dialog has already been closed by the user.

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmCreate(bool createLineEdit = false) [slot]

Create a flexible confirmation dialog

Create (but not show) a flexible confirmation dialog. If createLineEdit is true a LineEdit dialog will be created, otherwise a standard dialog is created.

The caller can invoke dlgConfirmSetTitle(), dlgConfirmSetBody(), dlgConfirmSetAccept(), dlgConfirmSetReject(), dlgConfirmSetModal(), dlgConfirmShowClose(), dlgConfirmSetProgress() to customise the appearance and behaviour of the dialog. If the dialog is a LineEdit, dlgConfirmSetLEPassword() and dlgConfirmSetLEPlaceholder() can also be called.

Show the dialog by calling dlgConfirmShow(). It can be closed by calling dlgConfirmClose() in addition to the user closing it.

dlgConfirmResult() signal is emitted when the dialog is closed.

For a LineEdit dialog, if the dialog is closed by tapping the 'accept' button, the dlgConfirmTextInput() signal will emit the contents of the text edit field (which may be an empty string), and dlgConfirmResult() will emit 1. Otherwise, dlgConfirmResult() will emit the result of 0 and dlgConfirmTextInput() will emit an empty string.

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmNoBtn(QString const & title, QString const & body) [slot]

Show a confirmation dialog with no buttons (except close)

Create a dialog box with title and body. This dialog only has a close button.

When the dialog is closed, a dlgConfirmResult() signal is emitted.

void NDBDbus::dlgConfirmReject(QString const & title, QString const & body, QString const & rejectText) [slot]

Show a confirmation dialog with reject and close buttons

Create a dialog box with title and body. This dialog has a close button, and a reject button labeled with rejectText

When the dialog is closed, or the reject button is pressed, a dlgConfirmResult() signal is emitted.

void NDBDbus::dlgConfirmResult(int result) [signal]

The signal that is emitted when a confirmation dialog is dismissed

When emitted, result will be 1 for ACCEPT or 0 for REJECT

void NDBDbus::dlgConfirmSetAccept(QString const & acceptText) [slot]

Set the accept button of an existing confirmation dialog

The accept button will be enabled, and its label will be set to acceptText

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmSetBody(QString const & body) [slot]

Set body text of an existing confirmation dialog

The confirmation dialog will have the body text set to body

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmSetLEPassword(bool password) [slot]

Sets whether the current line edit dialog is a password dialog

If password is true the dialog will have a 'show password' checkbox, and input text will be masked if that checkbox is not checked.

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmSetLEPlaceholder(QString const & placeholder) [slot]

Add placeholder text to a line edit dialog

Set the line edit placeholder to placeholder

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmSetModal(bool modal) [slot]

Set whether the confirmation dialog will be modal

If modal is true the user will not be able to exit the dialog by tapping outside it.

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmSetProgress(int min, int max, int val, QString const & format = "") [slot]

Display a progress bar on the currently open dialog

Displays a progress bar with a range from min to max, and sets the current value to val. If any one of min max or val are set to -1, the progress bar will be hidden.

If set, format determines how the label will be displayed. It uses the same placeholders as a QProgressBar. The placeholders are %p for percentage value, %v for current step, %m for last step. The default if not set is %p%.

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmSetReject(QString const & rejectText) [slot]

Set the reject button of an existing confirmation dialog

The reject button will be enabled, and its label will be set to rejectText

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmSetTitle(QString const & title) [slot]

Set title of an existing confirmation dialog

The confirmation dialog will have the title set to title

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmShow() [slot]

Display the current dialog

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmShowClose(bool show) [slot]

Set whether the confirmation dialog will have a close button

If show is false the show button will not be displayed. Note, if the dialog is modal, and accept and reject buttons are not set, the user will have no means of closing the dialog.

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::dlgConfirmTextInput(QString input) [signal]

The signal that is emitted when text is entered by user

When emitted input will be the text the user inputted. This signal is only emitted when the user taps the accept button is tapped. input may be an empty string.

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::mwcHome() [slot]

Navigate to the home screen

void NDBDbus::mwcToast(int toastDuration, QString const & msgMain, QString const & msgSub = QStringLiteral( "" )) [slot]

Show a small, temporary text box with a message

Show a text box on screen for toastDuration duration (in milliseconds) with msgMain as the body text, and an optional msgSub

QString NDBDbus::ndbCurrentView() [slot]

Get the class name of the current view.

Some class name examples are HomePageView ReadingView among others.

QString NDBDbus::ndbFirmwareVersion() [slot]

Get the current firmware version

Get the current firmware version as found in the user agent string

QString NDBDbus::ndbNickelClassDetails(QString const & staticMetaobjectSymbol) [slot]

Print available details from nickel classes

This method attempts to dlsym then parse the staticMetaObject property available from the mangeled staticMetaobjectSymbol

A formatted string of available signals and slots is returned.

bool NDBDbus::ndbSignalConnected(QString const & signalName) [slot]

Check if a signal was successfully connected

Check if signalName is connected. signalName must be provided without parentheses and parameters.

Returns 1 if exists, or 0 otherwise

QString NDBDbus::ndbVersion() [slot]

Get the version of NickelDBus

void NDBDbus::ndbViewChanged(QString newView) [signal]

The signal that is emitted when the current view changes

This signal is only emitted if NDB::NDBDbus::ndbCurrentView() has been called at least once by an application. newView is the class name of the new view.

See also NDB::NDBDbus::ndbCurrentView().

void NDBDbus::nsAutoUSBGadget(QString const & action) [slot]

Sets the auto USB connect setting

Set action to enable, disable or toggle auto USB connect.

void NDBDbus::nsForceWifi(QString const & action) [slot]

Sets the developer ForceWifiOn setting

Set action to enable, disable or toggle ForceWifiOn.

void NDBDbus::nsInvert(QString const & action) [slot]

Invert the screen

Set action to enable, disable or toggle inversion.

void NDBDbus::nsLockscreen(QString const & action) [slot]

Set UnlockEnabled

Set action to enable, disable or toggle UnlockEnabled.

void NDBDbus::nsScreenshots(QString const & action) [slot]

Set screenshot setting

Set action to enable, disable or toggle screenshots.

void NDBDbus::pfmAboutToConnect() [signal]

The signal that nickel emits when it is about to start the USB connection

void NDBDbus::pfmDoneProcessing() [signal]

The signal that nickel emits when the content import process has completed.

The signal will be emitted following the content import triggered whenever the user unplugs from the computer, when rescan_books / rescan_books_full actions are triggered from NickelMenu, or when NDB::NDBDbus::pfmRescanBooks() or NDB::NDBDbus::pfmRescanBooksFull() methods are called from NDBDbus.

void NDBDbus::pfmRescanBooks() [slot]

Begin an abbreviated book rescan. Same as 'rescan_books' from NickelMenu

void NDBDbus::pfmRescanBooksFull() [slot]

Begins a full book rescan. Same as 'rescan_books_full' from NickelMenu

void NDBDbus::pwrReboot() [slot]

Reboot Kobo

void NDBDbus::pwrShutdown() [slot]

Shutdown Kobo

void NDBDbus::pwrSleep() [slot]

Put Kobo to sleep

This function was introduced in NickelDBus 0.2.0.

void NDBDbus::rvPageChanged(int pageNum) [signal]

The signal that is emitted when the current book changes page

This signal is only emitted if NDB::NDBDbus::ndbCurrentView() has been called at least once by an application. pageNum is kepub or epub page number of the new page.

See also NDB::NDBDbus::ndbCurrentView().

void NDBDbus::wfmConnectWireless() [slot]

Connect to WiFi network.

Note, this is the same as 'autoconnect' option from NickelMenu

void NDBDbus::wfmConnectWirelessSilently() [slot]

Connect silently to WiFi network.

Note, this is the same as 'autoconnect_silent' from NickelMenu

void NDBDbus::wfmSetAirplaneMode(QString const & action) [slot]

Enable/disable/toggle WiFi. Same as NickelMenu WiFi 'enable'/'disable'/'toggle' options

Note, this is the same as NickelMenu WiFi 'enable'/'disable'/'toggle' options.

action should be one of enable, disable, toggle

void NDBDbus::wmLinkQualityForConnectedNetwork(double quality) [signal]

(todo: figure this out)

Shows the quality of the wifi signal

void NDBDbus::wmMacAddressAvailable(QString mac) [signal]

(todo: figure this out)

mac address

void NDBDbus::wmNetworkConnected() [signal]

This signal appears to be emitted when the network has successfully connected I'm unsure if this is emitted when the WiFi connects, or when a valid IP address is obtained.

void NDBDbus::wmNetworkDisconnected() [signal]

(todo: figure this out)

void NDBDbus::wmNetworkFailedToConnect() [signal]

(todo: figure this out)

void NDBDbus::wmNetworkForgotten() [signal]

(todo: figure this out)

void NDBDbus::wmScanningAborted() [signal]

(todo: figure this out)

void NDBDbus::wmScanningFinished() [signal]

(todo: figure this out)

void NDBDbus::wmScanningStarted() [signal]

(todo: figure this out)

void NDBDbus::wmTryingToConnect() [signal]

(todo: figure this out)

void NDBDbus::wmWifiEnabled(bool enabled) [signal]

(todo: figure this out)

Is wifi enabled ?