From 27cde20dbf669306a1b790cab8bf0f27ae6eb164 Mon Sep 17 00:00:00 2001
From: Leo Franchi <lfranchi@kde.org>
Date: Mon, 20 Feb 2012 23:06:49 -0500
Subject: [PATCH] Fix Add Account button in factory config on OSX, and a few
 other osx tweaks

---
 src/AccountFactoryWrapper.cpp            | 1 -
 src/libtomahawk/accounts/LastFmConfig.ui | 5 ++++-
 src/settingsdialog.cpp                   | 7 +++++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/AccountFactoryWrapper.cpp b/src/AccountFactoryWrapper.cpp
index 0bf60f634..f5f270b06 100644
--- a/src/AccountFactoryWrapper.cpp
+++ b/src/AccountFactoryWrapper.cpp
@@ -141,7 +141,6 @@ AccountFactoryWrapper::buttonClicked( QAbstractButton* button )
     {
         m_createAccount = true;
         emit createAccount( m_factory );
-//         accept();
         return;
     }
     else
diff --git a/src/libtomahawk/accounts/LastFmConfig.ui b/src/libtomahawk/accounts/LastFmConfig.ui
index c0a0ece12..5cdf0e5e8 100644
--- a/src/libtomahawk/accounts/LastFmConfig.ui
+++ b/src/libtomahawk/accounts/LastFmConfig.ui
@@ -7,13 +7,16 @@
     <x>0</x>
     <y>0</y>
     <width>400</width>
-    <height>178</height>
+    <height>220</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="margin">
+    <number>4</number>
+   </property>
    <item>
     <widget class="QLabel" name="label">
      <property name="text">
diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp
index bcd2c997b..ddd954efa 100644
--- a/src/settingsdialog.cpp
+++ b/src/settingsdialog.cpp
@@ -437,6 +437,13 @@ SettingsDialog::openAccountFactoryConfig( AccountFactory* factory )
 void
 SettingsDialog::createAccountFromFactory( AccountFactory* factory )
 {
+#ifdef Q_WS_MAC
+    // On mac we need to close the dialog we came from before showing another dialog
+    Q_ASSERT( sender() && qobject_cast< AccountFactoryWrapper* >( sender() ) );
+    AccountFactoryWrapper* dialog = qobject_cast< AccountFactoryWrapper* >( sender() );
+    dialog->accept();
+#endif
+
     //if exited with OK, create it, if not, delete it immediately!
     Account* account = factory->createAccount();
     bool added = false;