1/***************************************************************************
2 phraseedit.cpp - description
3 -------------------
4 begin : Don Sep 26 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "phraseedit.h"
19
20#include <QtGui/QKeyEvent>
21
22PhraseEdit::PhraseEdit(const QString &string, QWidget *parent)
23 : KLineEdit (string, parent) {
24}
25
26PhraseEdit::~PhraseEdit() {
27}
28
29void PhraseEdit::keyPressEvent (QKeyEvent *e) {
30 if (e->modifiers() & Qt::ControlModifier) {
31 if (e->key() == Qt::Key_C) {
32 if (!this->hasSelectedText()) {
33 e->ignore();
34 return;
35 }
36 }
37 else if (e->key() == Qt::Key_Insert) {
38 if (!hasSelectedText()) {
39 e->ignore();
40 return;
41 }
42 }
43 else if (e->key() == Qt::Key_X) {
44 if (!hasSelectedText()) {
45 e->ignore();
46 return;
47 }
48 }
49 }
50 else if (e->modifiers() & Qt::ShiftModifier) {
51 if (e->key() == Qt::Key_Delete) {
52 if (!hasSelectedText()) {
53 e->ignore();
54 return;
55 }
56 }
57 }
58 KLineEdit::keyPressEvent(e);
59}
60