mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
MainApplication: The getWindow() try to return the current active or last activated window
This commit is contained in:
parent
598ad6f13c
commit
8a7af28165
@ -96,6 +96,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||||||
, m_desktopNotifications(0)
|
, m_desktopNotifications(0)
|
||||||
, m_autoSaver(0)
|
, m_autoSaver(0)
|
||||||
, m_proxyStyle(0)
|
, m_proxyStyle(0)
|
||||||
|
, m_lastActiveWindow(0)
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
||||||
, m_registerQAppAssociation(0)
|
, m_registerQAppAssociation(0)
|
||||||
#endif
|
#endif
|
||||||
@ -266,6 +267,8 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||||||
BrowserWindow* window = createWindow(Qz::BW_FirstAppWindow, startUrl);
|
BrowserWindow* window = createWindow(Qz::BW_FirstAppWindow, startUrl);
|
||||||
connect(window, SIGNAL(startingCompleted()), this, SLOT(restoreOverrideCursor()));
|
connect(window, SIGNAL(startingCompleted()), this, SLOT(restoreOverrideCursor()));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(focusChanged(QWidget*,QWidget*)), this, SLOT(onFocusChanged()));
|
||||||
|
|
||||||
|
|
||||||
if (!isPrivate()) {
|
if (!isPrivate()) {
|
||||||
Settings settings;
|
Settings settings;
|
||||||
@ -350,10 +353,8 @@ QList<BrowserWindow*> MainApplication::windows() const
|
|||||||
|
|
||||||
BrowserWindow* MainApplication::getWindow() const
|
BrowserWindow* MainApplication::getWindow() const
|
||||||
{
|
{
|
||||||
BrowserWindow* activeW = qobject_cast<BrowserWindow*>(activeWindow());
|
if (m_lastActiveWindow) {
|
||||||
|
return m_lastActiveWindow;
|
||||||
if (activeW) {
|
|
||||||
return activeW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_windows.isEmpty() ? 0 : m_windows.first();
|
return m_windows.isEmpty() ? 0 : m_windows.first();
|
||||||
@ -836,6 +837,15 @@ void MainApplication::windowDestroyed(QObject* window)
|
|||||||
m_windows.removeOne(static_cast<BrowserWindow*>(window));
|
m_windows.removeOne(static_cast<BrowserWindow*>(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainApplication::onFocusChanged()
|
||||||
|
{
|
||||||
|
BrowserWindow* activeBrowserWindow = qobject_cast<BrowserWindow*>(activeWindow());
|
||||||
|
|
||||||
|
if (activeBrowserWindow) {
|
||||||
|
m_lastActiveWindow = activeBrowserWindow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainApplication::loadSettings()
|
void MainApplication::loadSettings()
|
||||||
{
|
{
|
||||||
Settings settings;
|
Settings settings;
|
||||||
|
@ -123,6 +123,7 @@ private slots:
|
|||||||
|
|
||||||
void messageReceived(const QString &message);
|
void messageReceived(const QString &message);
|
||||||
void windowDestroyed(QObject* window);
|
void windowDestroyed(QObject* window);
|
||||||
|
void onFocusChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum PostLaunchAction {
|
enum PostLaunchAction {
|
||||||
@ -168,6 +169,8 @@ private:
|
|||||||
ProxyStyle* m_proxyStyle;
|
ProxyStyle* m_proxyStyle;
|
||||||
|
|
||||||
QList<BrowserWindow*> m_windows;
|
QList<BrowserWindow*> m_windows;
|
||||||
|
BrowserWindow* m_lastActiveWindow;
|
||||||
|
|
||||||
QList<PostLaunchAction> m_postLaunchActions;
|
QList<PostLaunchAction> m_postLaunchActions;
|
||||||
|
|
||||||
QString m_languageFile;
|
QString m_languageFile;
|
||||||
|
Loading…
Reference in New Issue
Block a user