Commit fcef9dfe authored by Raphael Kubo da Costa (rakuco)'s avatar Raphael Kubo da Costa (rakuco)
Browse files

Reimplement keyPressEvent so that we only call parent implementations if

the default button has focus.
Otherwise it will override key press events for the Parts.

svn path=/trunk/KDE/kdeutils/ark/; revision=988412
parent 5ed96b41
......@@ -30,6 +30,7 @@
#include <KIconLoader>
#include <KVBox>
#include <KMessageBox>
#include <KPushButton>
#include <KRun>
#include <KIO/NetAccess>
......@@ -40,7 +41,6 @@
#include <QMimeData>
#include <QMouseEvent>
class DraggableIcon : public QLabel
{
public:
......@@ -64,7 +64,6 @@ public:
drag->exec();
}
}
};
......@@ -110,6 +109,18 @@ void ArkViewer::view(const QString& filename, QWidget *parent)
KIO::NetAccess::del(KUrl(filename), parent);
}
void ArkViewer::keyPressEvent(QKeyEvent *event)
{
KPushButton *defButton = button(defaultButton());
// Only handle the event the usual way if the default button has focus
// Otherwise, pressing enter on KatePart still closes the dialog, for example.
if ((defButton) && (defButton->hasFocus()))
KDialog::keyPressEvent(event);
event->accept();
}
bool ArkViewer::viewInInternalViewer(const QString& filename)
{
KUrl u(filename);
......
......@@ -36,6 +36,9 @@ public:
static void view(const QString& filename, QWidget* parent = 0);
protected:
virtual void keyPressEvent(QKeyEvent *event);
protected slots:
void slotFinished();
void slotOpenUrlRequestDelayed(const KUrl& url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments& browserArguments);
......
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