mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Fixed TWK-451: Properly parent the friends auth / add dialog.
This commit is contained in:
@@ -537,93 +537,89 @@ setNam( QNetworkAccessManager* nam )
|
|||||||
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef TOMAHAWK_HEADLESS
|
#ifndef TOMAHAWK_HEADLESS
|
||||||
#if defined(Q_WS_X11)
|
|
||||||
void
|
|
||||||
bringToFront()
|
|
||||||
{
|
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
QWidgetList widgetList = qApp->topLevelWidgets();
|
|
||||||
int i = 0;
|
|
||||||
while( i < widgetList.count() && widgetList.at( i )->objectName() != "TH_Main_Window" )
|
|
||||||
i++;
|
|
||||||
if ( i == widgetList.count() )
|
|
||||||
{
|
|
||||||
qDebug() << Q_FUNC_INFO << " could not find main TH window";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *widget = widgetList.at( i );
|
|
||||||
|
|
||||||
widget->show();
|
QWidget*
|
||||||
widget->activateWindow();
|
tomahawkWindow()
|
||||||
widget->raise();
|
{
|
||||||
|
QWidgetList widgetList = qApp->topLevelWidgets();
|
||||||
|
int i = 0;
|
||||||
|
while( i < widgetList.count() && widgetList.at( i )->objectName() != "TH_Main_Window" )
|
||||||
|
i++;
|
||||||
|
|
||||||
WId wid = widget->winId();
|
if ( i == widgetList.count() )
|
||||||
|
|
||||||
NETWM::init();
|
|
||||||
|
|
||||||
XEvent e;
|
|
||||||
|
|
||||||
e.xclient.type = ClientMessage;
|
|
||||||
e.xclient.message_type = NETWM::NET_ACTIVE_WINDOW;
|
|
||||||
e.xclient.display = QX11Info::display();
|
|
||||||
e.xclient.window = wid;
|
|
||||||
e.xclient.format = 32;
|
|
||||||
e.xclient.data.l[0] = 2;
|
|
||||||
e.xclient.data.l[1] = QX11Info::appTime();
|
|
||||||
e.xclient.data.l[2] = 0;
|
|
||||||
e.xclient.data.l[3] = 0l;
|
|
||||||
e.xclient.data.l[4] = 0l;
|
|
||||||
|
|
||||||
XSendEvent( QX11Info::display(), RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) ), False, SubstructureRedirectMask | SubstructureNotifyMask, &e );
|
|
||||||
}
|
|
||||||
#elif defined(Q_WS_WIN)
|
|
||||||
void
|
|
||||||
bringToFront()
|
|
||||||
{
|
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
QWidgetList widgetList = qApp->topLevelWidgets();
|
|
||||||
int i = 0;
|
|
||||||
while( i < widgetList.count() && widgetList.at( i )->objectName() != "TH_Main_Window" )
|
|
||||||
i++;
|
|
||||||
if ( i == widgetList.count() )
|
|
||||||
{
|
|
||||||
qDebug() << Q_FUNC_INFO << " could not find main TH window";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *widget = widgetList.at( i );
|
|
||||||
|
|
||||||
widget->show();
|
|
||||||
widget->activateWindow();
|
|
||||||
widget->raise();
|
|
||||||
|
|
||||||
WId wid = widget->winId();
|
|
||||||
|
|
||||||
HWND hwndActiveWin = GetForegroundWindow();
|
|
||||||
int idActive = GetWindowThreadProcessId(hwndActiveWin, NULL);
|
|
||||||
if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
|
|
||||||
{
|
|
||||||
SetForegroundWindow( wid );
|
|
||||||
SetFocus( wid );
|
|
||||||
AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
void
|
|
||||||
bringToFront()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
void
|
|
||||||
bringToFront()
|
|
||||||
{
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO << "could not find main Tomahawk mainwindow";
|
||||||
|
Q_ASSERT( false );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *widget = widgetList.at( i );
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
bringToFront()
|
||||||
|
{
|
||||||
|
#if defined(Q_WS_X11)
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
QWidget* widget = tomahawkWindow();
|
||||||
|
if ( !widget )
|
||||||
|
return;
|
||||||
|
|
||||||
|
widget->show();
|
||||||
|
widget->activateWindow();
|
||||||
|
widget->raise();
|
||||||
|
|
||||||
|
WId wid = widget->winId();
|
||||||
|
NETWM::init();
|
||||||
|
|
||||||
|
XEvent e;
|
||||||
|
e.xclient.type = ClientMessage;
|
||||||
|
e.xclient.message_type = NETWM::NET_ACTIVE_WINDOW;
|
||||||
|
e.xclient.display = QX11Info::display();
|
||||||
|
e.xclient.window = wid;
|
||||||
|
e.xclient.format = 32;
|
||||||
|
e.xclient.data.l[0] = 2;
|
||||||
|
e.xclient.data.l[1] = QX11Info::appTime();
|
||||||
|
e.xclient.data.l[2] = 0;
|
||||||
|
e.xclient.data.l[3] = 0l;
|
||||||
|
e.xclient.data.l[4] = 0l;
|
||||||
|
|
||||||
|
XSendEvent( QX11Info::display(), RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) ), False, SubstructureRedirectMask | SubstructureNotifyMask, &e );
|
||||||
|
}
|
||||||
|
#elif defined(Q_WS_WIN)
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
QWidget* widget = tomahawkWindow();
|
||||||
|
if ( !widget )
|
||||||
|
return;
|
||||||
|
|
||||||
|
widget->show();
|
||||||
|
widget->activateWindow();
|
||||||
|
widget->raise();
|
||||||
|
|
||||||
|
WId wid = widget->winId();
|
||||||
|
|
||||||
|
HWND hwndActiveWin = GetForegroundWindow();
|
||||||
|
int idActive = GetWindowThreadProcessId(hwndActiveWin, NULL);
|
||||||
|
if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
|
||||||
|
{
|
||||||
|
SetForegroundWindow( wid );
|
||||||
|
SetFocus( wid );
|
||||||
|
AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
QPixmap
|
QPixmap
|
||||||
createAvatarFrame( const QPixmap &avatar )
|
createAvatarFrame( const QPixmap &avatar )
|
||||||
|
@@ -93,6 +93,7 @@ namespace TomahawkUtils
|
|||||||
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory );
|
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory );
|
||||||
DLLEXPORT void setNam( QNetworkAccessManager* nam );
|
DLLEXPORT void setNam( QNetworkAccessManager* nam );
|
||||||
|
|
||||||
|
DLLEXPORT QWidget* tomahawkWindow();
|
||||||
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
/// 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();
|
DLLEXPORT void bringToFront();
|
||||||
|
|
||||||
|
@@ -20,6 +20,8 @@
|
|||||||
#include "googlewrapper.h"
|
#include "googlewrapper.h"
|
||||||
#include "ui_configwidget.h"
|
#include "ui_configwidget.h"
|
||||||
|
|
||||||
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
|
||||||
@@ -69,9 +71,8 @@ void
|
|||||||
GoogleWrapper::showAddFriendDialog()
|
GoogleWrapper::showAddFriendDialog()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QString id = QInputDialog::getText( 0, tr( "Add Friend" ),
|
QString id = QInputDialog::getText( TomahawkUtils::tomahawkWindow(), tr( "Add Friend" ),
|
||||||
tr( "Enter Google Address:" ), QLineEdit::Normal,
|
tr( "Enter Google Address:" ), QLineEdit::Normal, "", &ok );
|
||||||
"", &ok );
|
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -455,9 +455,8 @@ void
|
|||||||
JabberPlugin::showAddFriendDialog()
|
JabberPlugin::showAddFriendDialog()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QString id = QInputDialog::getText( 0, tr( "Add Friend" ),
|
QString id = QInputDialog::getText( TomahawkUtils::tomahawkWindow(), tr( "Add Friend" ),
|
||||||
tr( "Enter Jabber ID:" ), QLineEdit::Normal,
|
tr( "Enter Jabber ID:" ), QLineEdit::Normal, "", &ok );
|
||||||
"", &ok );
|
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -692,7 +691,7 @@ void JabberPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, co
|
|||||||
tr( "Authorize User" ),
|
tr( "Authorize User" ),
|
||||||
QString( tr( "Do you want to grant <b>%1</b> access to your Collection?" ) ).arg(presence.from().bare()),
|
QString( tr( "Do you want to grant <b>%1</b> access to your Collection?" ) ).arg(presence.from().bare()),
|
||||||
QMessageBox::Yes | QMessageBox::No,
|
QMessageBox::Yes | QMessageBox::No,
|
||||||
0
|
TomahawkUtils::tomahawkWindow()
|
||||||
);
|
);
|
||||||
|
|
||||||
// add confirmBox to m_subscriptionConfirmBoxes
|
// add confirmBox to m_subscriptionConfirmBoxes
|
||||||
|
Reference in New Issue
Block a user