Changeset View
Changeset View
Standalone View
Standalone View
kcms/componentchooser/componentchooser.h
Show All 29 Lines | |||||
30 | { | 30 | { | ||
31 | Q_OBJECT | 31 | Q_OBJECT | ||
32 | 32 | | |||
33 | public: | 33 | public: | ||
34 | CfgPlugin(QWidget *parent): QComboBox(parent) {} | 34 | CfgPlugin(QWidget *parent): QComboBox(parent) {} | ||
35 | virtual ~CfgPlugin(){} | 35 | virtual ~CfgPlugin(){} | ||
36 | virtual void load(KConfig *cfg)=0; | 36 | virtual void load(KConfig *cfg)=0; | ||
37 | virtual void save(KConfig *cfg)=0; | 37 | virtual void save(KConfig *cfg)=0; | ||
38 | | ||||
38 | bool hasChanged() const | 39 | bool hasChanged() const | ||
39 | { | 40 | { | ||
40 | return m_currentIndex != -1 && m_currentIndex != currentIndex(); | 41 | return count() > 1 && m_currentIndex != currentIndex(); | ||
41 | } | 42 | } | ||
42 | 43 | | |||
43 | void defaults() | 44 | void defaults() | ||
44 | { | 45 | { | ||
45 | if (m_defaultIndex != -1) { | 46 | if (m_defaultIndex != -1) { | ||
46 | setCurrentIndex(m_defaultIndex); | 47 | setCurrentIndex(m_defaultIndex); | ||
47 | } | 48 | } | ||
48 | } | 49 | } | ||
49 | 50 | | |||
51 | int validLastCurrentIndex() const | ||||
anthonyfieroni: { in new line, add const | |||||
52 | { | ||||
53 | // m_currentIndex == -1 means there are no previously saved value | ||||
54 | // or maybe there were no choices in the combobox | ||||
55 | // return 0 in those cases | ||||
56 | return m_currentIndex == -1 ? 0 : m_currentIndex; | ||||
57 | } | ||||
58 | | ||||
50 | bool isDefaults() const | 59 | bool isDefaults() const | ||
51 | { | 60 | { | ||
52 | return m_defaultIndex == -1 || m_defaultIndex == currentIndex(); | 61 | return m_defaultIndex == -1 || m_defaultIndex == currentIndex(); | ||
53 | } | 62 | } | ||
54 | 63 | | |||
55 | Q_SIGNALS: | 64 | Q_SIGNALS: | ||
56 | void changed(bool); | 65 | void changed(bool); | ||
57 | 66 | | |||
Show All 34 Lines |
{ in new line, add const