From 54351d4b9d8d3580c4f60306c3e1dfcba304777b Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Wed, 1 Oct 2014 13:36:27 +0200
Subject: Explain the use of preffered stars in 'Edit Profile' dialog if they
 are checked.

Test-Information:
Verified this works by running Swift and editing a profile.

Change-Id: I965ef374ceed2ba5b3225070931b6c06e3b9e800

diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
index 74d9c59..155bd4f 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
@@ -15,6 +15,7 @@
 #include <cassert>
 
 #include <QHBoxLayout>
+#include <QToolTip>
 
 namespace Swift {
 
@@ -38,6 +39,7 @@ void QtVCardGeneralField::initialize() {
 			);
 		layout->addWidget(preferredCheckBox, row, 0, Qt::AlignVCenter);
 		childWidgets << preferredCheckBox;
+		connect(preferredCheckBox, SIGNAL(stateChanged(int)), SLOT(handlePreferredStarStateChanged(int)));
 	}
 	label = new QLabel(this);
 	label->setText(labelText);
@@ -124,6 +126,12 @@ void QtVCardGeneralField::handleCloseButtonClicked() {
 	deleteField(this);
 }
 
+void QtVCardGeneralField::handlePreferredStarStateChanged(int state) {
+	if (state == Qt::Checked) {
+		QToolTip::showText(QCursor::pos(), tr("Marked as your preferred %1. Click again to undo.").arg(labelText));
+	}
+}
+
 void QtVCardGeneralField::updatePreferredStarVisibility() {
 	if (preferredCheckBox) {
 		bool showStar = false;
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h
index 93d326b..4f4cccd 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h
@@ -65,6 +65,7 @@ class QtVCardGeneralField : public QWidget {
 		
 	public slots:
 		void handleCloseButtonClicked();
+		void handlePreferredStarStateChanged(int statte);
 
 	protected:
 		QList<QWidget*> childWidgets;
-- 
cgit v0.10.2-6-g49f6