2021-03-31 05:38:59 -07:00
# include "generaldialog.h"
# include "ui_generaldialog.h"
2021-04-05 06:50:58 -07:00
# include "functions.h"
2021-04-22 04:38:54 -07:00
# include "reader.h"
# include "mainwindow.h"
2021-03-31 05:38:59 -07:00
# include <QFile>
# include <QDebug>
2021-04-01 05:58:37 -07:00
# include <QProcess>
2021-04-02 18:06:15 -07:00
# include <QScreen>
2021-07-05 13:01:32 -07:00
# include <QTimer>
2021-09-04 19:18:17 -07:00
# include <QDirIterator>
# include <QStringListModel>
# include <QListView>
2022-01-11 11:17:14 -08:00
# include <QDateTime>
2022-06-17 20:59:21 -07:00
# include <QTextEdit>
2021-03-31 05:38:59 -07:00
generalDialog : : generalDialog ( QWidget * parent ) :
QDialog ( parent ) ,
ui ( new Ui : : generalDialog )
{
ui - > setupUi ( this ) ;
2022-03-02 21:40:11 -08:00
ui - > bodyLabel - > setFont ( QFont ( " u001 " ) ) ;
ui - > searchComboBox - > setFont ( QFont ( " u001 " ) ) ;
2021-03-31 05:38:59 -07:00
// Preventing outside interaction
this - > setModal ( true ) ;
// Stylesheet, style & misc.
2022-02-12 21:37:48 -08:00
if ( global : : keyboard : : encfsDialog = = true ) {
QFile stylesheetFile ( " :/resources/eink-square-encfs.qss " ) ;
stylesheetFile . open ( QFile : : ReadOnly ) ;
this - > setStyleSheet ( stylesheetFile . readAll ( ) ) ;
stylesheetFile . close ( ) ;
}
else {
2022-04-03 20:26:15 -07:00
QFile stylesheetFile ( " /mnt/onboard/.adds/inkbox/eink.qss " ) ;
2022-02-12 21:37:48 -08:00
stylesheetFile . open ( QFile : : ReadOnly ) ;
this - > setStyleSheet ( stylesheetFile . readAll ( ) ) ;
stylesheetFile . close ( ) ;
}
2021-03-31 05:38:59 -07:00
ui - > okBtn - > setProperty ( " type " , " borderless " ) ;
ui - > cancelBtn - > setProperty ( " type " , " borderless " ) ;
2021-04-05 12:35:25 -07:00
ui - > acceptBtn - > setProperty ( " type " , " borderless " ) ;
2021-03-31 05:38:59 -07:00
ui - > okBtn - > setStyleSheet ( " font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey " ) ;
ui - > cancelBtn - > setStyleSheet ( " font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey " ) ;
2021-04-05 12:35:25 -07:00
ui - > acceptBtn - > setStyleSheet ( " font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey " ) ;
2022-03-02 21:40:11 -08:00
ui - > headerLabel - > setStyleSheet ( " font-weight: bold " ) ;
ui - > bodyLabel - > setStyleSheet ( " font-size: 9.5pt " ) ;
2021-07-05 19:21:20 -07:00
ui - > searchComboBox - > setStyleSheet ( " font-size: 9pt " ) ;
2021-03-31 05:38:59 -07:00
2022-01-11 11:17:14 -08:00
// Disabling "Online library" search if device doesn't have Wi-Fi
2022-04-02 13:49:18 -07:00
if ( global : : device : : isWifiAble = = false & & global : : deviceID ! = " emu \n " ) {
2022-01-11 11:17:14 -08:00
ui - > searchComboBox - > removeItem ( 2 ) ;
}
2021-09-04 20:46:47 -07:00
if ( QFile : : exists ( " /inkbox/searchComboBoxFunction " ) = = true ) {
string_checkconfig_ro ( " /inkbox/searchComboBoxFunction " ) ;
if ( checkconfig_str_val = = " Dictionary " ) {
ui - > searchComboBox - > setCurrentIndex ( 0 ) ;
}
else if ( checkconfig_str_val = = " Local storage " ) {
ui - > searchComboBox - > setCurrentIndex ( 1 ) ;
}
2021-12-27 12:04:39 -08:00
else if ( checkconfig_str_val = = " Online library " ) {
ui - > searchComboBox - > setCurrentIndex ( 2 ) ;
}
2021-09-04 20:46:47 -07:00
else {
ui - > searchComboBox - > setCurrentIndex ( 0 ) ;
}
}
2021-03-31 05:38:59 -07:00
if ( checkconfig ( " /inkbox/resetDialog " ) = = true ) {
2021-04-06 10:40:43 -07:00
if ( checkconfig ( " /opt/inkbox_genuine " ) = = true ) {
resetDialog = true ;
ui - > okBtn - > setText ( " Proceed " ) ;
ui - > cancelBtn - > setText ( " Go back " ) ;
2022-04-02 13:49:18 -07:00
if ( global : : deviceID ! = " n705 \n " ) {
2022-03-05 16:26:27 -08:00
ui - > bodyLabel - > setText ( " This will erase any books you have stored on the device. \n Settings will be reset. " ) ;
}
else {
ui - > bodyLabel - > setText ( " This will erase any books \n you have stored on the device. \n Settings will be reset. " ) ;
}
2021-04-06 10:40:43 -07:00
ui - > headerLabel - > setText ( " Warning " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-04-06 10:40:43 -07:00
string_writeconfig ( " /inkbox/resetDialog " , " false " ) ;
}
else {
resetDialog = true ;
ui - > okBtn - > setText ( " Proceed " ) ;
ui - > cancelBtn - > setText ( " Go back " ) ;
ui - > bodyLabel - > setText ( " Settings will be reset. " ) ;
ui - > headerLabel - > setText ( " Warning " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-04-06 10:40:43 -07:00
string_writeconfig ( " /inkbox/resetDialog " , " false " ) ;
}
2021-03-31 05:38:59 -07:00
}
2021-04-30 20:19:54 -07:00
else if ( checkconfig ( " /inkbox/updateDialog " ) = = true ) {
2021-04-01 05:58:37 -07:00
updateDialog = true ;
ui - > okBtn - > setText ( " Update " ) ;
ui - > cancelBtn - > setText ( " Not now " ) ;
2022-03-02 21:40:11 -08:00
ui - > bodyLabel - > setText ( " <font face='u001'>Do you want to update InkBox now</font><font face='Inter'>?</font> " ) ; // Because I hate Univers/U001's question mark ...
2021-04-01 05:58:37 -07:00
ui - > headerLabel - > setText ( " Update available " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-04-01 05:58:37 -07:00
string_writeconfig ( " /inkbox/updateDialog " , " false " ) ;
}
2021-05-01 12:53:52 -07:00
else if ( global : : settings : : settingsRebootDialog = = true ) {
2021-04-05 12:35:25 -07:00
settingsRebootDialog = true ;
ui - > stackedWidget - > setCurrentIndex ( 1 ) ;
2021-10-18 05:46:27 -07:00
if ( global : : kobox : : koboxSettingsRebootDialog = = true or global : : encfs : : enableStorageEncryptionDialog ) {
2021-05-01 12:53:52 -07:00
koboxSettingsRebootDialog = true ;
2022-03-26 11:50:39 -07:00
ui - > bodyLabel - > setText ( " The device will reboot now, since<br>the settings you defined require it to work properly. " ) ;
2021-05-01 12:53:52 -07:00
}
else {
2022-03-26 11:50:39 -07:00
ui - > bodyLabel - > setText ( " The settings you defined might<br>require a complete reboot of the device for them to work properly. " ) ;
2021-05-01 12:53:52 -07:00
}
2021-04-05 12:35:25 -07:00
ui - > headerLabel - > setText ( " Information " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-04-05 12:35:25 -07:00
}
2021-04-30 20:19:54 -07:00
else if ( global : : mainwindow : : lowBatteryDialog = = true ) {
2021-04-22 04:38:54 -07:00
lowBatteryDialog = true ;
ui - > stackedWidget - > setCurrentIndex ( 1 ) ;
get_battery_level ( ) ;
2022-04-04 22:37:04 -07:00
QString message = " The battery's level is low. \n Please charge your eReader. \n Current level: " ;
2021-04-22 04:38:54 -07:00
message . append ( batt_level ) ;
ui - > bodyLabel - > setText ( message ) ;
2021-04-22 10:56:29 -07:00
ui - > headerLabel - > setText ( " Low battery " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-04-22 04:38:54 -07:00
string_writeconfig ( " /inkbox/lowBatteryDialog " , " false " ) ;
}
2021-05-09 11:07:05 -07:00
else if ( global : : usbms : : usbmsDialog = = true ) {
usbmsDialog = true ;
2022-06-17 20:59:21 -07:00
ui - > stackedWidget - > setCurrentIndex ( 0 ) ;
2021-05-09 11:07:05 -07:00
ui - > okBtn - > setText ( " Connect " ) ;
2022-03-03 19:52:29 -08:00
ui - > cancelBtn - > setText ( " Not now " ) ;
2022-03-02 21:40:11 -08:00
ui - > bodyLabel - > setText ( " <font face='u001'>Do you want to connect your device to a computer to manage books</font><font face='Inter'>?</font> " ) ;
2021-05-09 11:07:05 -07:00
ui - > headerLabel - > setText ( " USB cable connected " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-05-09 11:07:05 -07:00
}
2021-06-08 04:49:52 -07:00
else if ( global : : text : : textBrowserDialog = = true ) {
2021-06-14 11:31:49 -07:00
textBrowserDialog = true ;
2021-06-08 04:49:52 -07:00
textwidgetWindow = new textwidget ( ) ;
ui - > headerLabel - > setText ( " Information " ) ;
2021-06-14 09:24:20 -07:00
ui - > stackedWidget - > setCurrentIndex ( 1 ) ;
2021-06-08 04:49:52 -07:00
ui - > mainStackedWidget - > insertWidget ( 1 , textwidgetWindow ) ;
ui - > mainStackedWidget - > setCurrentIndex ( 1 ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-06-08 04:49:52 -07:00
}
2021-06-14 11:31:49 -07:00
else if ( global : : kobox : : resetKoboxDialog = = true ) {
resetKoboxDialog = true ;
ui - > headerLabel - > setText ( " Warning " ) ;
ui - > okBtn - > setText ( " Proceed " ) ;
ui - > cancelBtn - > setText ( " Go back " ) ;
ui - > bodyLabel - > setText ( " This will erase all KoBox user data. KoBox settings will be reset. " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-06-14 11:31:49 -07:00
}
2021-07-05 13:01:32 -07:00
else if ( global : : keyboard : : keyboardDialog = = true ) {
2021-07-05 19:21:20 -07:00
setupKeyboardDialog ( ) ;
2021-07-05 13:01:32 -07:00
}
2021-07-05 10:45:35 -07:00
else if ( global : : keyboard : : keypadDialog = = true ) {
keypadDialog = true ;
keypadWidget = new virtualkeypad ( ) ;
ui - > headerLabel - > setText ( " Enter a number " ) ;
ui - > okBtn - > setText ( " OK " ) ;
ui - > cancelBtn - > setText ( " Cancel " ) ;
ui - > mainStackedWidget - > insertWidget ( 1 , keypadWidget ) ;
ui - > mainStackedWidget - > setCurrentIndex ( 1 ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-07-05 10:45:35 -07:00
}
2021-10-17 19:31:44 -07:00
else if ( global : : encfs : : disableStorageEncryptionDialog = = true ) {
ui - > headerLabel - > setText ( " Warning " ) ;
ui - > okBtn - > setText ( " Proceed " ) ;
ui - > cancelBtn - > setText ( " Go back " ) ;
2022-03-02 21:40:11 -08:00
ui - > bodyLabel - > setText ( " <font face='u001'>This will delete all the files you have encrypted. Are you sure you want to continue</font><font face='Inter'>?</font> " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-10-17 19:31:44 -07:00
}
2021-11-14 18:22:58 -08:00
else if ( global : : encfs : : errorNoBooksInDropboxDialog = = true ) {
ui - > stackedWidget - > setCurrentIndex ( 1 ) ;
ui - > headerLabel - > setText ( " Error " ) ;
ui - > bodyLabel - > setText ( " Please put books in the 'encfs-dropbox' folder to repack your encrypted storage. " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-11-14 18:22:58 -08:00
}
2021-12-31 12:50:59 -08:00
else if ( global : : encfs : : repackDialog = = true ) {
ui - > headerLabel - > setText ( " Information " ) ;
ui - > okBtn - > setText ( " Proceed " ) ;
ui - > cancelBtn - > setText ( " Not now " ) ;
2022-03-02 21:40:11 -08:00
ui - > bodyLabel - > setText ( " <font face='u001'>New files have been found in 'encfs-dropbox'. Would you want to repack your encrypted storage</font><font face='Inter'>?</font> " ) ;
2022-03-03 19:03:20 -08:00
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
2021-12-31 12:50:59 -08:00
}
2022-06-17 20:59:21 -07:00
else if ( global : : userApps : : appCompatibilityDialog = = true ) {
2022-06-18 06:26:52 -07:00
appCompatibilityDialog = true ;
2022-06-17 20:59:21 -07:00
global : : userApps : : appCompatibilityLastContinueStatus = true ;
ui - > okBtn - > setText ( " Launch " ) ;
ui - > cancelBtn - > setText ( " Cancel " ) ;
ui - > bodyLabel - > setText ( global : : userApps : : appCompatibilityText ) ;
ui - > headerLabel - > setText ( " Compatibility warning " ) ;
QTimer : : singleShot ( 50 , this , SLOT ( adjust_size ( ) ) ) ;
}
else if ( global : : userApps : : appInfoDialog = = true ) {
appInfoDialog = true ;
textwidgetWindow = new textwidget ( ) ;
ui - > headerLabel - > setText ( " App info " ) ;
ui - > stackedWidget - > setCurrentIndex ( 1 ) ;
ui - > mainStackedWidget - > insertWidget ( 1 , textwidgetWindow ) ;
ui - > mainStackedWidget - > setCurrentIndex ( 1 ) ;
yIncrease = 1.8 ;
QTimer : : singleShot ( 50 , this , SLOT ( increaseSize ( ) ) ) ;
}
2021-03-31 05:38:59 -07:00
else {
// We shouldn't be there ;)
2022-06-20 09:57:55 -07:00
log ( " Launched without settings " , className ) ;
2021-03-31 05:38:59 -07:00
}
2021-04-02 18:06:15 -07:00
// Centering dialog
QRect screenGeometry = QGuiApplication : : screens ( ) [ 0 ] - > geometry ( ) ;
int x = ( screenGeometry . width ( ) - this - > width ( ) ) / 2 ;
int y = ( screenGeometry . height ( ) - this - > height ( ) ) / 2 ;
this - > move ( x , y ) ;
2021-03-31 05:38:59 -07:00
}
generalDialog : : ~ generalDialog ( )
{
delete ui ;
}
void generalDialog : : on_cancelBtn_clicked ( )
{
2022-04-15 17:27:58 -07:00
log ( " Cancel button clicked " , className ) ;
2021-04-01 05:58:37 -07:00
if ( updateDialog = = true ) {
string_writeconfig ( " /tmp/cancelUpdateDialog " , " true " ) ;
generalDialog : : close ( ) ;
}
2021-06-29 11:42:51 -07:00
else if ( usbmsDialog = = true ) {
global : : usbms : : usbmsDialog = false ;
generalDialog : : close ( ) ;
}
2021-08-20 12:22:49 -07:00
else if ( resetKoboxDialog = = true ) {
global : : kobox : : resetKoboxDialog = false ;
generalDialog : : close ( ) ;
}
2021-10-17 19:31:44 -07:00
else if ( global : : encfs : : disableStorageEncryptionDialog = = true ) {
emit cancelDisableStorageEncryption ( ) ;
global : : encfs : : disableStorageEncryptionDialog = false ;
generalDialog : : close ( ) ;
}
2021-06-08 04:49:52 -07:00
else {
2021-07-05 19:21:20 -07:00
if ( global : : keyboard : : searchDialog = = true ) {
global : : keyboard : : searchDialog = false ;
global : : forbidOpenSearchDialog = true ;
global : : keyboard : : keyboardDialog = false ;
global : : keyboard : : keyboardText = " " ;
2021-12-27 12:04:39 -08:00
global : : library : : librarySearchDialog = false ;
2021-07-05 19:21:20 -07:00
}
2021-07-06 07:04:28 -07:00
else if ( global : : keyboard : : vncDialog = = true ) {
global : : keyboard : : vncDialog = false ;
global : : keyboard : : keyboardDialog = false ;
global : : keyboard : : keyboardText = " " ;
}
2021-10-10 12:02:20 -07:00
else if ( global : : keyboard : : encfsDialog = = true ) {
global : : keyboard : : encfsDialog = false ;
global : : encfs : : cancelSetup = true ;
global : : keyboard : : keyboardText = " " ;
}
2021-11-16 04:47:49 -08:00
else if ( global : : encfs : : errorNoBooksInDropboxDialog = = true ) {
global : : encfs : : errorNoBooksInDropboxDialog = false ;
}
2021-12-31 12:50:59 -08:00
else if ( global : : encfs : : repackDialog = = true ) {
global : : encfs : : repackDialog = false ;
}
2022-06-17 20:59:21 -07:00
else if ( global : : userApps : : appCompatibilityDialog = = true ) {
global : : userApps : : launchApp = false ;
global : : userApps : : appCompatibilityLastContinueStatus = false ;
global : : userApps : : appCompatibilityText = " " ;
2022-06-18 21:14:42 -07:00
global : : userApps : : appCompatibilityDialog = false ;
2022-06-17 20:59:21 -07:00
}
2021-05-09 11:07:05 -07:00
generalDialog : : close ( ) ;
}
2021-03-31 05:38:59 -07:00
}
void generalDialog : : on_okBtn_clicked ( )
{
2022-04-15 17:27:58 -07:00
log ( " OK button clicked " , className ) ;
2021-03-31 05:38:59 -07:00
if ( resetDialog = = true ) {
2021-04-05 12:35:25 -07:00
if ( checkconfig ( " /opt/inkbox_genuine " ) = = true ) {
// Soft-reset the device
// We set a custom boot flag and reboot silently in Diagnostics
2022-04-15 17:27:58 -07:00
log ( " Setting up the device for soft-reset " , className ) ;
2021-04-05 12:35:25 -07:00
string_writeconfig ( " /external_root/boot/flags/DIAGS_BOOT " , " true " ) ;
string_writeconfig ( " /external_root/boot/flags/DO_SOFT_RESET " , " true " ) ;
2021-06-22 05:22:27 -07:00
reboot ( false ) ;
2022-03-03 19:03:20 -08:00
qApp - > quit ( ) ;
2021-04-05 12:35:25 -07:00
}
else {
2021-05-09 11:07:05 -07:00
// Restore default settings, we're not on InkBox OS
2022-04-15 17:27:58 -07:00
log ( " Restoring default settings " , className ) ;
2021-04-05 12:35:25 -07:00
QString prog ( " sh " ) ;
QStringList args ;
args < < " reset-config.sh " ;
QProcess * proc = new QProcess ( ) ;
2021-04-06 10:40:43 -07:00
proc - > start ( prog , args ) ;
proc - > waitForFinished ( ) ;
2021-08-29 12:05:07 -07:00
proc - > deleteLater ( ) ;
2021-04-06 10:40:43 -07:00
// Relaunching InkBox
QProcess process ;
process . startDetached ( " inkbox.sh " , QStringList ( ) ) ;
2021-04-05 12:35:25 -07:00
qApp - > quit ( ) ;
}
2021-03-31 05:38:59 -07:00
}
2021-04-01 05:58:37 -07:00
if ( updateDialog = = true ) {
2021-08-19 05:23:18 -07:00
if ( global : : otaUpdate : : isUpdateOta = = true ) {
2021-08-25 10:16:41 -07:00
this - > hide ( ) ;
2021-08-19 05:23:18 -07:00
global : : otaUpdate : : downloadOta = true ;
otaManagerWindow = new otaManager ( this ) ;
connect ( otaManagerWindow , SIGNAL ( downloadedOtaUpdate ( bool ) ) , SLOT ( startOtaUpdate ( bool ) ) ) ;
otaManagerWindow - > setAttribute ( Qt : : WA_DeleteOnClose ) ;
2021-08-25 10:16:41 -07:00
global : : toast : : indefiniteToast = true ;
global : : toast : : modalToast = true ;
emit showToast ( " Downloading update " ) ;
2021-08-19 05:23:18 -07:00
}
else {
installUpdate ( ) ;
2022-03-03 19:03:20 -08:00
qApp - > quit ( ) ;
2021-08-19 05:23:18 -07:00
}
2021-04-01 05:58:37 -07:00
}
2021-05-09 11:07:05 -07:00
if ( usbmsDialog = = true ) {
2022-04-15 17:27:58 -07:00
log ( " Showing USBMS splash " , className ) ;
2021-05-09 11:07:05 -07:00
global : : usbms : : usbmsDialog = false ;
global : : usbms : : launchUsbms = true ;
usbmsWindow = new usbms_splash ( ) ;
usbmsWindow - > setAttribute ( Qt : : WA_DeleteOnClose ) ;
usbmsWindow - > setGeometry ( QRect ( QPoint ( 0 , 0 ) , screen ( ) - > geometry ( ) . size ( ) ) ) ;
usbmsWindow - > show ( ) ;
}
2021-06-14 11:31:49 -07:00
if ( resetKoboxDialog = = true ) {
resetKoboxUserData ( ) ;
}
2021-07-05 10:45:35 -07:00
if ( keypadDialog = = true ) {
int number = global : : keyboard : : keypadText . toInt ( ) ;
emit gotoPageSelected ( number ) ;
global : : keyboard : : keypadDialog = false ;
generalDialog : : close ( ) ;
}
if ( keyboardDialog = = true ) {
2021-07-05 19:21:20 -07:00
if ( global : : keyboard : : searchDialog = = true ) {
2021-09-05 07:29:52 -07:00
if ( ! global : : keyboard : : keyboardText . isEmpty ( ) ) {
2021-07-05 19:21:20 -07:00
if ( ui - > searchComboBox - > currentText ( ) = = " Dictionary " ) {
2021-09-04 20:46:47 -07:00
string_writeconfig ( " /inkbox/searchComboBoxFunction " , " Dictionary " ) ;
2021-07-05 19:21:20 -07:00
for ( int i = ui - > mainStackedWidget - > count ( ) ; i > = 0 ; i - - ) {
QWidget * widget = ui - > mainStackedWidget - > widget ( i ) ;
ui - > mainStackedWidget - > removeWidget ( widget ) ;
widget - > deleteLater ( ) ;
}
ui - > topStackedWidget - > setVisible ( false ) ;
ui - > stackedWidget - > setVisible ( false ) ;
dictionaryWidgetWindow = new dictionaryWidget ( ) ;
dictionaryWidgetWindow - > setAttribute ( Qt : : WA_DeleteOnClose ) ;
connect ( dictionaryWidgetWindow , SIGNAL ( refreshScreen ( ) ) , SLOT ( refreshScreenNative ( ) ) ) ;
connect ( dictionaryWidgetWindow , SIGNAL ( destroyed ( QObject * ) ) , SLOT ( restartSearchDialog ( ) ) ) ;
ui - > mainStackedWidget - > insertWidget ( 1 , dictionaryWidgetWindow ) ;
}
2021-09-04 19:18:17 -07:00
else if ( ui - > searchComboBox - > currentText ( ) = = " Local storage " ) {
2021-09-04 20:46:47 -07:00
string_writeconfig ( " /inkbox/searchComboBoxFunction " , " Local storage " ) ;
2021-09-04 19:18:17 -07:00
QString onboardPath ;
QStringList storageSearchResults ;
if ( checkconfig ( " /opt/inkbox_genuine " ) = = true ) {
onboardPath = " /mnt/onboard/onboard/ " ;
}
else {
onboardPath = " /mnt/onboard/ " ;
}
QDirIterator dirIt ( onboardPath , QDirIterator : : Subdirectories ) ;
2022-04-15 17:27:58 -07:00
log ( " Searching local storage for ' " + global : : keyboard : : keyboardText + " ' " , className ) ;
2021-09-04 19:18:17 -07:00
while ( dirIt . hasNext ( ) ) {
dirIt . next ( ) ;
if ( QFileInfo ( dirIt . filePath ( ) ) . isFile ( ) ) {
QString suffix = QFileInfo ( dirIt . filePath ( ) ) . suffix ( ) ;
2022-01-12 11:48:22 -08:00
if ( suffix = = " txt " or suffix = = " TXT " or suffix = = " epub " or suffix = = " EPUB " or suffix = = " pdf " or suffix = = " PDF " or suffix = = " png " or suffix = = " PNG " or suffix = = " tif " or suffix = = " TIF " or suffix = = " bmp " or suffix = = " BMP " or suffix = = " tiff " or suffix = = " TIFF " or suffix = = " jpg " or suffix = = " JPG " or suffix = = " jpeg " or suffix = = " JPEG " ) {
2021-09-04 19:18:17 -07:00
if ( dirIt . fileName ( ) . contains ( global : : keyboard : : keyboardText ) = = true ) {
storageSearchResults . append ( dirIt . fileName ( ) ) ;
2022-03-07 11:15:54 -08:00
global : : localStorage : : searchResultsPaths . append ( dirIt . filePath ( ) ) ;
2021-09-04 19:18:17 -07:00
}
}
}
}
if ( ! storageSearchResults . isEmpty ( ) ) {
2022-04-15 17:27:58 -07:00
log ( " Displaying search results " , className ) ;
2021-09-04 19:18:17 -07:00
for ( int i = ui - > mainStackedWidget - > count ( ) ; i > = 0 ; i - - ) {
QWidget * widget = ui - > mainStackedWidget - > widget ( i ) ;
ui - > mainStackedWidget - > removeWidget ( widget ) ;
widget - > deleteLater ( ) ;
}
ui - > topStackedWidget - > setVisible ( false ) ;
ui - > stackedWidget - > setVisible ( false ) ;
searchResultsWidgetWindow = new searchResultsWidget ( this ) ;
2021-09-04 20:46:47 -07:00
searchResultsWidgetWindow - > setAttribute ( Qt : : WA_DeleteOnClose ) ;
2021-09-05 07:06:56 -07:00
global : : forbidOpenSearchDialog = true ;
2021-09-04 20:46:47 -07:00
connect ( searchResultsWidgetWindow , SIGNAL ( destroyed ( QObject * ) ) , SLOT ( restartSearchDialog ( ) ) ) ;
2021-09-05 06:37:07 -07:00
connect ( searchResultsWidgetWindow , SIGNAL ( openBookFile ( QString , bool ) ) , SLOT ( openBookFileNative ( QString , bool ) ) ) ;
2021-09-04 19:18:17 -07:00
searchResultsWidgetWindow - > setListViewContents ( storageSearchResults ) ;
ui - > mainStackedWidget - > insertWidget ( 1 , searchResultsWidgetWindow ) ;
}
else {
2022-04-15 17:27:58 -07:00
log ( " No search results found " , className ) ;
2021-09-05 06:37:07 -07:00
global : : toast : : delay = 3000 ;
2021-09-04 19:18:17 -07:00
emit showToast ( " No results found " ) ;
2021-09-05 06:37:07 -07:00
keyboardWidget - > clearLineEdit ( ) ;
global : : keyboard : : keyboardText = " " ;
2021-09-04 19:18:17 -07:00
}
2021-12-27 12:04:39 -08:00
}
else if ( ui - > searchComboBox - > currentText ( ) = = " Online library " ) {
2022-04-16 16:40:30 -07:00
if ( testPing ( true ) = = 0 or global : : deviceID = = " emu \n " ) {
2022-03-23 20:41:14 -07:00
string_writeconfig ( " /inkbox/searchComboBoxFunction " , " Online library " ) ;
2022-04-15 17:27:58 -07:00
log ( " Searching online library for ' " + global : : keyboard : : keyboardText + " ' " , className ) ;
2022-01-11 11:17:14 -08:00
2022-03-23 20:41:14 -07:00
if ( ! readFile ( " /external_root/opt/storage/gutenberg/last_sync " ) . isEmpty ( ) ) {
unsigned long currentEpoch = QDateTime : : currentSecsSinceEpoch ( ) ;
unsigned long syncEpoch = readFile ( " /external_root/opt/storage/gutenberg/last_sync " ) . toULong ( ) ;
unsigned long allowSyncEpoch = syncEpoch + 86400 ;
if ( currentEpoch > allowSyncEpoch ) {
syncGutenbergCatalog ( ) ;
}
else {
noGutenbergSyncToDo = true ;
}
2022-01-11 11:17:14 -08:00
}
else {
2022-03-23 20:41:14 -07:00
syncGutenbergCatalog ( ) ;
2022-01-11 11:17:14 -08:00
}
2022-03-23 20:41:14 -07:00
QTimer * searchTimer = new QTimer ( this ) ;
searchTimer - > setInterval ( 100 ) ;
connect ( searchTimer , & QTimer : : timeout , [ & ] ( ) {
if ( noGutenbergSyncToDo = = true or ( gutenbergSyncDone = = true & & gutenbergSyncStatus = = true ) ) {
if ( searchTimerDone = = false ) {
searchTimerDone = true ;
string_writeconfig ( " /inkbox/gutenberg_search_request " , global : : keyboard : : keyboardText . toStdString ( ) ) ;
string_writeconfig ( " /opt/ibxd " , " gutenberg_search \n " ) ;
global : : toast : : modalToast = true ;
global : : toast : : indefiniteToast = true ;
emit showToast ( " Searching " ) ;
QTimer : : singleShot ( 100 , this , SLOT ( waitForGutenbergSearchDone ( ) ) ) ;
}
}
} ) ;
searchTimer - > start ( ) ;
2022-01-11 11:17:14 -08:00
}
else {
2022-03-23 20:41:14 -07:00
emit showToast ( " Wi-Fi connection error " ) ;
2022-01-11 11:17:14 -08:00
}
2021-07-05 19:21:20 -07:00
}
}
else {
2022-03-26 11:50:39 -07:00
global : : toast : : delay = 3000 ;
emit showToast ( " Please type in a search term " ) ;
2021-07-05 19:21:20 -07:00
}
}
2021-07-05 21:13:11 -07:00
else if ( global : : keyboard : : vncDialog = = true ) {
2021-10-08 20:37:32 -07:00
if ( ! global : : keyboard : : keyboardText . isEmpty ( ) ) {
2022-04-15 17:27:58 -07:00
log ( " Gathering VNC connection information " , className ) ;
2021-07-05 21:13:11 -07:00
if ( vncServerSet ! = true ) {
vncServerAddress = global : : keyboard : : keyboardText ;
vncServerSet = true ;
keyboardWidget - > clearLineEdit ( ) ;
ui - > headerLabel - > setText ( " Enter the server's password " ) ;
}
else if ( vncPasswordSet ! = true ) {
vncServerPassword = global : : keyboard : : keyboardText ;
vncPasswordSet = true ;
keyboardWidget - > clearLineEdit ( ) ;
ui - > headerLabel - > setText ( " Enter the server's port " ) ;
}
else {
vncServerPort = global : : keyboard : : keyboardText ;
global : : keyboard : : vncDialog = false ;
global : : keyboard : : keyboardDialog = false ;
startVNC ( vncServerAddress , vncServerPassword , vncServerPort ) ;
generalDialog : : close ( ) ;
}
}
else {
2022-03-26 11:50:39 -07:00
global : : toast : : delay = 3000 ;
emit showToast ( " Please type in the required argument " ) ;
2021-07-05 21:13:11 -07:00
}
}
2021-07-14 15:23:54 -07:00
else if ( global : : keyboard : : wifiPassphraseDialog = = true ) {
2021-10-08 20:37:32 -07:00
if ( ! global : : keyboard : : keyboardText . isEmpty ( ) ) {
2022-04-15 17:27:58 -07:00
log ( " Attempting connection to Wi-Fi network ' " + wifiEssid + " ' " , className ) ;
2021-07-14 15:23:54 -07:00
this - > hide ( ) ;
wifiPassphrase = global : : keyboard : : keyboardText ;
global : : toast : : indefiniteToast = true ;
global : : toast : : modalToast = true ;
emit showToast ( " Connecting " ) ;
QTimer : : singleShot ( 100 , this , SLOT ( connectToNetworkSlot ( ) ) ) ;
2021-07-20 20:27:32 -07:00
global : : keyboard : : wifiPassphraseDialog = false ;
global : : keyboard : : keyboardDialog = false ;
2021-07-14 15:23:54 -07:00
}
else {
2022-03-26 11:50:39 -07:00
global : : toast : : delay = 3000 ;
showToast ( " Please type in the required argument " ) ;
2021-07-14 15:23:54 -07:00
}
}
2021-10-08 20:37:32 -07:00
else if ( global : : keyboard : : encfsDialog = = true ) {
if ( ! global : : keyboard : : keyboardText . isEmpty ( ) ) {
global : : encfs : : passphrase = global : : keyboard : : keyboardText ;
global : : keyboard : : encfsDialog = false ;
global : : keyboard : : keyboardText = " " ;
global : : keyboard : : keyboardDialog = false ;
2021-10-17 19:31:44 -07:00
this - > close ( ) ;
2021-10-08 20:37:32 -07:00
}
else {
2022-03-26 11:50:39 -07:00
global : : toast : : delay = 3000 ;
showToast ( " Please type in the required argument " ) ;
2021-10-08 20:37:32 -07:00
}
}
2021-07-05 19:21:20 -07:00
else {
global : : keyboard : : keyboardDialog = false ;
generalDialog : : close ( ) ;
}
2021-07-05 10:45:35 -07:00
}
2021-10-17 19:31:44 -07:00
if ( global : : encfs : : disableStorageEncryptionDialog = = true ) {
global : : encfs : : disableStorageEncryptionDialog = false ;
emit disableStorageEncryption ( ) ;
this - > close ( ) ;
}
2021-12-31 12:50:59 -08:00
if ( global : : encfs : : repackDialog = = true ) {
global : : encfs : : repackDialog = false ;
2022-04-15 17:27:58 -07:00
log ( " Encrypted storage repack requested " , className ) ;
2021-12-31 12:50:59 -08:00
string_writeconfig ( " /external_root/run/encfs_repack " , " true " ) ;
quit_restart ( ) ;
}
2022-06-17 20:59:21 -07:00
else if ( global : : userApps : : appCompatibilityDialog = = true ) {
global : : userApps : : launchApp = true ;
global : : userApps : : appCompatibilityText = " " ;
global : : userApps : : appCompatibilityLastContinueStatus = true ; // Not really necceserry, only if something fails horibly
global : : userApps : : appCompatibilityDialog = false ;
generalDialog : : close ( ) ;
}
2021-03-31 05:38:59 -07:00
}
2021-04-05 12:35:25 -07:00
void generalDialog : : on_acceptBtn_clicked ( )
{
2022-04-15 17:27:58 -07:00
log ( " OK button clicked " , className ) ;
2021-04-22 04:38:54 -07:00
if ( lowBatteryDialog = = true ) {
2021-04-22 07:10:47 -07:00
global : : mainwindow : : lowBatteryDialog = false ;
global : : battery : : batteryAlertLock = false ;
global : : battery : : showLowBatteryDialog = false ;
2021-04-22 04:38:54 -07:00
}
if ( settingsRebootDialog = = true ) {
2021-10-18 05:46:27 -07:00
if ( koboxSettingsRebootDialog = = true or global : : encfs : : enableStorageEncryptionDialog ) {
2021-05-01 12:53:52 -07:00
reboot ( true ) ;
2022-03-03 19:03:20 -08:00
qApp - > quit ( ) ;
2021-05-01 12:53:52 -07:00
}
else {
QProcess process ;
process . startDetached ( " inkbox.sh " , QStringList ( ) ) ;
qApp - > quit ( ) ;
}
2021-04-22 04:38:54 -07:00
}
2021-06-08 04:49:52 -07:00
if ( textBrowserDialog = = true ) {
global : : text : : textBrowserContents = " " ;
global : : text : : textBrowserDialog = false ;
}
2021-04-23 05:47:05 -07:00
2022-06-17 20:59:21 -07:00
if ( appInfoDialog = = true ) {
global : : text : : textBrowserContents = " " ;
global : : userApps : : appInfoDialog = false ;
}
2021-04-23 05:47:05 -07:00
// We don't have any other option ;p
generalDialog : : close ( ) ;
2021-04-05 12:35:25 -07:00
}
2021-07-05 13:01:32 -07:00
void generalDialog : : adjust_size ( ) {
this - > adjustSize ( ) ;
QRect screenGeometry = QGuiApplication : : screens ( ) [ 0 ] - > geometry ( ) ;
int x = ( screenGeometry . width ( ) - this - > width ( ) ) / 2 ;
int y = ( screenGeometry . height ( ) - this - > height ( ) ) / 2 ;
this - > move ( x , y ) ;
2022-03-03 19:03:20 -08:00
this - > show ( ) ;
2021-07-05 13:01:32 -07:00
emit refreshScreen ( ) ;
}
2021-07-05 19:21:20 -07:00
void generalDialog : : restartSearchDialog ( ) {
generalDialog : : close ( ) ;
}
void generalDialog : : setupKeyboardDialog ( ) {
2022-06-17 20:59:21 -07:00
ui - > stackedWidget - > setCurrentIndex ( 0 ) ;
2021-07-05 19:21:20 -07:00
keyboardDialog = true ;
ui - > stackedWidget - > setVisible ( true ) ;
if ( global : : keyboard : : searchDialog = = true ) {
ui - > topStackedWidget - > setCurrentIndex ( 1 ) ;
ui - > searchHeaderLabel - > setText ( " Search " ) ;
2021-07-05 21:13:11 -07:00
ui - > okBtn - > setText ( " Search " ) ;
ui - > cancelBtn - > setText ( " Close " ) ;
}
else if ( global : : keyboard : : vncDialog = = true ) {
ui - > headerLabel - > setText ( " Enter the server's IP address " ) ;
ui - > okBtn - > setText ( " OK " ) ;
ui - > cancelBtn - > setText ( " Cancel " ) ;
2021-07-05 19:21:20 -07:00
}
2021-07-14 15:23:54 -07:00
else if ( global : : keyboard : : wifiPassphraseDialog = = true ) {
ui - > headerLabel - > setText ( " Enter the network's passphrase " ) ;
ui - > okBtn - > setText ( " Connect " ) ;
ui - > cancelBtn - > setText ( " Cancel " ) ;
}
2021-10-08 20:37:32 -07:00
else if ( global : : keyboard : : encfsDialog = = true ) {
2021-10-10 12:02:20 -07:00
ui - > headerLabel - > setText ( " Enter your encrypted storage's passphrase " ) ;
2021-10-08 20:37:32 -07:00
ui - > okBtn - > setText ( " OK " ) ;
ui - > cancelBtn - > setText ( " Cancel " ) ;
}
2021-07-05 19:21:20 -07:00
else {
ui - > headerLabel - > setText ( " Enter a string " ) ;
2021-07-05 21:13:11 -07:00
ui - > okBtn - > setText ( " OK " ) ;
ui - > cancelBtn - > setText ( " Cancel " ) ;
2021-07-05 19:21:20 -07:00
}
keyboardWidget = new virtualkeyboard ( ) ;
connect ( keyboardWidget , SIGNAL ( adjust_size ( ) ) , SLOT ( adjust_size ( ) ) ) ;
ui - > mainStackedWidget - > insertWidget ( 1 , keyboardWidget ) ;
ui - > mainStackedWidget - > setCurrentIndex ( 1 ) ;
QTimer : : singleShot ( 1000 , this , SLOT ( adjust_size ( ) ) ) ;
}
void generalDialog : : refreshScreenNative ( ) {
emit refreshScreen ( ) ;
}
2021-07-05 21:13:11 -07:00
void generalDialog : : startVNC ( QString server , QString password , QString port ) {
2022-04-15 17:27:58 -07:00
log ( " Launching VNC viewer " , className ) ;
2021-07-05 21:13:11 -07:00
std : : string server_str = server . toStdString ( ) ;
std : : string password_str = password . toStdString ( ) ;
std : : string port_str = port . toStdString ( ) ;
string_writeconfig ( " /external_root/tmp/app_vnc_server " , server_str ) ;
string_writeconfig ( " /external_root/tmp/app_vnc_password " , password_str ) ;
string_writeconfig ( " /external_root/tmp/app_vnc_port " , port_str ) ;
2021-07-06 07:04:28 -07:00
string_writeconfig ( " /opt/ibxd " , " app_start_vnc \n " ) ;
2021-07-05 21:13:11 -07:00
qApp - > quit ( ) ;
}
2021-07-14 15:23:54 -07:00
void generalDialog : : connectToNetworkSlot ( ) {
if ( connectToNetwork ( wifiEssid , wifiPassphrase ) = = true ) {
emit updateWifiIcon ( 3 ) ;
emit closeIndefiniteToast ( ) ;
emit showToast ( " Connection successful " ) ;
}
else {
emit updateWifiIcon ( 2 ) ;
emit closeIndefiniteToast ( ) ;
emit showToast ( " Connection failed " ) ;
}
generalDialog : : close ( ) ;
}
2021-08-19 05:23:18 -07:00
void generalDialog : : startOtaUpdate ( bool wasDownloadSuccessful ) {
2021-08-25 10:16:41 -07:00
emit closeIndefiniteToast ( ) ;
2021-08-19 05:23:18 -07:00
if ( wasDownloadSuccessful = = true ) {
global : : otaUpdate : : isUpdateOta = false ;
installUpdate ( ) ;
2022-03-03 19:03:20 -08:00
qApp - > quit ( ) ;
2021-08-19 05:23:18 -07:00
}
else {
2021-08-25 10:16:41 -07:00
emit showToast ( " Download failed " ) ;
2021-08-19 05:23:18 -07:00
global : : otaUpdate : : isUpdateOta = false ;
}
2021-08-25 10:16:41 -07:00
generalDialog : : close ( ) ;
2021-08-19 05:23:18 -07:00
}
2021-09-04 20:46:47 -07:00
2021-09-05 06:37:07 -07:00
void generalDialog : : openBookFileNative ( QString book , bool relativePath ) {
emit openBookFile ( book , relativePath ) ;
2021-09-04 20:46:47 -07:00
}
2021-12-29 20:09:51 -08:00
void generalDialog : : showToastNative ( QString messageToDisplay ) {
emit showToast ( messageToDisplay ) ;
}
void generalDialog : : closeIndefiniteToastNative ( ) {
emit closeIndefiniteToast ( ) ;
}
2021-12-31 12:50:59 -08:00
void generalDialog : : quit_restart ( ) {
2022-04-15 17:27:58 -07:00
log ( " Restarting InkBox " , className ) ;
2021-12-31 12:50:59 -08:00
// If existing, cleaning bookconfig_mount mountpoint
string_writeconfig ( " /opt/ibxd " , " bookconfig_unmount \n " ) ;
// Restarting InkBox
QProcess process ;
process . startDetached ( " inkbox " , QStringList ( ) ) ;
qApp - > quit ( ) ;
}
2022-01-11 11:17:14 -08:00
2022-01-12 08:04:10 -08:00
void generalDialog : : syncGutenbergCatalog ( ) {
2022-04-15 17:27:58 -07:00
log ( " Syncing Gutenberg catalog " , className ) ;
2022-01-11 11:17:14 -08:00
global : : toast : : modalToast = true ;
global : : toast : : indefiniteToast = true ;
2022-01-12 08:04:10 -08:00
emit showToast ( " Sync in progress " ) ;
2022-01-11 11:17:14 -08:00
string_writeconfig ( " /opt/ibxd " , " gutenberg_sync \n " ) ;
QTimer * syncCheckTimer = new QTimer ( this ) ;
syncCheckTimer - > setInterval ( 100 ) ;
connect ( syncCheckTimer , & QTimer : : timeout , [ & ] ( ) {
if ( QFile : : exists ( " /inkbox/gutenbergSyncDone " ) = = true ) {
if ( checkconfig ( " /inkbox/gutenbergSyncDone " ) = = true ) {
2022-04-04 21:47:15 -07:00
log ( " Gutenberg sync successfully completed " , className ) ;
2022-01-11 11:17:14 -08:00
gutenbergSyncDone = true ;
gutenbergSyncStatus = true ;
emit closeIndefiniteToast ( ) ;
}
else {
2022-04-04 21:47:15 -07:00
log ( " Gutenberg sync encountered an error " , className ) ;
2022-01-11 11:17:14 -08:00
gutenbergSyncDone = true ;
gutenbergSyncStatus = false ;
emit closeIndefiniteToast ( ) ;
2022-01-12 08:04:10 -08:00
emit showToast ( " Error " ) ;
2022-01-11 11:17:14 -08:00
global : : keyboard : : searchDialog = false ;
global : : forbidOpenSearchDialog = true ;
global : : keyboard : : keyboardDialog = false ;
global : : keyboard : : keyboardText = " " ;
global : : library : : librarySearchDialog = false ;
QTimer : : singleShot ( 5000 , this , SLOT ( close ( ) ) ) ;
}
QFile : : remove ( " /inkbox/gutenbergSyncDone " ) ;
}
} ) ;
syncCheckTimer - > start ( ) ;
}
2022-01-12 08:04:10 -08:00
void generalDialog : : waitForGutenbergSearchDone ( ) {
while ( true ) {
if ( QFile : : exists ( " /inkbox/gutenberg-search/search_done " ) ) {
if ( checkconfig ( " /inkbox/gutenberg-search/search_done " ) = = true ) {
2022-04-02 11:30:07 -07:00
QList < QString > searchResults = readFile ( " /inkbox/gutenberg-search/search_results_titles " ) . split ( " \n " ) ;
searchResults . takeLast ( ) ;
2022-01-12 08:04:10 -08:00
global : : library : : libraryResults = true ;
for ( int i = ui - > mainStackedWidget - > count ( ) ; i > = 0 ; i - - ) {
QWidget * widget = ui - > mainStackedWidget - > widget ( i ) ;
ui - > mainStackedWidget - > removeWidget ( widget ) ;
widget - > deleteLater ( ) ;
}
ui - > topStackedWidget - > setVisible ( false ) ;
ui - > stackedWidget - > setVisible ( false ) ;
searchResultsWidgetWindow = new searchResultsWidget ( this ) ;
searchResultsWidgetWindow - > setAttribute ( Qt : : WA_DeleteOnClose ) ;
global : : forbidOpenSearchDialog = true ;
connect ( searchResultsWidgetWindow , SIGNAL ( destroyed ( QObject * ) ) , SLOT ( restartSearchDialog ( ) ) ) ;
connect ( searchResultsWidgetWindow , SIGNAL ( showToast ( QString ) ) , SLOT ( showToastNative ( QString ) ) ) ;
connect ( searchResultsWidgetWindow , SIGNAL ( closeIndefiniteToast ( ) ) , SLOT ( closeIndefiniteToastNative ( ) ) ) ;
connect ( searchResultsWidgetWindow , SIGNAL ( hideDialog ( ) ) , SLOT ( hide ( ) ) ) ;
searchResultsWidgetWindow - > setListViewContents ( searchResults ) ;
ui - > mainStackedWidget - > insertWidget ( 1 , searchResultsWidgetWindow ) ;
QFile : : remove ( " /inkbox/gutenberg-search/search_done " ) ;
emit closeIndefiniteToast ( ) ;
break ;
}
else {
2022-04-02 11:30:07 -07:00
emit closeIndefiniteToast ( ) ;
2022-01-12 08:04:10 -08:00
global : : toast : : delay = 3000 ;
2022-04-02 11:30:07 -07:00
global : : toast : : modalToast = true ;
2022-01-12 08:04:10 -08:00
emit showToast ( " No results found " ) ;
keyboardWidget - > clearLineEdit ( ) ;
global : : keyboard : : keyboardText = " " ;
QFile : : remove ( " /inkbox/gutenberg-search/search_done " ) ;
2022-04-02 11:30:07 -07:00
QTimer : : singleShot ( 3000 , this , SLOT ( close ( ) ) ) ;
2022-01-12 08:04:10 -08:00
break ;
}
}
}
}
2022-06-17 20:59:21 -07:00
void generalDialog : : increaseSize ( )
{
log ( " Resizing generalDialog " , className ) ;
ui - > topStackedWidget - > setSizePolicy ( QSizePolicy : : Preferred , QSizePolicy : : Fixed ) ;
ui - > mainStackedWidget - > setSizePolicy ( QSizePolicy : : Preferred , QSizePolicy : : MinimumExpanding ) ;
ui - > stackedWidget - > setSizePolicy ( QSizePolicy : : Preferred , QSizePolicy : : Fixed ) ;
QRect screenGeometry = QGuiApplication : : screens ( ) [ 0 ] - > geometry ( ) ;
int wx = screenGeometry . width ( ) ;
int x = wx - 25 ;
int y = this - > height ( ) * yIncrease ;
this - > setFixedWidth ( x ) ;
this - > setFixedHeight ( y ) ;
ui - > bodyLabel - > sizePolicy ( ) . setVerticalPolicy ( QSizePolicy : : Expanding ) ;
ui - > bodyLabel - > sizePolicy ( ) . setHorizontalPolicy ( QSizePolicy : : Expanding ) ;
adjust_size ( ) ;
}