1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Disable "Close window" action when there is only 1 window.

This commit is contained in:
nowrep 2012-02-01 17:01:08 +01:00
parent fdaeac186f
commit 434e15d5c7
5 changed files with 54 additions and 45 deletions

View File

@ -852,9 +852,6 @@ bool MainApplication::restoreStateSlot(QupZilla* window)
QupZilla* window = new QupZilla(Qz::BW_OtherRestoredWindow);
m_mainWindows.append(window);
QEventLoop eLoop;
connect(window, SIGNAL(startingCompleted()), &eLoop, SLOT(quit()));
eLoop.exec();
window->tabWidget()->restoreState(tabState);
window->restoreState(qMainWindowState);

View File

@ -188,16 +188,6 @@ void QupZilla::postLaunch()
emit startingCompleted();
}
void QupZilla::goNext()
{
weView()->forward();
}
void QupZilla::goBack()
{
weView()->back();
}
void QupZilla::setupUi()
{
int locationBarWidth;
@ -263,35 +253,6 @@ void QupZilla::setupUi()
statusBar()->insertPermanentWidget(3, m_adblockIcon);
}
QMenuBar* QupZilla::menuBar() const
{
#ifdef Q_WS_MAC
return m_macMenuBar;
#else
return QMainWindow::menuBar();
#endif
}
TabbedWebView* QupZilla::weView() const
{
return weView(m_tabWidget->currentIndex());
}
TabbedWebView* QupZilla::weView(int index) const
{
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
if (!webTab) {
return 0;
}
return webTab->view();
}
LocationBar* QupZilla::locationBar() const
{
return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget());
}
void QupZilla::setupMenu()
{
// Standard actions - needed on Mac to be placed correctly in "application" menu
@ -318,7 +279,7 @@ void QupZilla::setupMenu()
m_menuFile->addAction(QIcon::fromTheme("document-open-remote"), tr("Open Location"), this, SLOT(openLocation()))->setShortcut(QKeySequence("Ctrl+L"));
m_menuFile->addAction(QIcon::fromTheme("document-open"), tr("Open &File"), this, SLOT(openFile()))->setShortcut(QKeySequence("Ctrl+O"));
m_menuFile->addAction(tr("Close Tab"), m_tabWidget, SLOT(closeTab()))->setShortcut(QKeySequence("Ctrl+W"));
m_actionCloseWindow = m_menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close Window"), this, SLOT(close()));
m_actionCloseWindow = m_menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close Window"), this, SLOT(closeWindow()));
m_actionCloseWindow->setShortcut(QKeySequence("Ctrl+Shift+W"));
m_menuFile->addSeparator();
m_menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), this, SLOT(savePage()))->setShortcut(QKeySequence("Ctrl+S"));
@ -649,6 +610,45 @@ void QupZilla::loadSettings()
}
}
void QupZilla::goNext()
{
weView()->forward();
}
void QupZilla::goBack()
{
weView()->back();
}
QMenuBar* QupZilla::menuBar() const
{
#ifdef Q_WS_MAC
return m_macMenuBar;
#else
return QMainWindow::menuBar();
#endif
}
TabbedWebView* QupZilla::weView() const
{
return weView(m_tabWidget->currentIndex());
}
TabbedWebView* QupZilla::weView(int index) const
{
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
if (!webTab) {
return 0;
}
return webTab->view();
}
LocationBar* QupZilla::locationBar() const
{
return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget());
}
void QupZilla::setWindowTitle(const QString &t)
{
if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
@ -1659,6 +1659,13 @@ void QupZilla::disconnectObjects()
}
}
void QupZilla::closeWindow()
{
if (mApp->windowCount() > 1) {
close();
}
}
bool QupZilla::quitApp()
{
if (m_sideBar) {

View File

@ -203,6 +203,7 @@ private slots:
void startPrivate(bool state);
void changeEncoding();
void closeWindow();
bool quitApp();
private:

View File

@ -154,6 +154,8 @@ void DownloadFileHelper::fileNameChoosed(const QString &name, bool fileNameAutoG
if (m_userFileName.isEmpty()) {
m_reply->abort();
m_reply->deleteLater();
if (m_timer) {
delete m_timer;
}

View File

@ -247,9 +247,10 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
save->setVisible(false);
}
if (!dialog->exec() == QDialog::Accepted) {
if (dialog->exec() != QDialog::Accepted) {
return;
}
auth->setUser(user->text());
auth->setPassword(pass->text());
@ -287,9 +288,10 @@ void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthentica
formLa->addRow(passLab, pass);
formLa->addWidget(box);
if (!dialog->exec() == QDialog::Accepted) {
if (dialog->exec() != QDialog::Accepted) {
return;
}
auth->setUser(user->text());
auth->setPassword(pass->text());
}