[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    patch: ktoolbar and kfiledialog
From:       Simon Hausmann <hausmann () kde ! org>
Date:       2003-09-23 8:39:29
[Download RAW message or body]

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

["ktoolbar_patch.txt" (text/plain)]

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 );

["kfiledialog_patch.txt" (text/plain)]

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;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic