mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-15 17:27:43 -05:00
Show KeePassHTTP deprecation notice three times and use MessageWidget
This commit is contained in:
parent
30f77b07bb
commit
a6fd52d1f9
@ -33,7 +33,7 @@ BrowserOptionDialog::BrowserOptionDialog(QWidget* parent) :
|
||||
connect(m_ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SIGNAL(removeSharedEncryptionKeys()));
|
||||
connect(m_ui->removeStoredPermissions, SIGNAL(clicked()), this, SIGNAL(removeStoredPermissions()));
|
||||
|
||||
m_ui->warningWidget->showMessage(tr("The following options can be dangerous!\nChange them only if you know what you are doing."), MessageWidget::Warning);
|
||||
m_ui->warningWidget->showMessage(tr("<b>Warning:</b> The following options can be dangerous!"), MessageWidget::Warning);
|
||||
m_ui->warningWidget->setCloseButtonVisible(false);
|
||||
m_ui->warningWidget->setAutoHideTimeout(-1);
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <QMimeData>
|
||||
#include <QShortcut>
|
||||
#include <QTimer>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(QT_NO_DBUS)
|
||||
#include <QList>
|
||||
@ -78,7 +77,7 @@ public:
|
||||
|
||||
QString name() override
|
||||
{
|
||||
return QObject::tr("Browser Integration (old)");
|
||||
return QObject::tr("Legacy Browser Integration");
|
||||
}
|
||||
|
||||
QIcon icon() override
|
||||
@ -196,7 +195,7 @@ MainWindow::MainWindow()
|
||||
|
||||
setWindowIcon(filePath()->applicationIcon());
|
||||
m_ui->globalMessageWidget->setHidden(true);
|
||||
connect(m_ui->globalMessageWidget, SIGNAL(linkActivated(const QString&)), this, SLOT(openLink(const QString&)));
|
||||
connect(m_ui->globalMessageWidget, &MessageWidget::linkActivated, &MessageWidget::openHttpUrl);
|
||||
connect(m_ui->globalMessageWidget, SIGNAL(showAnimationStarted()), m_ui->globalMessageWidgetContainer, SLOT(show()));
|
||||
connect(m_ui->globalMessageWidget, SIGNAL(hideAnimationFinished()), m_ui->globalMessageWidgetContainer, SLOT(hide()));
|
||||
|
||||
@ -412,7 +411,7 @@ MainWindow::MainWindow()
|
||||
tr("Access error for config file %1").arg(config()->getFileName()), MessageWidget::Error);
|
||||
}
|
||||
#ifdef WITH_XC_HTTP
|
||||
if (config()->get("Http/Enabled", false).toBool() && !config()->get("Http/DeprecationNoticeShown", false).toBool()) {
|
||||
if (config()->get("Http/Enabled", false).toBool() && config()->get("Http/DeprecationNoticeShown", 0).toInt() < 3) {
|
||||
// show message after tab widget dismissed all messages
|
||||
connect(m_ui->tabWidget, SIGNAL(messageDismissGlobal()), this, SLOT(showKeePassHTTPDeprecationNotice()));
|
||||
}
|
||||
@ -425,30 +424,18 @@ MainWindow::~MainWindow()
|
||||
|
||||
void MainWindow::showKeePassHTTPDeprecationNotice()
|
||||
{
|
||||
int warningNum = config()->get("Http/DeprecationNoticeShown", 0).toInt();
|
||||
displayGlobalMessage(tr("<p>It looks like you are using KeePassHTTP for browser integration. "
|
||||
"This feature has been deprecated and will be removed in the future.<br>"
|
||||
"Please switch to keepassxc-browser instead! For help with migration, "
|
||||
"Please switch to KeePassXC-Browser instead! For help with migration, "
|
||||
"visit our <a class=\"link\" href=\"https://keepassxc.org/docs/keepassxc-browser-migration\">"
|
||||
"keepassxc-browser migration guide</a>.</p>"),
|
||||
"migration guide</a> (warning %1 of 3).</p>").arg(warningNum + 1),
|
||||
MessageWidget::Warning, true, -1);
|
||||
|
||||
// config()->set("Http/DeprecationNoticeShown", true);
|
||||
config()->set("Http/DeprecationNoticeShown", warningNum + 1);
|
||||
disconnect(m_ui->tabWidget, SIGNAL(messageDismissGlobal()), this, SLOT(showKeePassHTTPDeprecationNotice()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a link using the system's default handler.
|
||||
* Links that are not HTTP(s) links are ignored.
|
||||
*
|
||||
* @param link link URL
|
||||
*/
|
||||
void MainWindow::openLink(const QString& link)
|
||||
{
|
||||
if (link.startsWith("http://") || link.startsWith("https://")) {
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::appExit()
|
||||
{
|
||||
m_appExitCalled = true;
|
||||
|
@ -98,7 +98,6 @@ private slots:
|
||||
void hideTabMessage();
|
||||
void handleScreenLock();
|
||||
void showKeePassHTTPDeprecationNotice();
|
||||
void openLink(const QString& link);
|
||||
|
||||
private:
|
||||
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
||||
|
@ -18,7 +18,9 @@
|
||||
|
||||
#include "MessageWidget.h"
|
||||
|
||||
#include "QTimer"
|
||||
#include <QTimer>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
const int MessageWidget::DefaultAutoHideTimeout = 6000;
|
||||
const int MessageWidget::DisableAutoHide = -1;
|
||||
@ -69,3 +71,16 @@ void MessageWidget::setAutoHideTimeout(int autoHideTimeout)
|
||||
m_autoHideTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a link using the system's default handler.
|
||||
* Links that are not HTTP(S) links are ignored.
|
||||
*
|
||||
* @param link link URL
|
||||
*/
|
||||
void MessageWidget::openHttpUrl(const QString& link)
|
||||
{
|
||||
if (link.startsWith("http://") || link.startsWith("https://")) {
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
}
|
||||
}
|
@ -43,6 +43,7 @@ public slots:
|
||||
void showMessage(const QString& text, MessageWidget::MessageType type, int autoHideTimeout);
|
||||
void hideMessage();
|
||||
void setAutoHideTimeout(int autoHideTimeout);
|
||||
static void openHttpUrl(QString const& url);
|
||||
|
||||
private:
|
||||
QTimer* m_autoHideTimer;
|
||||
|
@ -32,14 +32,20 @@ OptionDialog::OptionDialog(QWidget *parent) :
|
||||
connect(m_ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SIGNAL(removeSharedEncryptionKeys()));
|
||||
connect(m_ui->removeStoredPermissions, SIGNAL(clicked()), this, SIGNAL(removeStoredPermissions()));
|
||||
|
||||
m_ui->warningWidget->showMessage(tr("The following options can be dangerous!\nChange them only if you know what you are doing."), MessageWidget::Warning);
|
||||
m_ui->warningWidget->showMessage(tr("<b>Warning:</b> The following options can be dangerous!"), MessageWidget::Warning);
|
||||
m_ui->warningWidget->setCloseButtonVisible(false);
|
||||
m_ui->warningWidget->setAutoHideTimeout(MessageWidget::DisableAutoHide);
|
||||
|
||||
m_ui->tabWidget->setEnabled(m_ui->enableHttpServer->isChecked());
|
||||
connect(m_ui->enableHttpServer, SIGNAL(toggled(bool)), m_ui->tabWidget, SLOT(setEnabled(bool)));
|
||||
|
||||
m_ui->deprecationNotice->setOpenExternalLinks(true);
|
||||
m_ui->deprecationNotice->showMessage(tr("<p>KeePassHTTP has been deprecated and will be removed in the future.<br>"
|
||||
"Please switch to KeePassXC-Browser instead! For help with migration, visit "
|
||||
"our <a href=\"https://keepassxc.org/docs/keepassxc-browser-migration\">"
|
||||
"migration guide</a>.</p>"), MessageWidget::Warning);
|
||||
m_ui->deprecationNotice->setCloseButtonVisible(false);
|
||||
m_ui->deprecationNotice->setAutoHideTimeout(-1);
|
||||
connect(m_ui->deprecationNotice, &MessageWidget::linkActivated, &MessageWidget::openHttpUrl);
|
||||
}
|
||||
|
||||
OptionDialog::~OptionDialog()
|
||||
|
@ -26,13 +26,6 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="deprecationNotice">
|
||||
<property name="text">
|
||||
<string><p><b>NOTE:</b> KeePassHTTP has been deprecated and will be removed in the future.<br>Please switch to keepassxc-browser instead! For help with migration, visit our <a href="https://keepassxc.org/docs/keepassxc-browser-migration">keepassxc-browser migration guide</a>.</p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableHttpServer">
|
||||
<property name="toolTip">
|
||||
@ -43,6 +36,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="MessageWidget" name="deprecationNotice" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
|
Loading…
Reference in New Issue
Block a user