[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:10:46 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=9553c2d
The following commit has been merged in the master branch:
commit 9553c2d1178a90b8eeb4580824d3d974b7bb9daa
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Wed Jun 13 20:39:25 2012 +0200
Fix crash with context menu on lineedit
Now we get the menu from lineEdit() and handle it ourselves, so we can properly check if it's shown or hidden in FocusOut event.
Reviewed-by: David Edmundson
BUG: 301823
FIXED-IN: 0.4.1
---
global-presence-chooser.cpp | 25 +++++++++++++++++++++++--
global-presence-chooser.h | 2 ++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/global-presence-chooser.cpp b/global-presence-chooser.cpp
index c1def78..6729f51 100644
--- a/global-presence-chooser.cpp
+++ b/global-presence-chooser.cpp
@@ -42,6 +42,7 @@
#include <QtGui/QToolTip>
#include <QStyle>
#include <QtGui/QPushButton>
+#include <QMenu>
//A sneaky class that adds an extra entry to the end of the presence model
//called "Configure Presences"
@@ -234,6 +235,16 @@ bool GlobalPresenceChooser::event(QEvent *e)
repositionOverlays();
}
+ if (e->type() == QEvent::ContextMenu) {
+ QMouseEvent *me = static_cast<QMouseEvent*>(e);
+ if (isEditable()) {
+ //we need to correctly position the menu, otherwise it just appears at (0;0)
+ m_lineEditContextMenu.data()->exec(me->globalPos());
+
+ return true;
+ }
+ }
+
if (e->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
@@ -253,13 +264,21 @@ bool GlobalPresenceChooser::event(QEvent *e)
if (e->type() == QEvent::FocusOut) {
//just cancel editable and let it exec parent event()
+ if (!m_lineEditContextMenu.isNull()) {
+ if (!m_lineEditContextMenu.data()->isHidden()) {
+ //if we're showing the context menu, do not process this event further
+ return true;
+ }
+ //...otherwise delete the menu and hide the lineedit
+ m_lineEditContextMenu.data()->deleteLater();
+ }
if (isEditable()) {
setEditable(false);
m_changePresenceMessageButton->show();
}
}
- return QComboBox::event(e); // krazy:exclude=qclasses
+ return KComboBox::event(e); // krazy:exclude=qclasses
}
void GlobalPresenceChooser::onCurrentIndexChanged(int index)
@@ -370,6 +389,9 @@ void GlobalPresenceChooser::onChangePresenceMessageClicked()
if (m_globalPresence->currentPresence().statusMessage().isEmpty()) {
lineEdit()->clear();
}
+
+ m_lineEditContextMenu = lineEdit()->createStandardContextMenu();
+
lineEdit()->setFocus();
}
@@ -381,7 +403,6 @@ void GlobalPresenceChooser::onConfirmPresenceMessageClicked()
presence.setStatus(presence.type(), presence.status(), lineEdit()->text());
QModelIndex newPresence = m_model->addPresence(presence); //m_model->addPresence(presence);
setEditable(false);
- kDebug() << newPresence.row();
setCurrentIndex(newPresence.row());
//this is needed because currentIndexChanged signal is not connected and that is to not crash contact list
//because this signal is emitted once there is a valid model and that happens before AccountManager is ready
diff --git a/global-presence-chooser.h b/global-presence-chooser.h
index ce96cdf..d7a19c4 100644
--- a/global-presence-chooser.h
+++ b/global-presence-chooser.h
@@ -26,6 +26,7 @@
#include <TelepathyQt/AccountManager>
#include <KTp/presence.h>
+class QMenu;
class QPushButton;
class KPixmapSequenceOverlayPainter;
class PresenceModel;
@@ -62,6 +63,7 @@ private:
KPixmapSequenceOverlayPainter *m_busyOverlay;
Tp::AccountManagerPtr m_accountManager;
QPushButton *m_changePresenceMessageButton;
+ QWeakPointer<QMenu> m_lineEditContextMenu;
};
#endif // GLOBALPRESENCECHOOSER_H
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list