mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +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_autoSaver(0)
|
||||
, m_proxyStyle(0)
|
||||
, m_lastActiveWindow(0)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
||||
, m_registerQAppAssociation(0)
|
||||
#endif
|
||||
@ -266,6 +267,8 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
BrowserWindow* window = createWindow(Qz::BW_FirstAppWindow, startUrl);
|
||||
connect(window, SIGNAL(startingCompleted()), this, SLOT(restoreOverrideCursor()));
|
||||
|
||||
connect(this, SIGNAL(focusChanged(QWidget*,QWidget*)), this, SLOT(onFocusChanged()));
|
||||
|
||||
|
||||
if (!isPrivate()) {
|
||||
Settings settings;
|
||||
@ -350,10 +353,8 @@ QList<BrowserWindow*> MainApplication::windows() const
|
||||
|
||||
BrowserWindow* MainApplication::getWindow() const
|
||||
{
|
||||
BrowserWindow* activeW = qobject_cast<BrowserWindow*>(activeWindow());
|
||||
|
||||
if (activeW) {
|
||||
return activeW;
|
||||
if (m_lastActiveWindow) {
|
||||
return m_lastActiveWindow;
|
||||
}
|
||||
|
||||
return m_windows.isEmpty() ? 0 : m_windows.first();
|
||||
@ -836,6 +837,15 @@ void MainApplication::windowDestroyed(QObject* 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()
|
||||
{
|
||||
Settings settings;
|
||||
|
@ -123,6 +123,7 @@ private slots:
|
||||
|
||||
void messageReceived(const QString &message);
|
||||
void windowDestroyed(QObject* window);
|
||||
void onFocusChanged();
|
||||
|
||||
private:
|
||||
enum PostLaunchAction {
|
||||
@ -168,6 +169,8 @@ private:
|
||||
ProxyStyle* m_proxyStyle;
|
||||
|
||||
QList<BrowserWindow*> m_windows;
|
||||
BrowserWindow* m_lastActiveWindow;
|
||||
|
||||
QList<PostLaunchAction> m_postLaunchActions;
|
||||
|
||||
QString m_languageFile;
|
||||
|
Loading…
Reference in New Issue
Block a user