author | ar <ar> | 2005-01-21 20:19:00 (UTC) |
---|---|---|
committer | ar <ar> | 2005-01-21 20:19:00 (UTC) |
commit | 55eccecc08f839878e5743d6e6be25af386b5a3f (patch) (unidiff) | |
tree | fd663ded2a2c097ce53bac6c021ca652ef5b5508 | |
parent | cd51d382be50bc021739395309e23760f1619759 (diff) | |
download | opie-55eccecc08f839878e5743d6e6be25af386b5a3f.zip opie-55eccecc08f839878e5743d6e6be25af386b5a3f.tar.gz opie-55eccecc08f839878e5743d6e6be25af386b5a3f.tar.bz2 |
- make opie compilable against qte 2.3.10 snapshot
change QT_VERSION > 290 into QT_VERSION <= 0x030000
-rw-r--r-- | libopie2/opieui/olistview.cpp | 8 | ||||
-rw-r--r-- | libopie2/opieui/opopupmenu.cpp | 4 | ||||
-rw-r--r-- | libopie2/opieui/oselector.cpp | 2 | ||||
-rw-r--r-- | libopie2/opieui/oselector.h | 4 | ||||
-rw-r--r-- | libopie2/qt3/opiecore/osortablevaluelist.h | 2 | ||||
-rw-r--r-- | libopie2/qt3/opieui/ocombobox.cpp | 6 | ||||
-rw-r--r-- | libopie2/qt3/opieui/oeditlistbox.cpp | 6 | ||||
-rw-r--r-- | libopie2/qt3/opieui/olineedit.cpp | 6 |
8 files changed, 19 insertions, 19 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index 67b4b83..4386e0e 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp | |||
@@ -50,70 +50,70 @@ OListView::OListView( QWidget *parent, const char *name, WFlags fl ) | |||
50 | { | 50 | { |
51 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* | 51 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* |
52 | 52 | ||
53 | m_alternateBackground = QColor( 238, 246, 255 ); | 53 | m_alternateBackground = QColor( 238, 246, 255 ); |
54 | m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); | 54 | m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); |
55 | m_fullWidth = true; | 55 | m_fullWidth = true; |
56 | connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); | 56 | connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); |
57 | } | 57 | } |
58 | 58 | ||
59 | OListView::~OListView() | 59 | OListView::~OListView() |
60 | { | 60 | { |
61 | } | 61 | } |
62 | 62 | ||
63 | void OListView::setFullWidth( bool fullWidth ) | 63 | void OListView::setFullWidth( bool fullWidth ) |
64 | { | 64 | { |
65 | m_fullWidth = fullWidth; | 65 | m_fullWidth = fullWidth; |
66 | #if QT_VERSION > 290 | 66 | #if QT_VERSION >= 0x030000 |
67 | header()->setStretchEnabled( fullWidth, columns()-1 ); | 67 | header()->setStretchEnabled( fullWidth, columns()-1 ); |
68 | #endif | 68 | #endif |
69 | } | 69 | } |
70 | 70 | ||
71 | bool OListView::fullWidth() const | 71 | bool OListView::fullWidth() const |
72 | { | 72 | { |
73 | return m_fullWidth; | 73 | return m_fullWidth; |
74 | } | 74 | } |
75 | 75 | ||
76 | int OListView::addColumn( const QString& label, int width ) | 76 | int OListView::addColumn( const QString& label, int width ) |
77 | { | 77 | { |
78 | int result = QListView::addColumn( label, width ); | 78 | int result = QListView::addColumn( label, width ); |
79 | #if QT_VERSION > 290 | 79 | #if QT_VERSION >= 0x030000 |
80 | if (m_fullWidth) { | 80 | if (m_fullWidth) { |
81 | header()->setStretchEnabled( false, columns()-2 ); | 81 | header()->setStretchEnabled( false, columns()-2 ); |
82 | header()->setStretchEnabled( true, columns()-1 ); | 82 | header()->setStretchEnabled( true, columns()-1 ); |
83 | } | 83 | } |
84 | #endif | 84 | #endif |
85 | return result; | 85 | return result; |
86 | } | 86 | } |
87 | 87 | ||
88 | int OListView::addColumn( const QIconSet& iconset, const QString& label, int width ) | 88 | int OListView::addColumn( const QIconSet& iconset, const QString& label, int width ) |
89 | { | 89 | { |
90 | int result = QListView::addColumn( iconset, label, width ); | 90 | int result = QListView::addColumn( iconset, label, width ); |
91 | #if QT_VERSION > 290 | 91 | #if QT_VERSION >= 0x030000 |
92 | if (m_fullWidth) { | 92 | if (m_fullWidth) { |
93 | header()->setStretchEnabled( false, columns()-2 ); | 93 | header()->setStretchEnabled( false, columns()-2 ); |
94 | header()->setStretchEnabled( true, columns()-1 ); | 94 | header()->setStretchEnabled( true, columns()-1 ); |
95 | } | 95 | } |
96 | #endif | 96 | #endif |
97 | return result; | 97 | return result; |
98 | } | 98 | } |
99 | 99 | ||
100 | void OListView::removeColumn( int index ) | 100 | void OListView::removeColumn( int index ) |
101 | { | 101 | { |
102 | QListView::removeColumn(index); | 102 | QListView::removeColumn(index); |
103 | #if QT_VERSION > 290 | 103 | #if QT_VERSION >= 0x030000 |
104 | if ( m_fullWidth && index == columns() ) | 104 | if ( m_fullWidth && index == columns() ) |
105 | { | 105 | { |
106 | header()->setStretchEnabled( true, columns()-1 ); | 106 | header()->setStretchEnabled( true, columns()-1 ); |
107 | } | 107 | } |
108 | #endif | 108 | #endif |
109 | } | 109 | } |
110 | 110 | ||
111 | const QColor& OListView::alternateBackground() const | 111 | const QColor& OListView::alternateBackground() const |
112 | { | 112 | { |
113 | return m_alternateBackground; | 113 | return m_alternateBackground; |
114 | } | 114 | } |
115 | 115 | ||
116 | void OListView::setAlternateBackground( const QColor &c ) | 116 | void OListView::setAlternateBackground( const QColor &c ) |
117 | { | 117 | { |
118 | m_alternateBackground = c; | 118 | m_alternateBackground = c; |
119 | repaint(); | 119 | repaint(); |
diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp index 50c613f..5ce048e 100644 --- a/libopie2/opieui/opopupmenu.cpp +++ b/libopie2/opieui/opopupmenu.cpp | |||
@@ -72,33 +72,33 @@ void OPopupTitle::setText( const QString &text ) | |||
72 | int h = QMAX( fontMetrics().height(), miniicon.height() ); | 72 | int h = QMAX( fontMetrics().height(), miniicon.height() ); |
73 | setMinimumSize( w+16, h+8 ); | 73 | setMinimumSize( w+16, h+8 ); |
74 | } | 74 | } |
75 | 75 | ||
76 | void OPopupTitle::setIcon( const QPixmap &pix ) | 76 | void OPopupTitle::setIcon( const QPixmap &pix ) |
77 | { | 77 | { |
78 | miniicon = pix; | 78 | miniicon = pix; |
79 | int w = miniicon.width()+fontMetrics().width(titleStr); | 79 | int w = miniicon.width()+fontMetrics().width(titleStr); |
80 | int h = QMAX( fontMetrics().height(), miniicon.height() ); | 80 | int h = QMAX( fontMetrics().height(), miniicon.height() ); |
81 | setMinimumSize( w+16, h+8 ); | 81 | setMinimumSize( w+16, h+8 ); |
82 | } | 82 | } |
83 | 83 | ||
84 | void OPopupTitle::paintEvent(QPaintEvent *) | 84 | void OPopupTitle::paintEvent(QPaintEvent *) |
85 | { | 85 | { |
86 | QRect r(rect()); | 86 | QRect r(rect()); |
87 | QPainter p(this); | 87 | QPainter p(this); |
88 | #if QT_VERSION > 290 | 88 | #if QT_VERSION >= 0x030000 |
89 | qApp->style().drawPrimitive(QStyle::PE_HeaderSection, &p, r, palette().active()); | 89 | qApp->style().drawPrimitive(QStyle::PE_HeaderSection, &p, r, palette().active()); |
90 | #else | 90 | #else |
91 | #warning OPopupMenu is not fully functional on Qt2 | 91 | #warning OPopupMenu is not fully functional on Qt2 |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | if (!miniicon.isNull()) | 94 | if (!miniicon.isNull()) |
95 | p.drawPixmap(4, (r.height()-miniicon.height())/2, miniicon); | 95 | p.drawPixmap(4, (r.height()-miniicon.height())/2, miniicon); |
96 | 96 | ||
97 | if (!titleStr.isNull()) | 97 | if (!titleStr.isNull()) |
98 | { | 98 | { |
99 | p.setPen(palette().active().text()); | 99 | p.setPen(palette().active().text()); |
100 | QFont f = p.font(); | 100 | QFont f = p.font(); |
101 | f.setBold(true); | 101 | f.setBold(true); |
102 | p.setFont(f); | 102 | p.setFont(f); |
103 | if(!miniicon.isNull()) | 103 | if(!miniicon.isNull()) |
104 | { | 104 | { |
@@ -536,33 +536,33 @@ void OPopupMenu::ctxMenuHiding() | |||
536 | { | 536 | { |
537 | disconnect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int))); | 537 | disconnect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int))); |
538 | OPopupMenuPrivate::s_continueCtxMenuShow = true; | 538 | OPopupMenuPrivate::s_continueCtxMenuShow = true; |
539 | } | 539 | } |
540 | 540 | ||
541 | bool OPopupMenu::eventFilter(QObject* obj, QEvent* event) | 541 | bool OPopupMenu::eventFilter(QObject* obj, QEvent* event) |
542 | { | 542 | { |
543 | if (d->m_ctxMenu && obj == this) | 543 | if (d->m_ctxMenu && obj == this) |
544 | { | 544 | { |
545 | if (event->type() == QEvent::MouseButtonRelease) | 545 | if (event->type() == QEvent::MouseButtonRelease) |
546 | { | 546 | { |
547 | if (d->m_ctxMenu->isVisible()) | 547 | if (d->m_ctxMenu->isVisible()) |
548 | { | 548 | { |
549 | return true; | 549 | return true; |
550 | } | 550 | } |
551 | } | 551 | } |
552 | #if QT_VERSION > 290 | 552 | #if QT_VERSION >= 0x030000 |
553 | else if (event->type() == QEvent::ContextMenu) | 553 | else if (event->type() == QEvent::ContextMenu) |
554 | #else | 554 | #else |
555 | else if ( (event->type() == QEvent::MouseButtonPress) && | 555 | else if ( (event->type() == QEvent::MouseButtonPress) && |
556 | ( (QMouseEvent*) event )->button() == QMouseEvent::RightButton ) | 556 | ( (QMouseEvent*) event )->button() == QMouseEvent::RightButton ) |
557 | #endif | 557 | #endif |
558 | { | 558 | { |
559 | showCtxMenu(mapFromGlobal(QCursor::pos())); | 559 | showCtxMenu(mapFromGlobal(QCursor::pos())); |
560 | return true; | 560 | return true; |
561 | } | 561 | } |
562 | } | 562 | } |
563 | 563 | ||
564 | return QWidget::eventFilter(obj, event); | 564 | return QWidget::eventFilter(obj, event); |
565 | } | 565 | } |
566 | 566 | ||
567 | void OPopupMenu::hideEvent(QHideEvent*) | 567 | void OPopupMenu::hideEvent(QHideEvent*) |
568 | { | 568 | { |
diff --git a/libopie2/opieui/oselector.cpp b/libopie2/opieui/oselector.cpp index 05543c5..936dfe6 100644 --- a/libopie2/opieui/oselector.cpp +++ b/libopie2/opieui/oselector.cpp | |||
@@ -126,33 +126,33 @@ void OXYSelector::mousePressEvent( QMouseEvent *e ) | |||
126 | setValues( xVal, yVal ); | 126 | setValues( xVal, yVal ); |
127 | 127 | ||
128 | emit valueChanged( xPos, yPos ); | 128 | emit valueChanged( xPos, yPos ); |
129 | } | 129 | } |
130 | 130 | ||
131 | void OXYSelector::mouseMoveEvent( QMouseEvent *e ) | 131 | void OXYSelector::mouseMoveEvent( QMouseEvent *e ) |
132 | { | 132 | { |
133 | int xVal, yVal; | 133 | int xVal, yVal; |
134 | valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); | 134 | valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); |
135 | setValues( xVal, yVal ); | 135 | setValues( xVal, yVal ); |
136 | 136 | ||
137 | emit valueChanged( xPos, yPos ); | 137 | emit valueChanged( xPos, yPos ); |
138 | } | 138 | } |
139 | 139 | ||
140 | void OXYSelector::wheelEvent( QWheelEvent *e ) | 140 | void OXYSelector::wheelEvent( QWheelEvent *e ) |
141 | { | 141 | { |
142 | #if QT_VERSION > 290 | 142 | #if QT_VERSION >= 0x030000 |
143 | if ( e->orientation() == Qt::Horizontal ) | 143 | if ( e->orientation() == Qt::Horizontal ) |
144 | setValues( xValue() + e->delta()/120, yValue() ); | 144 | setValues( xValue() + e->delta()/120, yValue() ); |
145 | else | 145 | else |
146 | setValues( xValue(), yValue() + e->delta()/120 ); | 146 | setValues( xValue(), yValue() + e->delta()/120 ); |
147 | 147 | ||
148 | emit valueChanged( xPos, yPos ); | 148 | emit valueChanged( xPos, yPos ); |
149 | #else | 149 | #else |
150 | Q_UNUSED( e ) | 150 | Q_UNUSED( e ) |
151 | #endif | 151 | #endif |
152 | } | 152 | } |
153 | 153 | ||
154 | void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const | 154 | void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const |
155 | { | 155 | { |
156 | xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 ); | 156 | xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 ); |
157 | yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) ); | 157 | yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) ); |
158 | 158 | ||
diff --git a/libopie2/opieui/oselector.h b/libopie2/opieui/oselector.h index fe75a46..3dbdb38 100644 --- a/libopie2/opieui/oselector.h +++ b/libopie2/opieui/oselector.h | |||
@@ -195,48 +195,48 @@ public: | |||
195 | 195 | ||
196 | /** | 196 | /** |
197 | * Sets the value. | 197 | * Sets the value. |
198 | */ | 198 | */ |
199 | void setValue(int value) | 199 | void setValue(int value) |
200 | { QRangeControl::setValue(value); } | 200 | { QRangeControl::setValue(value); } |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * @returns the value. | 203 | * @returns the value. |
204 | */ | 204 | */ |
205 | int value() const | 205 | int value() const |
206 | { return QRangeControl::value(); } | 206 | { return QRangeControl::value(); } |
207 | 207 | ||
208 | /** | 208 | /** |
209 | * Sets the min value. | 209 | * Sets the min value. |
210 | */ | 210 | */ |
211 | #if ( QT_VERSION > 290 ) | 211 | #if ( QT_VERSION >= 0x030000 ) |
212 | void setMinValue(int value) { QRangeControl::setMinValue(value); } | 212 | void setMinValue(int value) { QRangeControl::setMinValue(value); } |
213 | #else | 213 | #else |
214 | void setMinValue(int value) { QRangeControl::setRange(value,QRangeControl::maxValue()); } | 214 | void setMinValue(int value) { QRangeControl::setRange(value,QRangeControl::maxValue()); } |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * @return the min value. | 218 | * @return the min value. |
219 | */ | 219 | */ |
220 | int minValue() const | 220 | int minValue() const |
221 | { return QRangeControl::minValue(); } | 221 | { return QRangeControl::minValue(); } |
222 | 222 | ||
223 | /** | 223 | /** |
224 | * Sets the max value. | 224 | * Sets the max value. |
225 | */ | 225 | */ |
226 | #if ( QT_VERSION > 290 ) | 226 | #if ( QT_VERSION >= 0x030000 ) |
227 | void setMaxValue(int value) { QRangeControl::setMaxValue(value); } | 227 | void setMaxValue(int value) { QRangeControl::setMaxValue(value); } |
228 | #else | 228 | #else |
229 | void setMaxValue(int value) { QRangeControl::setRange(QRangeControl::minValue(),value); } | 229 | void setMaxValue(int value) { QRangeControl::setRange(QRangeControl::minValue(),value); } |
230 | #endif | 230 | #endif |
231 | 231 | ||
232 | /** | 232 | /** |
233 | * @return the max value. | 233 | * @return the max value. |
234 | */ | 234 | */ |
235 | int maxValue() const | 235 | int maxValue() const |
236 | { return QRangeControl::maxValue(); } | 236 | { return QRangeControl::maxValue(); } |
237 | 237 | ||
238 | signals: | 238 | signals: |
239 | /** | 239 | /** |
240 | * This signal is emitted whenever the user chooses a value, | 240 | * This signal is emitted whenever the user chooses a value, |
241 | * e.g. by clicking with the mouse on the widget. | 241 | * e.g. by clicking with the mouse on the widget. |
242 | */ | 242 | */ |
diff --git a/libopie2/qt3/opiecore/osortablevaluelist.h b/libopie2/qt3/opiecore/osortablevaluelist.h index f66cf25..a3f75b4 100644 --- a/libopie2/qt3/opiecore/osortablevaluelist.h +++ b/libopie2/qt3/opiecore/osortablevaluelist.h | |||
@@ -18,33 +18,33 @@ | |||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OSORTABLEVALUELIST_H | 31 | #ifndef OSORTABLEVALUELIST_H |
32 | #define OSORTABLEVALUELIST_H | 32 | #define OSORTABLEVALUELIST_H |
33 | 33 | ||
34 | #if QT_VERSION > 290 | 34 | #if QT_VERSION >= 0x030000 |
35 | #include <qtl.h> | 35 | #include <qtl.h> |
36 | #include <qpair.h> | 36 | #include <qpair.h> |
37 | #else | 37 | #else |
38 | #include <opie2/otl.h> | 38 | #include <opie2/otl.h> |
39 | #include <opie2/opair.h> | 39 | #include <opie2/opair.h> |
40 | #endif | 40 | #endif |
41 | #include <qvaluelist.h> | 41 | #include <qvaluelist.h> |
42 | 42 | ||
43 | template<class T, class Key = int> class OSortableItem : public QPair<Key,T> | 43 | template<class T, class Key = int> class OSortableItem : public QPair<Key,T> |
44 | { | 44 | { |
45 | public: | 45 | public: |
46 | OSortableItem( Key i, const T& t ) : QPair<Key, T>( i, t ) {} | 46 | OSortableItem( Key i, const T& t ) : QPair<Key, T>( i, t ) {} |
47 | OSortableItem( const OSortableItem<T, Key> &rhs ) | 47 | OSortableItem( const OSortableItem<T, Key> &rhs ) |
48 | : QPair<Key,T>( rhs.first, rhs.second ) {} | 48 | : QPair<Key,T>( rhs.first, rhs.second ) {} |
49 | 49 | ||
50 | OSortableItem() {} | 50 | OSortableItem() {} |
diff --git a/libopie2/qt3/opieui/ocombobox.cpp b/libopie2/qt3/opieui/ocombobox.cpp index bd330e0..130112c 100644 --- a/libopie2/qt3/opieui/ocombobox.cpp +++ b/libopie2/qt3/opieui/ocombobox.cpp | |||
@@ -305,33 +305,33 @@ void OComboBox::setCompletedItems( const QStringList& items ) | |||
305 | OCompletionBox * OComboBox::completionBox( bool create ) | 305 | OCompletionBox * OComboBox::completionBox( bool create ) |
306 | { | 306 | { |
307 | if ( d->olineEdit ) | 307 | if ( d->olineEdit ) |
308 | return d->olineEdit->completionBox( create ); | 308 | return d->olineEdit->completionBox( create ); |
309 | return 0; | 309 | return 0; |
310 | } | 310 | } |
311 | 311 | ||
312 | // QWidget::create() turns off mouse-Tracking which would break auto-hiding | 312 | // QWidget::create() turns off mouse-Tracking which would break auto-hiding |
313 | void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow ) | 313 | void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow ) |
314 | { | 314 | { |
315 | QComboBox::create( id, initializeWindow, destroyOldWindow ); | 315 | QComboBox::create( id, initializeWindow, destroyOldWindow ); |
316 | //OCursor::setAutoHideCursor( lineEdit(), true, true ); | 316 | //OCursor::setAutoHideCursor( lineEdit(), true, true ); |
317 | } | 317 | } |
318 | 318 | ||
319 | void OComboBox::setLineEdit( OLineEdit *edit ) | 319 | void OComboBox::setLineEdit( OLineEdit *edit ) |
320 | { | 320 | { |
321 | #if QT_VERSION > 290 | 321 | #if QT_VERSION >= 0x030000 |
322 | QComboBox::setLineEdit( edit ); | 322 | QComboBox::setLineEdit( edit ); |
323 | if ( !edit->inherits( "OLineEdit" ) ) | 323 | if ( !edit->inherits( "OLineEdit" ) ) |
324 | d->olineEdit = 0; | 324 | d->olineEdit = 0; |
325 | else | 325 | else |
326 | d->olineEdit = static_cast<OLineEdit*>( edit ); | 326 | d->olineEdit = static_cast<OLineEdit*>( edit ); |
327 | setDelegate( d->olineEdit ); | 327 | setDelegate( d->olineEdit ); |
328 | 328 | ||
329 | // forward some signals. We only emit returnPressed() ourselves. | 329 | // forward some signals. We only emit returnPressed() ourselves. |
330 | if ( d->olineEdit ) { | 330 | if ( d->olineEdit ) { |
331 | connect( d->olineEdit, SIGNAL( completion(const QString&)), | 331 | connect( d->olineEdit, SIGNAL( completion(const QString&)), |
332 | SIGNAL( completion(const QString&)) ); | 332 | SIGNAL( completion(const QString&)) ); |
333 | connect( d->olineEdit, SIGNAL( substringCompletion(const QString&)), | 333 | connect( d->olineEdit, SIGNAL( substringCompletion(const QString&)), |
334 | SIGNAL( substringCompletion(const QString&)) ); | 334 | SIGNAL( substringCompletion(const QString&)) ); |
335 | connect( d->olineEdit, | 335 | connect( d->olineEdit, |
336 | SIGNAL( textRotation(OCompletionBase::KeyBindingType)), | 336 | SIGNAL( textRotation(OCompletionBase::KeyBindingType)), |
337 | SIGNAL( textRotation(OCompletionBase::KeyBindingType)) ); | 337 | SIGNAL( textRotation(OCompletionBase::KeyBindingType)) ); |
@@ -339,46 +339,46 @@ void OComboBox::setLineEdit( OLineEdit *edit ) | |||
339 | SIGNAL( completionModeChanged(OGlobalSettings::Completion)), | 339 | SIGNAL( completionModeChanged(OGlobalSettings::Completion)), |
340 | SIGNAL( completionModeChanged(OGlobalSettings::Completion))); | 340 | SIGNAL( completionModeChanged(OGlobalSettings::Completion))); |
341 | 341 | ||
342 | connect( d->olineEdit, | 342 | connect( d->olineEdit, |
343 | SIGNAL( aboutToShowContextMenu(QPopupMenu*)), | 343 | SIGNAL( aboutToShowContextMenu(QPopupMenu*)), |
344 | SIGNAL( aboutToShowContextMenu(QPopupMenu*)) ); | 344 | SIGNAL( aboutToShowContextMenu(QPopupMenu*)) ); |
345 | } | 345 | } |
346 | #else | 346 | #else |
347 | #warning OComboBox is not fully functional with Qt2 | 347 | #warning OComboBox is not fully functional with Qt2 |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | 350 | ||
351 | // Temporary functions until QT3 appears. - Seth Chaiklin 20 may 2001 | 351 | // Temporary functions until QT3 appears. - Seth Chaiklin 20 may 2001 |
352 | void OComboBox::deleteWordForward() | 352 | void OComboBox::deleteWordForward() |
353 | { | 353 | { |
354 | lineEdit()->cursorWordForward(TRUE); | 354 | lineEdit()->cursorWordForward(TRUE); |
355 | #if QT_VERSION > 290 | 355 | #if QT_VERSION >= 0x030000 |
356 | if ( lineEdit()->hasSelectedText() ) | 356 | if ( lineEdit()->hasSelectedText() ) |
357 | #else | 357 | #else |
358 | if ( lineEdit()->hasMarkedText() ) | 358 | if ( lineEdit()->hasMarkedText() ) |
359 | #endif | 359 | #endif |
360 | { | 360 | { |
361 | lineEdit()->del(); | 361 | lineEdit()->del(); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | void OComboBox::deleteWordBack() | 365 | void OComboBox::deleteWordBack() |
366 | { | 366 | { |
367 | lineEdit()->cursorWordBackward(TRUE); | 367 | lineEdit()->cursorWordBackward(TRUE); |
368 | #if QT_VERSION > 290 | 368 | #if QT_VERSION >= 0x030000 |
369 | if ( lineEdit()->hasSelectedText() ) | 369 | if ( lineEdit()->hasSelectedText() ) |
370 | #else | 370 | #else |
371 | if ( lineEdit()->hasMarkedText() ) | 371 | if ( lineEdit()->hasMarkedText() ) |
372 | #endif | 372 | #endif |
373 | { | 373 | { |
374 | lineEdit()->del(); | 374 | lineEdit()->del(); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | void OComboBox::setCurrentItem( const QString& item, bool insert, int index ) | 378 | void OComboBox::setCurrentItem( const QString& item, bool insert, int index ) |
379 | { | 379 | { |
380 | int sel = -1; | 380 | int sel = -1; |
381 | for (int i = 0; i < count(); ++i) | 381 | for (int i = 0; i < count(); ++i) |
382 | if (text(i) == item) | 382 | if (text(i) == item) |
383 | { | 383 | { |
384 | sel = i; | 384 | sel = i; |
diff --git a/libopie2/qt3/opieui/oeditlistbox.cpp b/libopie2/qt3/opieui/oeditlistbox.cpp index 0e95274..dcc697d 100644 --- a/libopie2/qt3/opieui/oeditlistbox.cpp +++ b/libopie2/qt3/opieui/oeditlistbox.cpp | |||
@@ -179,33 +179,33 @@ void OEditListBox::typedSomething(const QString& text) | |||
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | if ( !servNewButton ) | 182 | if ( !servNewButton ) |
183 | return; | 183 | return; |
184 | 184 | ||
185 | if (!d->m_checkAtEntering) | 185 | if (!d->m_checkAtEntering) |
186 | servNewButton->setEnabled(!text.isEmpty()); | 186 | servNewButton->setEnabled(!text.isEmpty()); |
187 | else | 187 | else |
188 | { | 188 | { |
189 | if (text.isEmpty()) | 189 | if (text.isEmpty()) |
190 | { | 190 | { |
191 | servNewButton->setEnabled(false); | 191 | servNewButton->setEnabled(false); |
192 | } | 192 | } |
193 | else | 193 | else |
194 | { | 194 | { |
195 | #if QT_VERSION > 290 | 195 | #if QT_VERSION >= 0x030000 |
196 | StringComparisonMode mode = (StringComparisonMode) (ExactMatch | CaseSensitive ); | 196 | StringComparisonMode mode = (StringComparisonMode) (ExactMatch | CaseSensitive ); |
197 | bool enable = (m_listBox->findItem( text, mode ) == 0L); | 197 | bool enable = (m_listBox->findItem( text, mode ) == 0L); |
198 | #else | 198 | #else |
199 | bool enable = (m_listBox->findItem( text ) == 0L); | 199 | bool enable = (m_listBox->findItem( text ) == 0L); |
200 | #endif | 200 | #endif |
201 | servNewButton->setEnabled( enable ); | 201 | servNewButton->setEnabled( enable ); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | void OEditListBox::moveItemUp() | 206 | void OEditListBox::moveItemUp() |
207 | { | 207 | { |
208 | if (!m_listBox->isEnabled()) | 208 | if (!m_listBox->isEnabled()) |
209 | { | 209 | { |
210 | //ONotifyClient::beep(); | 210 | //ONotifyClient::beep(); |
211 | return; | 211 | return; |
@@ -254,66 +254,66 @@ void OEditListBox::addItem() | |||
254 | // when m_checkAtEntering is true, the add-button is disabled, but this | 254 | // when m_checkAtEntering is true, the add-button is disabled, but this |
255 | // slot can still be called through Key_Return/Key_Enter. So we guard | 255 | // slot can still be called through Key_Return/Key_Enter. So we guard |
256 | // against this. | 256 | // against this. |
257 | if ( !servNewButton || !servNewButton->isEnabled() ) | 257 | if ( !servNewButton || !servNewButton->isEnabled() ) |
258 | return; | 258 | return; |
259 | 259 | ||
260 | const QString& currentTextLE=m_lineEdit->text(); | 260 | const QString& currentTextLE=m_lineEdit->text(); |
261 | bool alreadyInList(false); | 261 | bool alreadyInList(false); |
262 | //if we didn't check for dupes at the inserting we have to do it now | 262 | //if we didn't check for dupes at the inserting we have to do it now |
263 | if (!d->m_checkAtEntering) | 263 | if (!d->m_checkAtEntering) |
264 | { | 264 | { |
265 | // first check current item instead of dumb iterating the entire list | 265 | // first check current item instead of dumb iterating the entire list |
266 | if ( m_listBox->currentText() == currentTextLE ) | 266 | if ( m_listBox->currentText() == currentTextLE ) |
267 | alreadyInList = true; | 267 | alreadyInList = true; |
268 | else | 268 | else |
269 | { | 269 | { |
270 | #if QT_VERSION > 290 | 270 | #if QT_VERSION >= 0x030000 |
271 | StringComparisonMode mode = (StringComparisonMode) (ExactMatch | CaseSensitive ); | 271 | StringComparisonMode mode = (StringComparisonMode) (ExactMatch | CaseSensitive ); |
272 | alreadyInList =(m_listBox->findItem(currentTextLE, mode) != 0); | 272 | alreadyInList =(m_listBox->findItem(currentTextLE, mode) != 0); |
273 | #else | 273 | #else |
274 | alreadyInList =(m_listBox->findItem(currentTextLE) != 0); | 274 | alreadyInList =(m_listBox->findItem(currentTextLE) != 0); |
275 | #endif | 275 | #endif |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | if ( servNewButton ) | 279 | if ( servNewButton ) |
280 | servNewButton->setEnabled(false); | 280 | servNewButton->setEnabled(false); |
281 | 281 | ||
282 | bool block = m_lineEdit->signalsBlocked(); | 282 | bool block = m_lineEdit->signalsBlocked(); |
283 | m_lineEdit->blockSignals(true); | 283 | m_lineEdit->blockSignals(true); |
284 | m_lineEdit->clear(); | 284 | m_lineEdit->clear(); |
285 | m_lineEdit->blockSignals(block); | 285 | m_lineEdit->blockSignals(block); |
286 | 286 | ||
287 | m_listBox->setSelected(currentItem(), false); | 287 | m_listBox->setSelected(currentItem(), false); |
288 | 288 | ||
289 | if (!alreadyInList) | 289 | if (!alreadyInList) |
290 | { | 290 | { |
291 | block = m_listBox->signalsBlocked(); | 291 | block = m_listBox->signalsBlocked(); |
292 | m_listBox->blockSignals( true ); | 292 | m_listBox->blockSignals( true ); |
293 | m_listBox->insertItem(currentTextLE); | 293 | m_listBox->insertItem(currentTextLE); |
294 | m_listBox->blockSignals( block ); | 294 | m_listBox->blockSignals( block ); |
295 | emit changed(); | 295 | emit changed(); |
296 | emit added( currentTextLE ); | 296 | emit added( currentTextLE ); |
297 | } | 297 | } |
298 | } | 298 | } |
299 | 299 | ||
300 | int OEditListBox::currentItem() const | 300 | int OEditListBox::currentItem() const |
301 | { | 301 | { |
302 | int nr = m_listBox->currentItem(); | 302 | int nr = m_listBox->currentItem(); |
303 | #if QT_VERSION > 290 | 303 | #if QT_VERSION >= 0x030000 |
304 | if(nr >= 0 && !m_listBox->item(nr)->isSelected()) return -1; | 304 | if(nr >= 0 && !m_listBox->item(nr)->isSelected()) return -1; |
305 | #else | 305 | #else |
306 | if(nr >= 0 && !m_listBox->isSelected(m_listBox->item(nr))) return -1; | 306 | if(nr >= 0 && !m_listBox->isSelected(m_listBox->item(nr))) return -1; |
307 | #endif | 307 | #endif |
308 | return nr; | 308 | return nr; |
309 | } | 309 | } |
310 | 310 | ||
311 | void OEditListBox::removeItem() | 311 | void OEditListBox::removeItem() |
312 | { | 312 | { |
313 | int selected = m_listBox->currentItem(); | 313 | int selected = m_listBox->currentItem(); |
314 | 314 | ||
315 | if ( selected >= 0 ) | 315 | if ( selected >= 0 ) |
316 | { | 316 | { |
317 | QString removedText = m_listBox->currentText(); | 317 | QString removedText = m_listBox->currentText(); |
318 | 318 | ||
319 | m_listBox->removeItem( selected ); | 319 | m_listBox->removeItem( selected ); |
diff --git a/libopie2/qt3/opieui/olineedit.cpp b/libopie2/qt3/opieui/olineedit.cpp index 6f66fc7..b150987 100644 --- a/libopie2/qt3/opieui/olineedit.cpp +++ b/libopie2/qt3/opieui/olineedit.cpp | |||
@@ -132,33 +132,33 @@ void OLineEdit::setCompletedText( const QString& text ) | |||
132 | mode == OGlobalSettings::CompletionMan || | 132 | mode == OGlobalSettings::CompletionMan || |
133 | mode == OGlobalSettings::CompletionPopup ); | 133 | mode == OGlobalSettings::CompletionPopup ); |
134 | setCompletedText( text, marked ); | 134 | setCompletedText( text, marked ); |
135 | } | 135 | } |
136 | 136 | ||
137 | void OLineEdit::rotateText( OCompletionBase::KeyBindingType type ) | 137 | void OLineEdit::rotateText( OCompletionBase::KeyBindingType type ) |
138 | { | 138 | { |
139 | OCompletion* comp = compObj(); | 139 | OCompletion* comp = compObj(); |
140 | if ( comp && | 140 | if ( comp && |
141 | (type == OCompletionBase::PrevCompletionMatch || | 141 | (type == OCompletionBase::PrevCompletionMatch || |
142 | type == OCompletionBase::NextCompletionMatch ) ) | 142 | type == OCompletionBase::NextCompletionMatch ) ) |
143 | { | 143 | { |
144 | QString input = (type == OCompletionBase::PrevCompletionMatch) ? comp->previousMatch() : comp->nextMatch(); | 144 | QString input = (type == OCompletionBase::PrevCompletionMatch) ? comp->previousMatch() : comp->nextMatch(); |
145 | // Skip rotation if previous/next match is null or the same text | 145 | // Skip rotation if previous/next match is null or the same text |
146 | if ( input.isNull() || input == displayText() ) | 146 | if ( input.isNull() || input == displayText() ) |
147 | return; | 147 | return; |
148 | #if QT_VERSION > 290 | 148 | #if QT_VERSION >= 0x030000 |
149 | setCompletedText( input, hasSelectedText() ); | 149 | setCompletedText( input, hasSelectedText() ); |
150 | #else | 150 | #else |
151 | setCompletedText( input, hasMarkedText() ); | 151 | setCompletedText( input, hasMarkedText() ); |
152 | #endif | 152 | #endif |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | void OLineEdit::makeCompletion( const QString& text ) | 156 | void OLineEdit::makeCompletion( const QString& text ) |
157 | { | 157 | { |
158 | OCompletion *comp = compObj(); | 158 | OCompletion *comp = compObj(); |
159 | if ( !comp ) | 159 | if ( !comp ) |
160 | return; // No completion object... | 160 | return; // No completion object... |
161 | 161 | ||
162 | QString match = comp->makeCompletion( text ); | 162 | QString match = comp->makeCompletion( text ); |
163 | OGlobalSettings::Completion mode = completionMode(); | 163 | OGlobalSettings::Completion mode = completionMode(); |
164 | if ( mode == OGlobalSettings::CompletionPopup ) | 164 | if ( mode == OGlobalSettings::CompletionPopup ) |
@@ -258,33 +258,33 @@ void OLineEdit::keyPressEvent( QKeyEvent *e ) | |||
258 | if ( echoMode() == QLineEdit::Normal && | 258 | if ( echoMode() == QLineEdit::Normal && |
259 | completionMode() != OGlobalSettings::CompletionNone ) | 259 | completionMode() != OGlobalSettings::CompletionNone ) |
260 | { | 260 | { |
261 | KeyBindingMap keys = getKeyBindings(); | 261 | KeyBindingMap keys = getKeyBindings(); |
262 | OGlobalSettings::Completion mode = completionMode(); | 262 | OGlobalSettings::Completion mode = completionMode(); |
263 | bool noModifier = (e->state() == NoButton || e->state()== ShiftButton); | 263 | bool noModifier = (e->state() == NoButton || e->state()== ShiftButton); |
264 | 264 | ||
265 | if ( (mode == OGlobalSettings::CompletionAuto || | 265 | if ( (mode == OGlobalSettings::CompletionAuto || |
266 | mode == OGlobalSettings::CompletionMan) && noModifier ) | 266 | mode == OGlobalSettings::CompletionMan) && noModifier ) |
267 | { | 267 | { |
268 | QString keycode = e->text(); | 268 | QString keycode = e->text(); |
269 | if ( !keycode.isNull() && keycode.unicode()->isPrint() ) | 269 | if ( !keycode.isNull() && keycode.unicode()->isPrint() ) |
270 | { | 270 | { |
271 | QLineEdit::keyPressEvent ( e ); | 271 | QLineEdit::keyPressEvent ( e ); |
272 | QString txt = text(); | 272 | QString txt = text(); |
273 | int len = txt.length(); | 273 | int len = txt.length(); |
274 | #if QT_VERSION > 290 | 274 | #if QT_VERSION >= 0x030000 |
275 | if ( !hasSelectedText() && len && cursorPosition() == len ) | 275 | if ( !hasSelectedText() && len && cursorPosition() == len ) |
276 | #else | 276 | #else |
277 | if ( !hasMarkedText() && len && cursorPosition() == len ) | 277 | if ( !hasMarkedText() && len && cursorPosition() == len ) |
278 | #endif | 278 | #endif |
279 | { | 279 | { |
280 | if ( emitSignals() ) | 280 | if ( emitSignals() ) |
281 | emit completion( txt ); | 281 | emit completion( txt ); |
282 | if ( handleSignals() ) | 282 | if ( handleSignals() ) |
283 | makeCompletion( txt ); | 283 | makeCompletion( txt ); |
284 | e->accept(); | 284 | e->accept(); |
285 | } | 285 | } |
286 | return; | 286 | return; |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | else if ( mode == OGlobalSettings::CompletionPopup && noModifier ) | 290 | else if ( mode == OGlobalSettings::CompletionPopup && noModifier ) |
@@ -423,33 +423,33 @@ void OLineEdit::mousePressEvent( QMouseEvent* e ) | |||
423 | return; | 423 | return; |
424 | } | 424 | } |
425 | QLineEdit::mousePressEvent( e ); | 425 | QLineEdit::mousePressEvent( e ); |
426 | } | 426 | } |
427 | 427 | ||
428 | void OLineEdit::tripleClickTimeout() | 428 | void OLineEdit::tripleClickTimeout() |
429 | { | 429 | { |
430 | possibleTripleClick=false; | 430 | possibleTripleClick=false; |
431 | } | 431 | } |
432 | 432 | ||
433 | QPopupMenu *OLineEdit::createPopupMenu() | 433 | QPopupMenu *OLineEdit::createPopupMenu() |
434 | { | 434 | { |
435 | // Return if popup menu is not enabled !! | 435 | // Return if popup menu is not enabled !! |
436 | if ( !m_bEnableMenu ) | 436 | if ( !m_bEnableMenu ) |
437 | return 0; | 437 | return 0; |
438 | 438 | ||
439 | #if QT_VERSION > 290 | 439 | #if QT_VERSION >= 0x030000 |
440 | QPopupMenu *popup = QLineEdit::createPopupMenu(); | 440 | QPopupMenu *popup = QLineEdit::createPopupMenu(); |
441 | #else | 441 | #else |
442 | QPopupMenu *popup = new QPopupMenu(); | 442 | QPopupMenu *popup = new QPopupMenu(); |
443 | #warning OLineEdit is not fully functional on Qt2 | 443 | #warning OLineEdit is not fully functional on Qt2 |
444 | #endif | 444 | #endif |
445 | 445 | ||
446 | // completion object is present. | 446 | // completion object is present. |
447 | if ( compObj() ) | 447 | if ( compObj() ) |
448 | { | 448 | { |
449 | QPopupMenu *subMenu = new QPopupMenu( popup ); | 449 | QPopupMenu *subMenu = new QPopupMenu( popup ); |
450 | connect( subMenu, SIGNAL( activated(int) ), | 450 | connect( subMenu, SIGNAL( activated(int) ), |
451 | this, SLOT( completionMenuActivated(int) ) ); | 451 | this, SLOT( completionMenuActivated(int) ) ); |
452 | 452 | ||
453 | popup->insertSeparator(); | 453 | popup->insertSeparator(); |
454 | //popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"), | 454 | //popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"), |
455 | // subMenu ); | 455 | // subMenu ); |