From kde-core-devel Thu Jul 13 01:32:23 2006 From: Jason Harris Date: Thu, 13 Jul 2006 01:32:23 +0000 To: kde-core-devel Subject: [PATCH]: FIx missing connect() in KEditToolbar Message-Id: <200607121832.25043.kstars () 30doradus ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=115275435208273 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_oKatEeqgJXiuN57" --Boundary-00=_oKatEeqgJXiuN57 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, When trying to implement editable toolbars for KStars, I ran into problems. The KEditToolbar window would appear and provide the correct behavior, but the Ok/Apply/Default buttons didn't do anything[1]. After some poking around, I eventually concluded that the problem is that the clicked signals for these buttons aren't actually connected to anything. The slots slotApply(), slotOk() and slotDefault() exist, but are not connected. KEditToolbar was derived from KDialogBase in KDE-3.5, which provided the connect() statements for these buttons. I'm guessing that when KEditToolbar was ported to KDialog, the connects were forgotten. Anyway, I have attached a small patch that adds the connect statements to kedittoolbar.cpp. I understand that this class will likely see huge changes when LiveUI comes, but it's a pretty simple patch, so I thought I'd submit it for consideration anyway. Warning: I am getting an application crash when I close the KEditToolbar window, but I'm not able to track it down. DrKonqi is not giving a useful BT, and when I run it through gdb, it doesn't crash. Here's the DrKonqi BT: Using host libthread_db library "/lib/tls/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread 1105925344 (LWP 14165)] [KCrash handler] #6 0x4075195c in QWidget::testAttribute_helper (this=0xacd6c20, attribute=Qt::WA_WState_Created) at kernel/qwidget.cpp:7236 #7 0x082c5a3b in QWidget::testAttribute (this=0xacd6c20, attribute=Qt::WA_WState_Created) at qwidget.h:900 #8 0x4077b8c0 in QWidget::mapFromGlobal (this=0xacd6c20, pos=@0xbfe7ef38) at kernel/qwidget_x11.cpp:942 #9 0x40763590 in QETWidget::translateMouseEvent (this=0xacd6c20, event=0xbfe7f190) at kernel/qapplication_x11.cpp:3565 #10 0x4076111d in QApplication::x11ProcessEvent (this=0xbfe7fab0, event=0xbfe7f190) at kernel/qapplication_x11.cpp:2732 #11 0x40789f91 in x11EventSourceDispatch (s=0x8e72318, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:120 #12 0x0712b7bb in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #13 0x0712d242 in g_main_context_acquire () from /usr/lib/libglib-2.0.so.0 #14 0x0712d728 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #15 0x40145a15 in QEventDispatcherGlib::processEvents (this=0x8e71008, flags= {i = 20}) at kernel/qeventdispatcher_glib.cpp:344 #16 0x4078a4ab in QGuiEventDispatcherGlib::processEvents (this=0x8e71008, flags={i = 20}) at kernel/qguieventdispatcher_glib.cpp:176 #17 0x4011c0d3 in QEventLoop::processEvents (this=0xbfe7f4a0, flags={i = 20}) at kernel/qeventloop.cpp:124 #18 0x4011c1eb in QEventLoop::exec (this=0xbfe7f4a0, flags={i = 0}) at kernel/qeventloop.cpp:170 #19 0x4011e9fe in QCoreApplication::exec () at kernel/qcoreapplication.cpp:693 #20 0x40708805 in QApplication::exec () at kernel/qapplication.cpp:2877 #21 0x08336360 in main (argc=1, argv=0xbfe7fbb4) at /home/jharris/KDE/kde4svn/kdeedu/kstars/kstars/main.cpp:189 Despite the crash, the modified toolbars are retained when the app gets restarted. Jason [1]: For more details, see my kde-devel thread: http://lists.kde.org/?l=kde-devel&m=115266838112453&w=2 -- ------------------------------- KStars: http://edu.kde.org/kstars Forums: http://kstars.30doradus.org --Boundary-00=_oKatEeqgJXiuN57 Content-Type: text/x-diff; charset="us-ascii"; name="kedittoolbar.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kedittoolbar.patch" Index: kedittoolbar.cpp =================================================================== --- kedittoolbar.cpp (revision 558649) +++ kedittoolbar.cpp (working copy) @@ -395,6 +395,9 @@ connect(m_widget, SIGNAL(enableOk(bool)), SLOT(acceptOK(bool))); connect(m_widget, SIGNAL(enableOk(bool)), SLOT(enableButtonApply(bool))); + connect(this, SIGNAL(applyClicked()), SLOT(slotApply())); + connect(this, SIGNAL(defaultClicked()), SLOT(slotDefault())); + connect(this, SIGNAL(okClicked()), SLOT(slotOk())); enableButtonApply(false); setMinimumSize(sizeHint()); @@ -468,6 +471,9 @@ connect(m_widget, SIGNAL(enableOk(bool)), SLOT(acceptOK(bool))); connect(m_widget, SIGNAL(enableOk(bool)), SLOT(enableButtonApply(bool))); + connect(this, SIGNAL(applyClicked()), SLOT(slotApply())); + connect(this, SIGNAL(defaultClicked()), SLOT(slotDefault())); + connect(this, SIGNAL(okClicked()), SLOT(slotOk())); enableButtonApply(false); emit newToolbarConfig(); --Boundary-00=_oKatEeqgJXiuN57--