mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Fixed restoring of multiple windows
Restoring of multiple windows now won't add additional tab in second and next windows
This commit is contained in:
parent
c3971c2672
commit
575b15db6c
|
@ -154,7 +154,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
|
|||
translateApp();
|
||||
QWebHistoryInterface::setDefaultInterface(new WebHistoryInterface(this));
|
||||
|
||||
QupZilla* qupzilla = new QupZilla(true, startUrl);
|
||||
QupZilla* qupzilla = new QupZilla(QupZilla::FirstAppWindow, startUrl);
|
||||
m_mainWindows.append(qupzilla);
|
||||
connect(qupzilla, SIGNAL(message(MainApplication::MessageType,bool)), this, SLOT(sendMessages(MainApplication::MessageType,bool)));
|
||||
qupzilla->show();
|
||||
|
@ -350,7 +350,13 @@ void MainApplication::addNewTab(const QUrl &url)
|
|||
|
||||
void MainApplication::makeNewWindow(bool tryRestore, const QUrl &startUrl)
|
||||
{
|
||||
QupZilla* newWindow = new QupZilla(tryRestore, startUrl);
|
||||
QupZilla::StartBehaviour behaviour;
|
||||
if (tryRestore)
|
||||
behaviour = QupZilla::OtherRestoredWindow;
|
||||
else
|
||||
behaviour = QupZilla::NewWindow;
|
||||
|
||||
QupZilla* newWindow = new QupZilla(behaviour, startUrl);
|
||||
connect(newWindow, SIGNAL(message(MainApplication::MessageType,bool)), this, SLOT(sendMessages(MainApplication::MessageType,bool)));
|
||||
m_mainWindows.append(newWindow);
|
||||
newWindow->show();
|
||||
|
@ -623,7 +629,7 @@ bool MainApplication::restoreStateSlot(QupZilla* window)
|
|||
stream >> tabState;
|
||||
stream >> qMainWindowState;
|
||||
|
||||
QupZilla* window = new QupZilla(false);
|
||||
QupZilla* window = new QupZilla(QupZilla::OtherRestoredWindow);
|
||||
m_mainWindows.append(window);
|
||||
connect(window, SIGNAL(message(MainApplication::MessageType,bool)), this, SLOT(sendMessages(MainApplication::MessageType,bool)));
|
||||
QEventLoop eLoop;
|
||||
|
|
|
@ -81,13 +81,13 @@ const QIcon QupZilla::qupzillaIcon()
|
|||
return i;
|
||||
}
|
||||
|
||||
QupZilla::QupZilla(bool tryRestore, QUrl startUrl)
|
||||
QupZilla::QupZilla(StartBehaviour behaviour, QUrl startUrl)
|
||||
: QMainWindow(0)
|
||||
, m_tryRestore(tryRestore)
|
||||
, m_historyMenuChanged(true)
|
||||
, m_bookmarksMenuChanged(true)
|
||||
, m_isClosing(false)
|
||||
, m_startingUrl(startUrl)
|
||||
, m_startBehaviour(behaviour)
|
||||
, m_actionPrivateBrowsing(0)
|
||||
, m_webInspectorDock(0)
|
||||
, m_sideBar(0)
|
||||
|
@ -136,7 +136,8 @@ void QupZilla::postLaunch()
|
|||
settings.endGroup();
|
||||
|
||||
QUrl startUrl;
|
||||
if (m_tryRestore) {
|
||||
switch (m_startBehaviour) {
|
||||
case FirstAppWindow:
|
||||
if (afterLaunch == 0)
|
||||
startUrl = QUrl("");
|
||||
else if (afterLaunch == 1)
|
||||
|
@ -146,8 +147,23 @@ void QupZilla::postLaunch()
|
|||
|
||||
if ( startingAfterCrash || (addTab && afterLaunch == 2) )
|
||||
addTab = !mApp->restoreStateSlot(this);
|
||||
} else
|
||||
startUrl = m_homepage;
|
||||
break;
|
||||
|
||||
case NewWindow:
|
||||
if (afterLaunch == 0)
|
||||
startUrl = QUrl("");
|
||||
else if (afterLaunch == 1)
|
||||
startUrl = m_homepage;
|
||||
else
|
||||
startUrl = m_homepage;
|
||||
|
||||
addTab = true;
|
||||
break;
|
||||
|
||||
case OtherRestoredWindow:
|
||||
addTab = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_startingUrl.isEmpty()) {
|
||||
startUrl = WebView::guessUrlFromString(m_startingUrl.toString());
|
||||
|
|
|
@ -79,7 +79,8 @@ public:
|
|||
|
||||
static const QIcon qupzillaIcon();
|
||||
|
||||
explicit QupZilla(bool m_tryRestore=true, QUrl startUrl=QUrl());
|
||||
enum StartBehaviour { FirstAppWindow, OtherRestoredWindow, NewWindow };
|
||||
explicit QupZilla(StartBehaviour behaviour = FirstAppWindow, QUrl startUrl = QUrl());
|
||||
~QupZilla();
|
||||
|
||||
void refreshAddressBar();
|
||||
|
@ -195,13 +196,13 @@ private:
|
|||
|
||||
void addSideBar();
|
||||
|
||||
bool m_tryRestore;
|
||||
bool m_historyMenuChanged;
|
||||
bool m_bookmarksMenuChanged;
|
||||
bool m_isClosing;
|
||||
QUrl m_startingUrl;
|
||||
QUrl m_newtab;
|
||||
QUrl m_homepage;
|
||||
StartBehaviour m_startBehaviour;
|
||||
|
||||
QVBoxLayout* m_mainLayout;
|
||||
QSplitter* m_mainSplitter;
|
||||
|
|
Loading…
Reference in New Issue
Block a user