From 2a5340bd4c758a1e61c10aaaf5ebed725243a151 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Tue, 25 May 2010 18:15:30 +0100
Subject: Display the status changer on the right screen.

Resolves: #365

diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp
index 6281b52..4801ff9 100644
--- a/Swift/QtUI/QtStatusWidget.cpp
+++ b/Swift/QtUI/QtStatusWidget.cpp
@@ -133,13 +133,16 @@ void QtStatusWidget::generateList() {
 
 void QtStatusWidget::handleClicked() {
 	editing_ = true;
+	QDesktopWidget* desktop = QApplication::desktop();
+	int screen = desktop->screenNumber(this);
 	QPoint point = mapToGlobal(QPoint(0, height()));
+	QRect geometry = desktop->availableGeometry(screen);
 	int x = point.x();
 	int y = point.y();
 	int width = 200;
 	int height = 80;
-	int desktop = QApplication::desktop()->screenNumber(this);
-	int screenWidth = QApplication::desktop()->screenGeometry(desktop).width();
+
+	int screenWidth = geometry.x() + geometry.width();
 	if (x + width > screenWidth) {
 		x = screenWidth - width;
 	}
@@ -147,15 +150,14 @@ void QtStatusWidget::handleClicked() {
 
 	height = menu_->sizeHintForRow(0) * menu_->count();
 	menu_->setGeometry(x, y, width, height);
+	menu_->move(x, y);
 	menu_->setMaximumWidth(width);
-
-
 	menu_->show();
 	activateWindow();
 	statusEdit_->selectAll();
 	stack_->setCurrentIndex(1);
 	statusEdit_->setFocus();
-	connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(handleApplicationFocusChanged(QWidget*, QWidget*)), Qt/*::ConnectionType*/::QueuedConnection);
+	connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(handleApplicationFocusChanged(QWidget*, QWidget*)), Qt::QueuedConnection);
 }
 
 void QtStatusWidget::viewMode() {
-- 
cgit v0.10.2-6-g49f6