mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Disable "Close window" action when there is only 1 window.
This commit is contained in:
parent
fdaeac186f
commit
434e15d5c7
|
@ -852,9 +852,6 @@ bool MainApplication::restoreStateSlot(QupZilla* window)
|
||||||
|
|
||||||
QupZilla* window = new QupZilla(Qz::BW_OtherRestoredWindow);
|
QupZilla* window = new QupZilla(Qz::BW_OtherRestoredWindow);
|
||||||
m_mainWindows.append(window);
|
m_mainWindows.append(window);
|
||||||
QEventLoop eLoop;
|
|
||||||
connect(window, SIGNAL(startingCompleted()), &eLoop, SLOT(quit()));
|
|
||||||
eLoop.exec();
|
|
||||||
|
|
||||||
window->tabWidget()->restoreState(tabState);
|
window->tabWidget()->restoreState(tabState);
|
||||||
window->restoreState(qMainWindowState);
|
window->restoreState(qMainWindowState);
|
||||||
|
|
|
@ -188,16 +188,6 @@ void QupZilla::postLaunch()
|
||||||
emit startingCompleted();
|
emit startingCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QupZilla::goNext()
|
|
||||||
{
|
|
||||||
weView()->forward();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QupZilla::goBack()
|
|
||||||
{
|
|
||||||
weView()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QupZilla::setupUi()
|
void QupZilla::setupUi()
|
||||||
{
|
{
|
||||||
int locationBarWidth;
|
int locationBarWidth;
|
||||||
|
@ -263,35 +253,6 @@ void QupZilla::setupUi()
|
||||||
statusBar()->insertPermanentWidget(3, m_adblockIcon);
|
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()
|
void QupZilla::setupMenu()
|
||||||
{
|
{
|
||||||
// Standard actions - needed on Mac to be placed correctly in "application" menu
|
// 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-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(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_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_actionCloseWindow->setShortcut(QKeySequence("Ctrl+Shift+W"));
|
||||||
m_menuFile->addSeparator();
|
m_menuFile->addSeparator();
|
||||||
m_menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), this, SLOT(savePage()))->setShortcut(QKeySequence("Ctrl+S"));
|
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)
|
void QupZilla::setWindowTitle(const QString &t)
|
||||||
{
|
{
|
||||||
if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
|
if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
|
||||||
|
@ -1659,6 +1659,13 @@ void QupZilla::disconnectObjects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QupZilla::closeWindow()
|
||||||
|
{
|
||||||
|
if (mApp->windowCount() > 1) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool QupZilla::quitApp()
|
bool QupZilla::quitApp()
|
||||||
{
|
{
|
||||||
if (m_sideBar) {
|
if (m_sideBar) {
|
||||||
|
|
|
@ -203,6 +203,7 @@ private slots:
|
||||||
void startPrivate(bool state);
|
void startPrivate(bool state);
|
||||||
void changeEncoding();
|
void changeEncoding();
|
||||||
|
|
||||||
|
void closeWindow();
|
||||||
bool quitApp();
|
bool quitApp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -154,6 +154,8 @@ void DownloadFileHelper::fileNameChoosed(const QString &name, bool fileNameAutoG
|
||||||
|
|
||||||
if (m_userFileName.isEmpty()) {
|
if (m_userFileName.isEmpty()) {
|
||||||
m_reply->abort();
|
m_reply->abort();
|
||||||
|
m_reply->deleteLater();
|
||||||
|
|
||||||
if (m_timer) {
|
if (m_timer) {
|
||||||
delete m_timer;
|
delete m_timer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,9 +247,10 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
|
||||||
save->setVisible(false);
|
save->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dialog->exec() == QDialog::Accepted) {
|
if (dialog->exec() != QDialog::Accepted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auth->setUser(user->text());
|
auth->setUser(user->text());
|
||||||
auth->setPassword(pass->text());
|
auth->setPassword(pass->text());
|
||||||
|
|
||||||
|
@ -287,9 +288,10 @@ void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthentica
|
||||||
formLa->addRow(passLab, pass);
|
formLa->addRow(passLab, pass);
|
||||||
formLa->addWidget(box);
|
formLa->addWidget(box);
|
||||||
|
|
||||||
if (!dialog->exec() == QDialog::Accepted) {
|
if (dialog->exec() != QDialog::Accepted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auth->setUser(user->text());
|
auth->setUser(user->text());
|
||||||
auth->setPassword(pass->text());
|
auth->setPassword(pass->text());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user