diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 78d252976..b5fbd59f3 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -420,7 +420,8 @@ IF( APPLE ) SET( libSources ${libSources} infosystem/infoplugins/mac/adium.mm - infosystem/infoplugins/mac/adiumplugin.cpp ) + infosystem/infoplugins/mac/adiumplugin.cpp + utils/tomahawkutils_mac.mm ) SET( libHeaders ${libHeaders} infosystem/infoplugins/mac/adium.h @@ -433,6 +434,8 @@ IF( APPLE ) ${COREFOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY} ${SCRIPTINGBRIDGE_LIBRARY} + + /System/Library/Frameworks/AppKit.framework ) ENDIF( APPLE ) diff --git a/src/libtomahawk/utils/tomahawkutils.cpp b/src/libtomahawk/utils/tomahawkutils.cpp index 4a371461c..0e310f6c5 100644 --- a/src/libtomahawk/utils/tomahawkutils.cpp +++ b/src/libtomahawk/utils/tomahawkutils.cpp @@ -460,5 +460,11 @@ setNam( QNetworkAccessManager* nam ) s_nam = QWeakPointer< QNetworkAccessManager >( nam ); } +#ifndef Q_OS_MAC +void +bringToFront() { + +} +#endif } // ns diff --git a/src/libtomahawk/utils/tomahawkutils.h b/src/libtomahawk/utils/tomahawkutils.h index d30658878..f3c1263c1 100644 --- a/src/libtomahawk/utils/tomahawkutils.h +++ b/src/libtomahawk/utils/tomahawkutils.h @@ -80,6 +80,9 @@ namespace TomahawkUtils DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory ); DLLEXPORT void setNam( QNetworkAccessManager* nam ); + + /// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us + DLLEXPORT void bringToFront(); } #endif // TOMAHAWKUTILS_H diff --git a/src/libtomahawk/utils/tomahawkutils_mac.mm b/src/libtomahawk/utils/tomahawkutils_mac.mm new file mode 100644 index 000000000..9a9079147 --- /dev/null +++ b/src/libtomahawk/utils/tomahawkutils_mac.mm @@ -0,0 +1,14 @@ +#include "tomahawkutils.h" + +#import + +namespace TomahawkUtils +{ + +void +bringToFront() { + qDebug() << "foo"; + [NSApp activateIgnoringOtherApps:YES]; +} + +} diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index fe9883838..1b8f3c61d 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -570,7 +570,7 @@ void TomahawkApp::activate() { #ifndef TOMAHAWK_HEADLESS - mainWindow()->show(); + TomahawkUtils::bringToFront(); #endif } @@ -578,6 +578,7 @@ TomahawkApp::activate() bool TomahawkApp::loadUrl( const QString& url ) { + activate(); if ( url.startsWith( "tomahawk://" ) ) return GlobalActionManager::instance()->parseTomahawkLink( url ); else