From kde-core-devel Tue Sep 23 08:39:29 2003 From: Simon Hausmann Date: Tue, 23 Sep 2003 08:39:29 +0000 To: kde-core-devel Subject: patch: ktoolbar and kfiledialog X-MARC-Message: https://marc.info/?l=kde-core-devel&m=106430647430450 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--tThc/1wpZn/ma/RB" --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, in an attempt to get rid of the ugly insertCombo( ..., 33333 ); tb->getCombo( 33333 ) in KFileDialog I ran into a little ktoolbar bug: When inserting an item while not specifying an index, the newly resulting index is calculated wrong. If we append the item in that case, the new index is count() before the actual appending, I believe. Can someone review that patch? The second attachment is the 33333 cleanup. A no-brainer I think, but better reviewed than sorry :) Simon --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ktoolbar_patch.txt" Index: ktoolbar.cpp =================================================================== RCS file: /home/kde/kdelibs/kdeui/ktoolbar.cpp,v retrieving revision 1.365 diff -u -p -b -r1.365 ktoolbar.cpp --- ktoolbar.cpp 13 Sep 2003 11:44:56 -0000 1.365 +++ ktoolbar.cpp 23 Sep 2003 08:36:02 -0000 @@ -1343,8 +1343,8 @@ void KToolBar::insertWidgetInternal( QWi connect( w, SIGNAL( destroyed() ), this, SLOT( widgetDestroyed() ) ); if ( index == -1 || index > (int)widgets.count() ) { - widgets.append( w ); index = (int)widgets.count(); + widgets.append( w ); } else widgets.insert( index, w ); --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kfiledialog_patch.txt" Index: kfiledialog.cpp =================================================================== RCS file: /home/kde/kdelibs/kio/kfile/kfiledialog.cpp,v retrieving revision 1.359 diff -u -p -b -r1.359 kfiledialog.cpp --- kfiledialog.cpp 23 Sep 2003 06:06:07 -0000 1.359 +++ kfiledialog.cpp 23 Sep 2003 08:32:55 -0000 @@ -190,8 +190,9 @@ KFileDialog::KFileDialog(const QString& setOperationMode(Saving); } - toolBar()->insertCombo(QStringList(), 33333, false, 0L, 0L, 0L, true); - d->encoding = toolBar()->getCombo(33333); + KToolBar *tb = toolBar(); + int index = tb->insertCombo(QStringList(), -1 /*id*/, false /*writable*/ ); + d->encoding = tb->getCombo( tb->idAt( index ) ); d->encoding->clear (); QString sEncoding = encoding; --tThc/1wpZn/ma/RB--