mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Enabling/disabling close window action in file menu. Closes #64
- enabled only when there is more than one main window
This commit is contained in:
parent
66fe20a8ff
commit
a6874eeed9
@ -280,7 +280,8 @@ void QupZilla::setupMenu()
|
||||
m_menuFile->addAction(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_menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close Window"), this, SLOT(close()))->setShortcut(QKeySequence("Ctrl+Shift+W"));
|
||||
m_actionCloseWindow = m_menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close Window"), this, SLOT(close()));
|
||||
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"));
|
||||
m_menuFile->addAction(tr("Save Page Screen"), this, SLOT(savePageScreen()));
|
||||
@ -291,6 +292,8 @@ void QupZilla::setupMenu()
|
||||
m_menuFile->addAction(tr("Import bookmarks..."), this, SLOT(showBookmarkImport()));
|
||||
m_menuFile->addAction(QIcon::fromTheme("application-exit"), tr("Quit"), this, SLOT(quitApp()))->setShortcut(QKeySequence("Ctrl+Q"));
|
||||
menuBar()->addMenu(m_menuFile);
|
||||
connect(m_menuFile, SIGNAL(aboutToShow()), this, SLOT(aboutToShowFileMenu()));
|
||||
connect(m_menuFile, SIGNAL(aboutToHide()), this, SLOT(aboutToHideFileMenu()));
|
||||
|
||||
m_menuEdit = new QMenu(tr("&Edit"));
|
||||
m_menuEdit->addAction(QIcon::fromTheme("edit-undo"), tr("&Undo"))->setShortcut(QKeySequence("Ctrl+Z"));
|
||||
@ -308,9 +311,9 @@ void QupZilla::setupMenu()
|
||||
m_menuEdit->addAction(QIcon(":/icons/faenza/settings.png"), tr("Pr&eferences"), this, SLOT(showPreferences()))->setShortcut(QKeySequence("Ctrl+P"));
|
||||
#endif
|
||||
menuBar()->addMenu(m_menuEdit);
|
||||
connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenuEdit()));
|
||||
connect(m_menuEdit, SIGNAL(aboutToHide()), this, SLOT(aboutToHideMenuEdit()));
|
||||
aboutToHideMenuEdit();
|
||||
connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu()));
|
||||
connect(m_menuEdit, SIGNAL(aboutToHide()), this, SLOT(aboutToHideEditMenu()));
|
||||
aboutToHideEditMenu();
|
||||
|
||||
m_menuView = new QMenu(tr("&View"));
|
||||
m_actionShowToolbar = new QAction(tr("&Navigation Toolbar"), this);
|
||||
@ -545,6 +548,16 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
|
||||
}
|
||||
}
|
||||
|
||||
void QupZilla::aboutToShowFileMenu()
|
||||
{
|
||||
m_actionCloseWindow->setEnabled(mApp->windowCount() > 1);
|
||||
}
|
||||
|
||||
void QupZilla::aboutToHideFileMenu()
|
||||
{
|
||||
m_actionCloseWindow->setEnabled(true);
|
||||
}
|
||||
|
||||
void QupZilla::aboutToShowBookmarksMenu()
|
||||
{
|
||||
if (!m_bookmarksMenuChanged) {
|
||||
@ -807,14 +820,14 @@ void QupZilla::aboutToHideViewMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void QupZilla::aboutToShowMenuEdit()
|
||||
void QupZilla::aboutToShowEditMenu()
|
||||
{
|
||||
foreach(QAction * act, m_menuEdit->actions()) {
|
||||
act->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void QupZilla::aboutToHideMenuEdit()
|
||||
void QupZilla::aboutToHideEditMenu()
|
||||
{
|
||||
foreach(QAction * act, m_menuEdit->actions()) {
|
||||
act->setEnabled(false);
|
||||
|
@ -148,6 +148,8 @@ private slots:
|
||||
void printPage();
|
||||
void savePageScreen();
|
||||
|
||||
void aboutToShowFileMenu();
|
||||
void aboutToHideFileMenu();
|
||||
void aboutToShowHistoryMenu(bool loadHistory = true);
|
||||
void aboutToHideHistoryMenu();
|
||||
void aboutToShowClosedTabsMenu();
|
||||
@ -156,8 +158,8 @@ private slots:
|
||||
void aboutToShowHelpMenu();
|
||||
void aboutToShowViewMenu();
|
||||
void aboutToHideViewMenu();
|
||||
void aboutToShowMenuEdit();
|
||||
void aboutToHideMenuEdit();
|
||||
void aboutToShowEditMenu();
|
||||
void aboutToHideEditMenu();
|
||||
void aboutToShowEncodingMenu();
|
||||
|
||||
void searchOnPage();
|
||||
@ -228,6 +230,8 @@ private:
|
||||
QMenu* m_menuClosedTabs;
|
||||
QMenu* m_menuEncoding;
|
||||
QAction* m_menuBookmarksAction;
|
||||
|
||||
QAction* m_actionCloseWindow;
|
||||
QAction* m_actionShowToolbar;
|
||||
QAction* m_actionShowBookmarksToolbar;
|
||||
QAction* m_actionShowStatusbar;
|
||||
|
Loading…
Reference in New Issue
Block a user