mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Don't launch Reader framework on Cancel in QFileDialog
This commit is contained in:
parent
b0b9cc3adf
commit
d948375d03
2 changed files with 27 additions and 5 deletions
31
reader.cpp
31
reader.cpp
|
@ -306,7 +306,15 @@ reader::reader(QWidget *parent) :
|
|||
dialog->setStyleSheet(stylesheetFile.readAll());
|
||||
stylesheetFile.close();
|
||||
book_file = dialog->getOpenFileName(dialog, tr("Open File"), QDir::currentPath());
|
||||
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
||||
|
||||
if(book_file != "") {
|
||||
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
||||
}
|
||||
else {
|
||||
// User clicked "Cancel" button
|
||||
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
||||
quit_restart();
|
||||
}
|
||||
}
|
||||
else {
|
||||
QDir::setCurrent("/mnt/onboard");
|
||||
|
@ -318,7 +326,15 @@ reader::reader(QWidget *parent) :
|
|||
dialog->setStyleSheet(stylesheetFile.readAll());
|
||||
stylesheetFile.close();
|
||||
book_file = dialog->getOpenFileName(dialog, tr("Open File"), QDir::currentPath());
|
||||
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
||||
|
||||
if(book_file != "") {
|
||||
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
||||
}
|
||||
else {
|
||||
// User clicked "Cancel" button
|
||||
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
||||
quit_restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,9 +563,7 @@ void reader::on_homeBtn_clicked()
|
|||
string_writeconfig("/tmp/inkboxReading", "false");
|
||||
|
||||
// Relaunching process
|
||||
QProcess process;
|
||||
process.startDetached("inkbox", QStringList());
|
||||
qApp->quit();
|
||||
quit_restart();
|
||||
}
|
||||
|
||||
void reader::on_fontChooser_currentIndexChanged(const QString &arg1)
|
||||
|
@ -820,3 +834,10 @@ void reader::writeconfig_pagenumber() {
|
|||
string split_total_str = to_string(split_total);
|
||||
string_writeconfig("/tmp/inkboxPageNumber", split_total_str);
|
||||
}
|
||||
|
||||
void reader::quit_restart() {
|
||||
// Restarting InkBox
|
||||
QProcess process;
|
||||
process.startDetached("inkbox", QStringList());
|
||||
qApp->quit();
|
||||
}
|
||||
|
|
1
reader.h
1
reader.h
|
@ -251,6 +251,7 @@ private slots:
|
|||
void on_saveWordBtn_clicked();
|
||||
void on_sizeSlider_valueChanged(int value);
|
||||
void writeconfig_pagenumber();
|
||||
void quit_restart();
|
||||
|
||||
private:
|
||||
Ui::reader *ui;
|
||||
|
|
Loading…
Reference in a new issue