[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: Bug#45992: todo context menu is missing
From: Fredrik Pettersson <freppe () deimos ! nu>
Date: 2002-08-01 14:47:09
[Download RAW message or body]
I got curious about why it didn't work for me, and I think I may have solved
it. Note that this is my first attempt to code in a KDE application, so my
suggestion could be totally wrong, but it works for me. :o)
The very lengthy explanation of my thinking is just so that I myself would
understand it, feel free to skip to the diff I have attached if you wish.
The context menu is supposed to pop up when a rightButtonClicked event is
received in the KOTodoView object. Some minor testing showed me that such an
event only happend when I right click on the blank area, outside the acual
items. I then started to debug the Qt 3.0.5 code, and noticed the following
in the file qlistview.cpp:
The rightButtonClicked events are sent from the function
QListView::contentsMouseReleaseEvent. At the start of that function there is
a test which states that the "clicked" event should only be sent if you (A)
are clicking outside an item, or (B) 'd->buttonDown' is TRUE. The buttonDown
variable was always FALSE when I did my right button clicks, so that was why
the event only was generated when I clicked outside items.
The buttonDown variable is set to FALSE on several occations in the file, but
the case which matters is the one in QListView::contentsContextMenuEvent.
This is where it is set to FALSE every time I try to do a right click. My
simple sollution was to set KOTodoView to listen to the contextMenuRequested
events instead of rightButtonClicked, and it seems to work fine. Those events
are generated in QListView::contentsContextMenuEvent. Note that I do not know
if this event is specific to Qt 3.0.5, or if it is available in Qt3 in
general. In any case, have a look at the diff attached and do as you wish
with it.
//Fredrik Pettersson
["kotodocontext.diff" (text/x-diff)]
Index: kotodoview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/kotodoview.cpp,v
retrieving revision 1.91
diff -u -r1.91 kotodoview.cpp
--- kotodoview.cpp 20 Jul 2002 17:40:33 -0000 1.91
+++ kotodoview.cpp 1 Aug 2002 14:35:03 -0000
@@ -321,7 +321,7 @@
// Double clicking conflicts with opening/closing the subtree
QObject::connect(mTodoListView,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
this,SLOT(editItem(QListViewItem *,const QPoint &,int)));
- QObject::connect(mTodoListView,SIGNAL(rightButtonClicked ( QListViewItem *,
+ QObject::connect(mTodoListView,SIGNAL(contextMenuRequested ( QListViewItem *,
const QPoint &, int )),
this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
QObject::connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
(Complete bug history is available at http://bugs.kde.org/db/45/45992.html)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic