kalarm

emailidcombo.cpp
1 /*
2  * emailidcombo.cpp - email identity combo box with read-only option
3  * Program: kalarm
4  * Copyright (C) 2004 by David Jarvie <software@astrojar.org.uk>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #include "emailidcombo.moc"
22 
23 
24 EmailIdCombo::EmailIdCombo(KPIM::IdentityManager* manager, TQWidget* parent, const char* name)
25  : KPIM::IdentityCombo(manager, parent, name),
26  mReadOnly(false)
27 { }
28 
29 void EmailIdCombo::mousePressEvent(TQMouseEvent* e)
30 {
31  if (mReadOnly)
32  {
33  // Swallow up the event if it's the left button
34  if (e->button() == TQt::LeftButton)
35  return;
36  }
37  KPIM::IdentityCombo::mousePressEvent(e);
38 }
39 
40 void EmailIdCombo::mouseReleaseEvent(TQMouseEvent* e)
41 {
42  if (!mReadOnly)
43  KPIM::IdentityCombo::mouseReleaseEvent(e);
44 }
45 
46 void EmailIdCombo::mouseMoveEvent(TQMouseEvent* e)
47 {
48  if (!mReadOnly)
49  KPIM::IdentityCombo::mouseMoveEvent(e);
50 }
51 
52 void EmailIdCombo::keyPressEvent(TQKeyEvent* e)
53 {
54  if (!mReadOnly || e->key() == TQt::Key_Escape)
55  KPIM::IdentityCombo::keyPressEvent(e);
56 }
57 
58 void EmailIdCombo::keyReleaseEvent(TQKeyEvent* e)
59 {
60  if (!mReadOnly)
61  KPIM::IdentityCombo::keyReleaseEvent(e);
62 }