[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:07:44 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=581a107
The following commit has been merged in the master branch:
commit 581a107d794db5e23c0afb9642dd3ed86af6cf13
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Tue Sep 27 18:29:06 2011 +0200
Enable click-to-edit for setting presence messages
---
global-presence-chooser.cpp | 23 +++++++++++++++++++----
global-presence-chooser.h | 10 +++++++---
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/global-presence-chooser.cpp b/global-presence-chooser.cpp
index 125e625..4801c62 100644
--- a/global-presence-chooser.cpp
+++ b/global-presence-chooser.cpp
@@ -7,14 +7,14 @@
#include <KLineEdit>
#include <TelepathyQt4/Presence>
+#include <QMouseEvent>
GlobalPresenceChooser::GlobalPresenceChooser(QWidget *parent) :
KComboBox(parent),
m_globalPresence(new GlobalPresence(this))
{
- setEditable(true);
setInsertPolicy(NoInsert);
-// setTrapReturnKey(true);
+ setTrapReturnKey(true);
addItem(KIcon("user-online"), i18n("Available"), qVariantFromValue(Tp::Presence::available()));
addItem(KIcon("user-away"), i18n("Away"), qVariantFromValue(Tp::Presence::away()));
addItem(KIcon("user-away"), i18n("Be Right Back"), qVariantFromValue(Tp::Presence::brb()));
@@ -41,6 +41,9 @@ void GlobalPresenceChooser::onCurrentIndexChanged(int index)
{
Tp::Presence presence = itemData(index).value<Tp::Presence>();
m_globalPresence->setPresence(presence);
+ setEditable(true);
+ lineEdit()->selectAll();
+ lineEdit()->setFocus();
}
void GlobalPresenceChooser::onPresenceChanged(const Tp::Presence &presence)
@@ -59,12 +62,10 @@ void GlobalPresenceChooser::onPresenceChanged(const Tp::Presence &presence)
// void GlobalPresenceChooser::enterEvent(QEvent* event)
// {
-// setEditable(true);
// }
//
// void GlobalPresenceChooser::leaveEvent(QEvent* event)
// {
-// setEditable(false);
// }
void GlobalPresenceChooser::onPresenceMessageChanged(const QString &message)
@@ -92,3 +93,17 @@ void GlobalPresenceChooser::onPresenceMessageChanged(const QString &message)
insertItem(currentPresenceIndex, itemIcon(currentIndex()), message, qVariantFromValue(presence));
}
}
+
+void GlobalPresenceChooser::mousePressEvent(QMouseEvent *event)
+{
+ if (!isEditable()) {
+ setEditable(true);
+ }
+
+ KComboBox::mousePressEvent(event);
+}
+
+void GlobalPresenceChooser::focusOutEvent(QFocusEvent* event)
+{
+ setEditable(false);
+}
diff --git a/global-presence-chooser.h b/global-presence-chooser.h
index d998682..68be80c 100644
--- a/global-presence-chooser.h
+++ b/global-presence-chooser.h
@@ -5,6 +5,8 @@
#include <TelepathyQt4/AccountManager>
+class QFocusEvent;
+class QMouseEvent;
class GlobalPresence;
class GlobalPresenceChooser : public KComboBox
@@ -14,9 +16,11 @@ public:
explicit GlobalPresenceChooser(QWidget *parent = 0);
void setAccountManager(const Tp::AccountManagerPtr &accountManager);
-// protected:
-// void enterEvent(QEvent *event);
-// void leaveEvent(QEvent *event);
+protected:
+ void enterEvent(QEvent *event);
+ void leaveEvent(QEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void focusOutEvent(QFocusEvent *event);
private slots:
void onCurrentIndexChanged(int index);
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list