kalarm
emailidcombo.cpp
Go to the documentation of this file.00001 /* 00002 * emailidcombo.cpp - email identity combo box with read-only option 00003 * Program: kalarm 00004 * Copyright (c) 2004 by David Jarvie <software@astrojar.org.uk> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include <QMouseEvent> 00022 #include <QKeyEvent> 00023 #include "emailidcombo.moc" 00024 00025 00026 EmailIdCombo::EmailIdCombo(KPIMIdentities::IdentityManager* manager, QWidget* parent) 00027 : KPIMIdentities::IdentityCombo(manager, parent), 00028 mReadOnly(false) 00029 { } 00030 00031 void EmailIdCombo::mousePressEvent(QMouseEvent* e) 00032 { 00033 if (mReadOnly) 00034 { 00035 // Swallow up the event if it's the left button 00036 if (e->button() == Qt::LeftButton) 00037 return; 00038 } 00039 KPIMIdentities::IdentityCombo::mousePressEvent(e); 00040 } 00041 00042 void EmailIdCombo::mouseReleaseEvent(QMouseEvent* e) 00043 { 00044 if (!mReadOnly) 00045 KPIMIdentities::IdentityCombo::mouseReleaseEvent(e); 00046 } 00047 00048 void EmailIdCombo::mouseMoveEvent(QMouseEvent* e) 00049 { 00050 if (!mReadOnly) 00051 KPIMIdentities::IdentityCombo::mouseMoveEvent(e); 00052 } 00053 00054 void EmailIdCombo::keyPressEvent(QKeyEvent* e) 00055 { 00056 if (!mReadOnly || e->key() == Qt::Key_Escape) 00057 KPIMIdentities::IdentityCombo::keyPressEvent(e); 00058 } 00059 00060 void EmailIdCombo::keyReleaseEvent(QKeyEvent* e) 00061 { 00062 if (!mReadOnly) 00063 KPIMIdentities::IdentityCombo::keyReleaseEvent(e); 00064 }
KDE 4.2 API Reference