GUI: fix setting "open temp copy do not show next time" from the dialog, did not work with newer qt versions

This commit is contained in:
Jean-Francois Dockes 2022-01-21 19:38:45 +01:00
parent 44c0ec93e4
commit 32195d0899
3 changed files with 12 additions and 11 deletions

View File

@ -21,6 +21,7 @@
#include <list>
#include <QMessageBox>
#include <QSettings>
#include "qxtconfirmationmessage.h"
@ -382,11 +383,11 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString qterm)
"<br/>them to a permanent location."),
tr("Do not show this warning next time (use GUI preferences "
"to restore)."));
confirm.setOverrideSettingsKey("Recoll/prefs/showTempFileWarning");
confirm.setOverrideSettingsKey("/Recoll/prefs/showTempFileWarning");
confirm.exec();
QSettings settings;
prefs.showTempFileWarning =
settings.value("Recoll/prefs/showTempFileWarning").toInt();
settings.value("/Recoll/prefs/showTempFileWarning").toInt();
}
// If we are not called with a page number (which would happen for a call

View File

@ -35,6 +35,7 @@
#include <QPushButton>
#include <QGridLayout>
#include <QCheckBox>
#include <QSettings>
class QxtConfirmationMessagePrivate : public QxtPrivate<QxtConfirmationMessage>
{
@ -140,6 +141,8 @@ QxtConfirmationMessage::QxtConfirmationMessage(QWidget* parent)
{
QXT_INIT_PRIVATE(QxtConfirmationMessage);
qxt_d().init();
connect(this, SIGNAL(buttonClicked(QAbstractButton*)),
this, SLOT(onButtonClicked(QAbstractButton*)));
}
/*!
@ -154,6 +157,8 @@ QxtConfirmationMessage::QxtConfirmationMessage(
{
QXT_INIT_PRIVATE(QxtConfirmationMessage);
qxt_d().init(confirmation);
connect(this, SIGNAL(buttonClicked(QAbstractButton*)),
this, SLOT(onButtonClicked(QAbstractButton*)));
}
/*!
@ -284,21 +289,17 @@ int QxtConfirmationMessage::exec()
return res;
}
/*!
\reimp
*/
void QxtConfirmationMessage::done(int result)
void QxtConfirmationMessage::onButtonClicked(QAbstractButton *button)
{
QDialogButtonBox* buttons = this->findChild<QDialogButtonBox*>();
Q_ASSERT(buttons != 0);
int role = buttons->buttonRole(clickedButton());
int role = buttons->buttonRole(button);
if (qxt_d().confirm->isChecked() &&
(qxt_d().remember || role != QDialogButtonBox::RejectRole))
{
qxt_d().doNotShowAgain(result);
qxt_d().doNotShowAgain(0);
}
QMessageBox::done(result);
}
/*!

View File

@ -32,7 +32,6 @@
#define QXTCONFIRMATIONMESSAGE_H
#include <QSettings>
#include <QMessageBox>
#include "qxtglobal.h"
@ -75,7 +74,7 @@ public:
public Q_SLOTS:
int exec();
void reset();
virtual void done(int result);
void onButtonClicked(QAbstractButton *button);
};
#endif // QXTCONFIRMATIONMESSAGE_H