author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdeui/kjanuswidget.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kdeui/kjanuswidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/kjanuswidget.cpp | 140 |
1 files changed, 74 insertions, 66 deletions
diff --git a/microkde/kdeui/kjanuswidget.cpp b/microkde/kdeui/kjanuswidget.cpp index 462c44f..3d9173d 100644 --- a/microkde/kdeui/kjanuswidget.cpp +++ b/microkde/kdeui/kjanuswidget.cpp | |||
@@ -22,15 +22,23 @@ | |||
22 | #include <qbitmap.h> | 22 | #include <qbitmap.h> |
23 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qwidgetstack.h> | 25 | #include <q3widgetstack.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qlistview.h> | 27 | #include <q3listview.h> |
28 | #include <qhbox.h> | 28 | #include <q3hbox.h> |
29 | #include <qvbox.h> | 29 | #include <q3vbox.h> |
30 | #include <qgrid.h> | 30 | #include <q3grid.h> |
31 | #include <qpainter.h> | 31 | #include <qpainter.h> |
32 | #include <qobjectlist.h> | 32 | #include <qobject.h> |
33 | #include <qstringlist.h> | 33 | #include <qstringlist.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3HBoxLayout> | ||
36 | #include <Q3GridLayout> | ||
37 | #include <Q3PtrList> | ||
38 | #include <Q3Frame> | ||
39 | #include <QEvent> | ||
40 | #include <Q3VBoxLayout> | ||
41 | #include <QShowEvent> | ||
34 | /*US | 42 | /*US |
35 | #include <qbitmap.h> | 43 | #include <qbitmap.h> |
36 | #include <qgrid.h> | 44 | #include <qgrid.h> |
@@ -65,13 +73,13 @@ | |||
65 | 73 | ||
66 | #include "kjanuswidget.h" | 74 | #include "kjanuswidget.h" |
67 | 75 | ||
68 | class KJanusWidget::IconListItem : public QListBoxItem | 76 | class KJanusWidget::IconListItem : public Q3ListBoxItem |
69 | { | 77 | { |
70 | public: | 78 | public: |
71 | IconListItem( QListBox *listbox, const QPixmap &pixmap, | 79 | IconListItem( Q3ListBox *listbox, const QPixmap &pixmap, |
72 | const QString &text ); | 80 | const QString &text ); |
73 | virtual int height( const QListBox *lb ) const; | 81 | virtual int height( const Q3ListBox *lb ) const; |
74 | virtual int width( const QListBox *lb ) const; | 82 | virtual int width( const Q3ListBox *lb ) const; |
75 | int expandMinimumWidth( int width ); | 83 | int expandMinimumWidth( int width ); |
76 | 84 | ||
77 | protected: | 85 | protected: |
@@ -98,7 +106,7 @@ public: | |||
98 | QMap<int, QString> mIntToTitle; | 106 | QMap<int, QString> mIntToTitle; |
99 | }; | 107 | }; |
100 | 108 | ||
101 | template class QPtrList<QListViewItem>; | 109 | template class Q3PtrList<Q3ListViewItem>; |
102 | 110 | ||
103 | 111 | ||
104 | KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | 112 | KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) |
@@ -107,12 +115,12 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | |||
107 | mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0), | 115 | mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0), |
108 | mShowIconsInTreeList(false), d(0) | 116 | mShowIconsInTreeList(false), d(0) |
109 | { | 117 | { |
110 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 118 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( this ); |
111 | if( mFace == TreeList || mFace == IconList ) | 119 | if( mFace == TreeList || mFace == IconList ) |
112 | { | 120 | { |
113 | d = new KJanusWidgetPrivate; | 121 | d = new KJanusWidgetPrivate; |
114 | 122 | ||
115 | QFrame *page = 0; | 123 | Q3Frame *page = 0; |
116 | if( mFace == TreeList ) | 124 | if( mFace == TreeList ) |
117 | { | 125 | { |
118 | //US | 126 | //US |
@@ -145,7 +153,7 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | |||
145 | } | 153 | } |
146 | else | 154 | else |
147 | { | 155 | { |
148 | QHBoxLayout *hbox = new QHBoxLayout( topLayout ); | 156 | Q3HBoxLayout *hbox = new Q3HBoxLayout( topLayout ); |
149 | mIconList = new IconListBox( this ); | 157 | mIconList = new IconListBox( this ); |
150 | 158 | ||
151 | QFont listFont( mIconList->font() ); | 159 | QFont listFont( mIconList->font() ); |
@@ -156,7 +164,7 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | |||
156 | hbox->addWidget( mIconList ); | 164 | hbox->addWidget( mIconList ); |
157 | connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage())); | 165 | connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage())); |
158 | hbox->addSpacing( KDialog::marginHint() ); | 166 | hbox->addSpacing( KDialog::marginHint() ); |
159 | page = new QFrame( this ); | 167 | page = new Q3Frame( this ); |
160 | hbox->addWidget( page, 10 ); | 168 | hbox->addWidget( page, 10 ); |
161 | } | 169 | } |
162 | 170 | ||
@@ -165,7 +173,7 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | |||
165 | // pagestack using all available space at bottom. | 173 | // pagestack using all available space at bottom. |
166 | // | 174 | // |
167 | 175 | ||
168 | QVBoxLayout *vbox = new QVBoxLayout( page, 0, KDialog::spacingHint() ); | 176 | Q3VBoxLayout *vbox = new Q3VBoxLayout( page, 0, KDialog::spacingHint() ); |
169 | 177 | ||
170 | mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "KJanusWidgetTitleLabel" ); | 178 | mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "KJanusWidgetTitleLabel" ); |
171 | vbox->addWidget( mTitleLabel ); | 179 | vbox->addWidget( mTitleLabel ); |
@@ -175,10 +183,10 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | |||
175 | mTitleLabel->setFont( titleFont ); | 183 | mTitleLabel->setFont( titleFont ); |
176 | 184 | ||
177 | mTitleSep = new KSeparator( page ); | 185 | mTitleSep = new KSeparator( page ); |
178 | mTitleSep->setFrameStyle( QFrame::HLine|QFrame::Plain ); | 186 | mTitleSep->setFrameStyle( Q3Frame::HLine|Q3Frame::Plain ); |
179 | vbox->addWidget( mTitleSep ); | 187 | vbox->addWidget( mTitleSep ); |
180 | 188 | ||
181 | mPageStack = new QWidgetStack( page ); | 189 | mPageStack = new Q3WidgetStack( page ); |
182 | connect(mPageStack, SIGNAL(aboutToShow(QWidget *)), | 190 | connect(mPageStack, SIGNAL(aboutToShow(QWidget *)), |
183 | SIGNAL(aboutToShowPage(QWidget *))); | 191 | SIGNAL(aboutToShowPage(QWidget *))); |
184 | vbox->addWidget( mPageStack, 10 ); | 192 | vbox->addWidget( mPageStack, 10 ); |
@@ -199,7 +207,7 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | |||
199 | else | 207 | else |
200 | { | 208 | { |
201 | mFace = Plain; | 209 | mFace = Plain; |
202 | mPlainPage = new QFrame( this ); | 210 | mPlainPage = new Q3Frame( this ); |
203 | topLayout->addWidget( mPlainPage, 10 ); | 211 | topLayout->addWidget( mPlainPage, 10 ); |
204 | } | 212 | } |
205 | /*US | 213 | /*US |
@@ -245,7 +253,7 @@ bool KJanusWidget::isValid() const | |||
245 | } | 253 | } |
246 | 254 | ||
247 | 255 | ||
248 | QFrame *KJanusWidget::plainPage() | 256 | Q3Frame *KJanusWidget::plainPage() |
249 | { | 257 | { |
250 | return( mPlainPage ); | 258 | return( mPlainPage ); |
251 | } | 259 | } |
@@ -266,7 +274,7 @@ QWidget *KJanusWidget::FindParent() | |||
266 | } | 274 | } |
267 | } | 275 | } |
268 | 276 | ||
269 | QFrame *KJanusWidget::addPage( const QStringList &items, const QString &header, | 277 | Q3Frame *KJanusWidget::addPage( const QStringList &items, const QString &header, |
270 | const QPixmap &pixmap ) | 278 | const QPixmap &pixmap ) |
271 | { | 279 | { |
272 | if( mValid == false ) | 280 | if( mValid == false ) |
@@ -275,7 +283,7 @@ QFrame *KJanusWidget::addPage( const QStringList &items, const QString &header, | |||
275 | return( 0 ); | 283 | return( 0 ); |
276 | } | 284 | } |
277 | 285 | ||
278 | QFrame *page = new QFrame( FindParent(), "page" ); | 286 | Q3Frame *page = new Q3Frame( FindParent(), "page" ); |
279 | addPageWidget( page, items, header, pixmap ); | 287 | addPageWidget( page, items, header, pixmap ); |
280 | 288 | ||
281 | return page; | 289 | return page; |
@@ -287,13 +295,13 @@ void KJanusWidget::pageGone( QObject *obj ) | |||
287 | removePage( static_cast<QWidget*>( obj ) ); | 295 | removePage( static_cast<QWidget*>( obj ) ); |
288 | } | 296 | } |
289 | 297 | ||
290 | void KJanusWidget::slotReopen( QListViewItem * item ) | 298 | void KJanusWidget::slotReopen( Q3ListViewItem * item ) |
291 | { | 299 | { |
292 | if( item ) | 300 | if( item ) |
293 | item->setOpen( true ); | 301 | item->setOpen( true ); |
294 | } | 302 | } |
295 | 303 | ||
296 | QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header, | 304 | Q3Frame *KJanusWidget::addPage( const QString &itemName, const QString &header, |
297 | const QPixmap &pixmap ) | 305 | const QPixmap &pixmap ) |
298 | { | 306 | { |
299 | 307 | ||
@@ -304,7 +312,7 @@ QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header, | |||
304 | 312 | ||
305 | 313 | ||
306 | 314 | ||
307 | QVBox *KJanusWidget::addVBoxPage( const QStringList &items, | 315 | Q3VBox *KJanusWidget::addVBoxPage( const QStringList &items, |
308 | const QString &header, | 316 | const QString &header, |
309 | const QPixmap &pixmap ) | 317 | const QPixmap &pixmap ) |
310 | { | 318 | { |
@@ -315,14 +323,14 @@ QVBox *KJanusWidget::addVBoxPage( const QStringList &items, | |||
315 | return( 0 ); | 323 | return( 0 ); |
316 | } | 324 | } |
317 | 325 | ||
318 | QVBox *page = new QVBox(FindParent() , "vbox_page" ); | 326 | Q3VBox *page = new Q3VBox(FindParent() , "vbox_page" ); |
319 | page->setSpacing( KDialog::spacingHintSmall() ); | 327 | page->setSpacing( KDialog::spacingHintSmall() ); |
320 | addPageWidget( page, items, header, pixmap ); | 328 | addPageWidget( page, items, header, pixmap ); |
321 | 329 | ||
322 | return page; | 330 | return page; |
323 | } | 331 | } |
324 | 332 | ||
325 | QVBox *KJanusWidget::addVBoxPage( const QString &itemName, | 333 | Q3VBox *KJanusWidget::addVBoxPage( const QString &itemName, |
326 | const QString &header, | 334 | const QString &header, |
327 | const QPixmap &pixmap ) | 335 | const QPixmap &pixmap ) |
328 | { | 336 | { |
@@ -331,7 +339,7 @@ QVBox *KJanusWidget::addVBoxPage( const QString &itemName, | |||
331 | return addVBoxPage(items, header, pixmap); | 339 | return addVBoxPage(items, header, pixmap); |
332 | } | 340 | } |
333 | 341 | ||
334 | QHBox *KJanusWidget::addHBoxPage( const QStringList &items, | 342 | Q3HBox *KJanusWidget::addHBoxPage( const QStringList &items, |
335 | const QString &header, | 343 | const QString &header, |
336 | const QPixmap &pixmap ) | 344 | const QPixmap &pixmap ) |
337 | { | 345 | { |
@@ -340,14 +348,14 @@ QHBox *KJanusWidget::addHBoxPage( const QStringList &items, | |||
340 | return( 0 ); | 348 | return( 0 ); |
341 | } | 349 | } |
342 | 350 | ||
343 | QHBox *page = new QHBox(FindParent(), "hbox_page"); | 351 | Q3HBox *page = new Q3HBox(FindParent(), "hbox_page"); |
344 | page->setSpacing( KDialog::spacingHint() ); | 352 | page->setSpacing( KDialog::spacingHint() ); |
345 | addPageWidget( page, items, header, pixmap ); | 353 | addPageWidget( page, items, header, pixmap ); |
346 | 354 | ||
347 | return page; | 355 | return page; |
348 | } | 356 | } |
349 | 357 | ||
350 | QHBox *KJanusWidget::addHBoxPage( const QString &itemName, | 358 | Q3HBox *KJanusWidget::addHBoxPage( const QString &itemName, |
351 | const QString &header, | 359 | const QString &header, |
352 | const QPixmap &pixmap ) | 360 | const QPixmap &pixmap ) |
353 | { | 361 | { |
@@ -356,7 +364,7 @@ QHBox *KJanusWidget::addHBoxPage( const QString &itemName, | |||
356 | return addHBoxPage(items, header, pixmap); | 364 | return addHBoxPage(items, header, pixmap); |
357 | } | 365 | } |
358 | 366 | ||
359 | QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, | 367 | Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir, |
360 | const QStringList &items, | 368 | const QStringList &items, |
361 | const QString &header, | 369 | const QString &header, |
362 | const QPixmap &pixmap ) | 370 | const QPixmap &pixmap ) |
@@ -367,7 +375,7 @@ QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, | |||
367 | return( 0 ); | 375 | return( 0 ); |
368 | } | 376 | } |
369 | 377 | ||
370 | QGrid *page = new QGrid( n, dir, FindParent(), "page" ); | 378 | Q3Grid *page = new Q3Grid( n, dir, FindParent(), "page" ); |
371 | page->setSpacing( KDialog::spacingHint() ); | 379 | page->setSpacing( KDialog::spacingHint() ); |
372 | addPageWidget( page, items, header, pixmap ); | 380 | addPageWidget( page, items, header, pixmap ); |
373 | 381 | ||
@@ -375,7 +383,7 @@ QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, | |||
375 | } | 383 | } |
376 | 384 | ||
377 | 385 | ||
378 | QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, | 386 | Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir, |
379 | const QString &itemName, | 387 | const QString &itemName, |
380 | const QString &header, | 388 | const QString &header, |
381 | const QPixmap &pixmap ) | 389 | const QPixmap &pixmap ) |
@@ -385,10 +393,10 @@ QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, | |||
385 | return addGridPage(n, dir, items, header, pixmap); | 393 | return addGridPage(n, dir, items, header, pixmap); |
386 | } | 394 | } |
387 | 395 | ||
388 | void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page) | 396 | void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page) |
389 | { | 397 | { |
390 | bool isTop = true; | 398 | bool isTop = true; |
391 | QListViewItem *curTop = 0, *child, *last, *newChild; | 399 | Q3ListViewItem *curTop = 0, *child, *last, *newChild; |
392 | unsigned int index = 1; | 400 | unsigned int index = 1; |
393 | QStringList curPath; | 401 | QStringList curPath; |
394 | 402 | ||
@@ -412,9 +420,9 @@ void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &p | |||
412 | // This node didn't have any children at all, lets just insert the | 420 | // This node didn't have any children at all, lets just insert the |
413 | // new child. | 421 | // new child. |
414 | if (isTop) | 422 | if (isTop) |
415 | newChild = new QListViewItem(mTreeList, name); | 423 | newChild = new Q3ListViewItem(mTreeList, name); |
416 | else | 424 | else |
417 | newChild = new QListViewItem(curTop, name); | 425 | newChild = new Q3ListViewItem(curTop, name); |
418 | 426 | ||
419 | } | 427 | } |
420 | else if (child != 0) { | 428 | else if (child != 0) { |
@@ -431,9 +439,9 @@ void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &p | |||
431 | else { | 439 | else { |
432 | // the node had some children, but we didn't find the given name | 440 | // the node had some children, but we didn't find the given name |
433 | if (isTop) | 441 | if (isTop) |
434 | newChild = new QListViewItem(mTreeList, last, name); | 442 | newChild = new Q3ListViewItem(mTreeList, last, name); |
435 | else | 443 | else |
436 | newChild = new QListViewItem(curTop, last, name); | 444 | newChild = new Q3ListViewItem(curTop, last, name); |
437 | } | 445 | } |
438 | 446 | ||
439 | // Now make the element expandable if it is a path component, and make | 447 | // Now make the element expandable if it is a path component, and make |
@@ -459,7 +467,7 @@ void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &p | |||
459 | } | 467 | } |
460 | } | 468 | } |
461 | 469 | ||
462 | void KJanusWidget::addPageWidget( QFrame *page, const QStringList &items, | 470 | void KJanusWidget::addPageWidget( Q3Frame *page, const QStringList &items, |
463 | const QString &header,const QPixmap &pixmap ) | 471 | const QString &header,const QPixmap &pixmap ) |
464 | { | 472 | { |
465 | /*US the following signal causes a segmentation fault while closing the dialog. | 473 | /*US the following signal causes a segmentation fault while closing the dialog. |
@@ -550,15 +558,15 @@ bool KJanusWidget::setSwallowedWidget( QWidget *widget ) | |||
550 | { | 558 | { |
551 | delete mSwallowPage->layout(); | 559 | delete mSwallowPage->layout(); |
552 | } | 560 | } |
553 | QGridLayout *gbox = new QGridLayout( mSwallowPage, 1, 1, 0 ); | 561 | Q3GridLayout *gbox = new Q3GridLayout( mSwallowPage, 1, 1, 0 ); |
554 | 562 | ||
555 | // | 563 | // |
556 | // Hide old children | 564 | // Hide old children |
557 | // | 565 | // |
558 | QObjectList *l = (QObjectList*)mSwallowPage->children(); // silence please | 566 | QObjectList l = mSwallowPage->children(); // silence please |
559 | for( uint i=0; i < l->count(); i++ ) | 567 | for( uint i=0; i < l.count(); i++ ) |
560 | { | 568 | { |
561 | QObject *o = l->at(i); | 569 | QObject *o = l.at(i); |
562 | if( o->isWidgetType() ) | 570 | if( o->isWidgetType() ) |
563 | { | 571 | { |
564 | ((QWidget*)o)->hide(); | 572 | ((QWidget*)o)->hide(); |
@@ -597,7 +605,7 @@ bool KJanusWidget::slotShowPage() | |||
597 | 605 | ||
598 | if( mFace == TreeList ) | 606 | if( mFace == TreeList ) |
599 | { | 607 | { |
600 | QListViewItem *node = mTreeList->selectedItem(); | 608 | Q3ListViewItem *node = mTreeList->selectedItem(); |
601 | if( node == 0 ) { return( false ); } | 609 | if( node == 0 ) { return( false ); } |
602 | 610 | ||
603 | QWidget *stackItem = mTreeListToPageStack[node]; | 611 | QWidget *stackItem = mTreeListToPageStack[node]; |
@@ -606,7 +614,7 @@ bool KJanusWidget::slotShowPage() | |||
606 | } | 614 | } |
607 | else if( mFace == IconList ) | 615 | else if( mFace == IconList ) |
608 | { | 616 | { |
609 | QListBoxItem *node = mIconList->item( mIconList->currentItem() ); | 617 | Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() ); |
610 | if( node == 0 ) { return( false ); } | 618 | if( node == 0 ) { return( false ); } |
611 | QWidget *stackItem = mIconListToPageStack[node]; | 619 | QWidget *stackItem = mIconListToPageStack[node]; |
612 | // Make sure to call through the virtual function showPage(int) | 620 | // Make sure to call through the virtual function showPage(int) |
@@ -646,9 +654,9 @@ bool KJanusWidget::showPage( QWidget *w ) | |||
646 | mTitleLabel->setText( d->mIntToTitle[index] ); | 654 | mTitleLabel->setText( d->mIntToTitle[index] ); |
647 | if( mFace == TreeList ) | 655 | if( mFace == TreeList ) |
648 | { | 656 | { |
649 | QMap<QListViewItem *, QWidget *>::Iterator it; | 657 | QMap<Q3ListViewItem *, QWidget *>::Iterator it; |
650 | for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){ | 658 | for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){ |
651 | QListViewItem *key = it.key(); | 659 | Q3ListViewItem *key = it.key(); |
652 | QWidget *val = it.data(); | 660 | QWidget *val = it.data(); |
653 | if (val == w) { | 661 | if (val == w) { |
654 | mTreeList->setSelected(key, true ); | 662 | mTreeList->setSelected(key, true ); |
@@ -658,9 +666,9 @@ bool KJanusWidget::showPage( QWidget *w ) | |||
658 | } | 666 | } |
659 | else | 667 | else |
660 | { | 668 | { |
661 | QMap<QListBoxItem *, QWidget *>::Iterator it; | 669 | QMap<Q3ListBoxItem *, QWidget *>::Iterator it; |
662 | for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){ | 670 | for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){ |
663 | QListBoxItem *key = it.key(); | 671 | Q3ListBoxItem *key = it.key(); |
664 | QWidget *val = it.data(); | 672 | QWidget *val = it.data(); |
665 | if (val == w) { | 673 | if (val == w) { |
666 | mIconList->setSelected( key, true ); | 674 | mIconList->setSelected( key, true ); |
@@ -686,13 +694,13 @@ bool KJanusWidget::showPage( QWidget *w ) | |||
686 | int KJanusWidget::activePageIndex() const | 694 | int KJanusWidget::activePageIndex() const |
687 | { | 695 | { |
688 | if( mFace == TreeList) { | 696 | if( mFace == TreeList) { |
689 | QListViewItem *node = mTreeList->selectedItem(); | 697 | Q3ListViewItem *node = mTreeList->selectedItem(); |
690 | if( node == 0 ) { return -1; } | 698 | if( node == 0 ) { return -1; } |
691 | QWidget *stackItem = mTreeListToPageStack[node]; | 699 | QWidget *stackItem = mTreeListToPageStack[node]; |
692 | return d->mPageToInt[stackItem]; | 700 | return d->mPageToInt[stackItem]; |
693 | } | 701 | } |
694 | else if (mFace == IconList) { | 702 | else if (mFace == IconList) { |
695 | QListBoxItem *node = mIconList->item( mIconList->currentItem() ); | 703 | Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() ); |
696 | if( node == 0 ) { return( false ); } | 704 | if( node == 0 ) { return( false ); } |
697 | QWidget *stackItem = mIconListToPageStack[node]; | 705 | QWidget *stackItem = mIconListToPageStack[node]; |
698 | return d->mPageToInt[stackItem]; | 706 | return d->mPageToInt[stackItem]; |
@@ -761,7 +769,7 @@ void KJanusWidget::slotFontChanged() | |||
761 | */ | 769 | */ |
762 | 770 | ||
763 | // makes the treelist behave like the list of kcontrol | 771 | // makes the treelist behave like the list of kcontrol |
764 | void KJanusWidget::slotItemClicked(QListViewItem *it) | 772 | void KJanusWidget::slotItemClicked(Q3ListViewItem *it) |
765 | { | 773 | { |
766 | if(it && (it->childCount()>0)) | 774 | if(it && (it->childCount()>0)) |
767 | it->setOpen(!it->isOpen()); | 775 | it->setOpen(!it->isOpen()); |
@@ -895,11 +903,11 @@ void KJanusWidget::unfoldTreeList( bool persist ) | |||
895 | if( mFace == TreeList ) | 903 | if( mFace == TreeList ) |
896 | { | 904 | { |
897 | if( persist ) | 905 | if( persist ) |
898 | connect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); | 906 | connect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) ); |
899 | else | 907 | else |
900 | disconnect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); | 908 | disconnect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) ); |
901 | 909 | ||
902 | for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) | 910 | for( Q3ListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) |
903 | item->setOpen( true ); | 911 | item->setOpen( true ); |
904 | } | 912 | } |
905 | } | 913 | } |
@@ -953,7 +961,7 @@ bool KJanusWidget::eventFilter( QObject *o, QEvent *e ) | |||
953 | 961 | ||
954 | 962 | ||
955 | KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name, | 963 | KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name, |
956 | WFlags f ) | 964 | Qt::WFlags f ) |
957 | :KListBox( parent, name, f ), mShowAll(false), mHeightValid(false), | 965 | :KListBox( parent, name, f ), mShowAll(false), mHeightValid(false), |
958 | mWidthValid(false) | 966 | mWidthValid(false) |
959 | { | 967 | { |
@@ -965,7 +973,7 @@ void KJanusWidget::IconListBox::updateMinimumHeight() | |||
965 | if( mShowAll == true && mHeightValid == false ) | 973 | if( mShowAll == true && mHeightValid == false ) |
966 | { | 974 | { |
967 | int h = frameWidth()*2; | 975 | int h = frameWidth()*2; |
968 | for( QListBoxItem *i = item(0); i != 0; i = i->next() ) | 976 | for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) |
969 | { | 977 | { |
970 | h += i->height( this ); | 978 | h += i->height( this ); |
971 | } | 979 | } |
@@ -980,13 +988,13 @@ void KJanusWidget::IconListBox::updateWidth() | |||
980 | if( mWidthValid == false ) | 988 | if( mWidthValid == false ) |
981 | { | 989 | { |
982 | int maxWidth = 10; | 990 | int maxWidth = 10; |
983 | for( QListBoxItem *i = item(0); i != 0; i = i->next() ) | 991 | for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) |
984 | { | 992 | { |
985 | int w = ((IconListItem *)i)->width(this); | 993 | int w = ((IconListItem *)i)->width(this); |
986 | maxWidth = QMAX( w, maxWidth ); | 994 | maxWidth = QMAX( w, maxWidth ); |
987 | } | 995 | } |
988 | 996 | ||
989 | for( QListBoxItem *i = item(0); i != 0; i = i->next() ) | 997 | for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) |
990 | { | 998 | { |
991 | ((IconListItem *)i)->expandMinimumWidth( maxWidth ); | 999 | ((IconListItem *)i)->expandMinimumWidth( maxWidth ); |
992 | } | 1000 | } |
@@ -1022,9 +1030,9 @@ void KJanusWidget::IconListBox::setShowAll( bool showAll ) | |||
1022 | 1030 | ||
1023 | 1031 | ||
1024 | 1032 | ||
1025 | KJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap, | 1033 | KJanusWidget::IconListItem::IconListItem( Q3ListBox *listbox, const QPixmap &pixmap, |
1026 | const QString &text ) | 1034 | const QString &text ) |
1027 | : QListBoxItem( listbox ) | 1035 | : Q3ListBoxItem( listbox ) |
1028 | { | 1036 | { |
1029 | mPixmap = pixmap; | 1037 | mPixmap = pixmap; |
1030 | if( mPixmap.isNull() == true ) | 1038 | if( mPixmap.isNull() == true ) |
@@ -1083,7 +1091,7 @@ void KJanusWidget::IconListItem::paint( QPainter *painter ) | |||
1083 | } | 1091 | } |
1084 | } | 1092 | } |
1085 | 1093 | ||
1086 | int KJanusWidget::IconListItem::height( const QListBox *lb ) const | 1094 | int KJanusWidget::IconListItem::height( const Q3ListBox *lb ) const |
1087 | { | 1095 | { |
1088 | if( text().isEmpty() == true ) | 1096 | if( text().isEmpty() == true ) |
1089 | { | 1097 | { |
@@ -1096,7 +1104,7 @@ int KJanusWidget::IconListItem::height( const QListBox *lb ) const | |||
1096 | } | 1104 | } |
1097 | 1105 | ||
1098 | 1106 | ||
1099 | int KJanusWidget::IconListItem::width( const QListBox *lb ) const | 1107 | int KJanusWidget::IconListItem::width( const Q3ListBox *lb ) const |
1100 | { | 1108 | { |
1101 | int wt = lb->fontMetrics().boundingRect(text()).width()+10; | 1109 | int wt = lb->fontMetrics().boundingRect(text()).width()+10; |
1102 | int wp = mPixmap.width() + 10; | 1110 | int wp = mPixmap.width() + 10; |
@@ -1122,7 +1130,7 @@ void KJanusWidget::removePage( QWidget *page ) | |||
1122 | 1130 | ||
1123 | if ( mFace == TreeList ) | 1131 | if ( mFace == TreeList ) |
1124 | { | 1132 | { |
1125 | QMap<QListViewItem*, QWidget *>::Iterator i; | 1133 | QMap<Q3ListViewItem*, QWidget *>::Iterator i; |
1126 | for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i ) | 1134 | for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i ) |
1127 | if (i.data()==page) | 1135 | if (i.data()==page) |
1128 | { | 1136 | { |
@@ -1137,7 +1145,7 @@ void KJanusWidget::removePage( QWidget *page ) | |||
1137 | } | 1145 | } |
1138 | else if ( mFace == IconList ) | 1146 | else if ( mFace == IconList ) |
1139 | { | 1147 | { |
1140 | QMap<QListBoxItem*, QWidget *>::Iterator i; | 1148 | QMap<Q3ListBoxItem*, QWidget *>::Iterator i; |
1141 | for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i ) | 1149 | for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i ) |
1142 | if (i.data()==page) | 1150 | if (i.data()==page) |
1143 | { | 1151 | { |