Commit 0ec7aa62 authored by Ragnar Thomsen's avatar Ragnar Thomsen

Improve focus handling of internal previewer

This diff sets the initial focus of the internal previewer to the Part
widget and sets the autodefault property of the Close button to false.
The latter prevents the Enter key from closing the dialog which allows
the Part widget to handle the key press event instead.

BUG: 369390
BUG: 369401
FIXED-IN: 16.08.2
parent c866108c
......@@ -30,10 +30,11 @@
#include <KSharedConfig>
#include <KWindowConfig>
#include <QProgressDialog>
#include <QDebug>
#include <QFile>
#include <QMimeDatabase>
#include <QProgressDialog>
#include <QPushButton>
ArkViewer::ArkViewer()
: QDialog()
......@@ -44,6 +45,9 @@ ArkViewer::ArkViewer()
setupUi(this);
// Bug 369390: This prevents the Enter key from closing the dialog.
m_buttonBox->button(QDialogButtonBox::Close)->setAutoDefault(false);
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(this, &ArkViewer::finished, this, &ArkViewer::dialogClosed);
}
......@@ -204,6 +208,7 @@ bool ArkViewer::viewInInternalViewer(const QString& fileName, const QMimeType &m
layout()->replaceWidget(m_partPlaceholder, m_part.data()->widget());
m_part.data()->openUrl(QUrl::fromLocalFile(fileName));
m_part.data()->widget()->setFocus();
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment