/usr/include/kmymoney/kmymoneycombo.h is in kmymoney-dev 4.6.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | /***************************************************************************
kmymoneycombo.h - description
-------------------
begin : Mon Mar 12 2007
copyright : (C) 2007 by Thomas Baumgart
email : ipwizard@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KMYMONEYCOMBO_H
#define KMYMONEYCOMBO_H
// ----------------------------------------------------------------------------
// QT Includes
#include <QTimer>
#include <QMutex>
#include <QPaintEvent>
#include <QFocusEvent>
#include <QList>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QStandardItemModel>
// ----------------------------------------------------------------------------
// KDE Includes
#include <kcombobox.h>
// ----------------------------------------------------------------------------
// Project Includes
class kMyMoneyCompletion;
class KMyMoneySelector;
class kMyMoneyLineEdit;
/**
* @author Thomas Baumgart
*/
class KMyMoneyCombo : public KComboBox
{
Q_OBJECT
Q_PROPERTY(QString selectedItem READ selectedItem WRITE setSelectedItem STORED false)
public:
KMyMoneyCombo(QWidget *w = 0);
explicit KMyMoneyCombo(bool rw, QWidget *w = 0);
/**
* This method is used to turn on/off the hint display and to setup the appropriate text.
* The hint text is shown in a lighter color if the field is otherwise empty and does
* not have the keyboard focus.
*
* @param hint reference to text. If @a hint is empty, no hint will be shown.
*/
void setClickMessage(const QString& hint) const;
/**
* overridden for internal reasons.
*
* @param editable make combo box editable (@a true) or selectable only (@a false).
*/
void setEditable(bool editable);
/**
* This method returns a pointer to the completion object of the combo box.
*
* @return pointer to kMyMoneyCompletion or derivative.
*/
kMyMoneyCompletion* completion(void) const;
/**
* This method returns a pointer to the completion object's selector.
*
* @return pointer to KMyMoneySelector or derivative.
*/
KMyMoneySelector* selector(void) const;
/**
* This method returns the ids of the currently selected items
*/
void selectedItems(QStringList& list) const;
/**
* This method returns the id of the first selected item.
* Usage makes usually only sense when the selection mode
* of the associated KMyMoneySelector is QListView::Single.
*
* @sa KMyMoneySelector::setSelectionMode()
*
* @param id reference to QString containing the id. If no item
* is selected id will be empty.
*/
KDE_DEPRECATED void selectedItem(QString& id) const;
/**
* This method returns the id of the first selected item.
* Usage makes usually only sense when the selection mode
* of the associated KMyMoneySelector is QListView::Single.
*
* @sa KMyMoneySelector::setSelectionMode()
*
* @return reference to QString containing the id. If no item
* is selected the QString will be empty.
*/
const QString& selectedItem(void) const {
return m_id;
}
/**
* This method selects the item with the respective @a id.
*
* @param id reference to QString containing the id
*/
void setSelectedItem(const QString& id);
/**
* This method checks if the position @a pos is part of the
* area of the drop down arrow.
*/
bool isInArrowArea(const QPoint& pos) const;
void setSuppressObjectCreation(bool suppress) {
m_canCreateObjects = !suppress;
}
/**
* overridden for internal reasons, no API change
*/
void setCurrentText(const QString& txt = QString()) {
KComboBox::setItemText(KComboBox::currentIndex(), txt);
}
/**
* Overridden to support our own completion box
*/
QSize sizeHint() const;
protected slots:
virtual void slotItemSelected(const QString& id);
protected:
/**
* reimplemented to support our own popup widget
*/
void mousePressEvent(QMouseEvent *e);
/**
* reimplemented to support our own popup widget
*/
void keyPressEvent(QKeyEvent *e);
/**
* reimplemented to support our own popup widget
*/
void paintEvent(QPaintEvent *);
/**
* reimplemented to support detection of new items
*/
void focusOutEvent(QFocusEvent*);
/**
* set the widgets text area based on the item with the given @a id.
*/
virtual void setCurrentTextById(const QString& id);
/**
* Overridden for internal reasons, no API change
*/
void connectNotify(const char* signal);
/**
* Overridden for internal reasons, no API change
*/
void disconnectNotify(const char* signal);
protected:
/**
* This member keeps a pointer to the object's completion object
*/
kMyMoneyCompletion* m_completion;
/**
* Use our own line edit to provide hint functionality
*/
kMyMoneyLineEdit* m_edit;
/**
* The currently selected item
*/
QString m_id;
signals:
void itemSelected(const QString& id);
void objectCreation(bool);
void createItem(const QString&, QString&);
private:
QTimer m_timer;
QMutex m_focusMutex;
/**
* Flag to control object creation. Use setSuppressObjectCreation()
* to modify it's setting. Defaults to @a false.
*/
bool m_canCreateObjects;
/**
* Flag to check whether a focusOutEvent processing is underway or not
*/
bool m_inFocusOutEvent;
};
#endif
|