void LipstickCompositor::surfaceAboutToBeDestroyed(QWaylandSurface *surface) { Q_ASSERT(surface); LipstickCompositorWindow *item = static_cast<LipstickCompositorWindow *>(surface->surfaceItem()); surface->setSurfaceItem(0); if (surface == m_fullscreenSurface) setFullscreenSurface(0); if (item) { int id = item->windowId(); int gc = ghostWindowCount(); m_mappedSurfaces.remove(item->windowId()); emit windowCountChanged(); emit windowRemoved(item); item->m_windowClosed = true; item->tryRemove(); if (gc != ghostWindowCount()) emit ghostWindowCountChanged(); windowRemoved(id); emit availableWinIdsChanged(); } }
TaskManager::TaskManager(QObject *parent, const char *name) : QObject(parent, name), _active(0), _startup_info( NULL ) { kwin_module = new KWinModule(); // KGlobal::locale()->insertCatalogue("libtaskmanager"); connect(kwin_module, SIGNAL(windowAdded(WId)), SLOT(windowAdded(WId))); connect(kwin_module, SIGNAL(windowRemoved(WId)), SLOT(windowRemoved(WId))); connect(kwin_module, SIGNAL(activeWindowChanged(WId)), SLOT(activeWindowChanged(WId))); connect(kwin_module, SIGNAL(currentDesktopChanged(int)), SLOT(currentDesktopChanged(int))); connect(kwin_module, SIGNAL(windowChanged(WId,unsigned int)), SLOT(windowChanged(WId,unsigned int))); // register existing windows const QValueList<WId> windows = kwin_module->windows(); QValueList<WId>::ConstIterator end( windows.end() ); for (QValueList<WId>::ConstIterator it = windows.begin(); it != end; ++it ) windowAdded(*it); // set active window WId win = kwin_module->activeWindow(); activeWindowChanged(win); configure_startup(); }
RenderController::RenderController( RenderContextPtr renderContext ) : renderContext_( renderContext ) , displayGroupRenderer_( new DisplayGroupRenderer( renderContext )) , syncQuit_( false ) , syncDisplayGroup_( boost::make_shared<DisplayGroup>( QSize( ))) , syncOptions_( boost::make_shared<Options>( )) { syncDisplayGroup_.setCallback( boost::bind( &DisplayGroupRenderer::setDisplayGroup, displayGroupRenderer_.get(), _1 )); MarkerRenderer& markers = renderContext_->getScene().getMarkersRenderer(); syncMarkers_.setCallback( boost::bind( &MarkerRenderer::setMarkers, &markers, _1 )); syncOptions_.setCallback( boost::bind( &RenderController::setRenderOptions, this, _1 )); connect( displayGroupRenderer_.get(), SIGNAL( windowAdded( QmlWindowPtr )), &pixelStreamUpdater_, SLOT( onWindowAdded( QmlWindowPtr ))); connect( displayGroupRenderer_.get(), SIGNAL( windowRemoved( QmlWindowPtr )), &pixelStreamUpdater_, SLOT( onWindowRemoved( QmlWindowPtr ))); }
void TabSwitcherWidget::showEvent(QShowEvent *event) { setFocus(); MainWindowSessionItem *mainWindowItem(SessionsManager::getModel()->getMainWindowItem(m_mainWindow)); if (mainWindowItem) { const bool useSorting(SettingsManager::getOption(SettingsManager::Interface_TabSwitchingModeOption).toString() != QLatin1String("noSort")); for (int i = 0; i < mainWindowItem->rowCount(); ++i) { WindowSessionItem *windowItem(static_cast<WindowSessionItem*>(mainWindowItem->child(i, 0))); if (windowItem) { m_model->appendRow(createRow(windowItem->getActiveWindow(), (useSorting ? QVariant(windowItem->getActiveWindow()->getLastActivity()) : QVariant(i)))); } } } m_model->sort(0, ((SettingsManager::getOption(SettingsManager::Interface_TabSwitchingModeOption).toString() == QLatin1String("noSort")) ? Qt::AscendingOrder : Qt::DescendingOrder)); Window *activeWindow(m_mainWindow->getActiveWindow()); const int contentsHeight(m_model->rowCount() * 22); m_tabsView->setCurrentIndex(m_model->index((activeWindow ? findRow(activeWindow->getIdentifier()) : 0), 0)); m_tabsView->setMinimumHeight(qMin(contentsHeight, int(height() * 0.9))); QWidget::showEvent(event); connect(m_mainWindow, SIGNAL(windowAdded(quint64)), this, SLOT(handleWindowAdded(quint64))); connect(m_mainWindow, SIGNAL(windowRemoved(quint64)), this, SLOT(handleWindowRemoved(quint64))); }
void Menu::populateWindowsMenu() { if (actions().isEmpty()) { MainWindow *mainWindow = MainWindow::findMainWindow(this); if (mainWindow) { connect(mainWindow->getWindowsManager(), SIGNAL(windowAdded(qint64)), this, SLOT(populateWindowsMenu())); connect(mainWindow->getWindowsManager(), SIGNAL(windowRemoved(qint64)), this, SLOT(populateWindowsMenu())); connect(mainWindow->getWindowsManager(), SIGNAL(windowTitleChanged(QString)), this, SLOT(populateWindowsMenu())); } disconnect(this, SIGNAL(aboutToShow()), this, SLOT(populateWindowsMenu())); } clear(); MainWindow *mainWindow = MainWindow::findMainWindow(this); if (!mainWindow) { return; } for (int i = 0; i < mainWindow->getWindowsManager()->getWindowCount(); ++i) { Window *window = mainWindow->getWindowsManager()->getWindowByIndex(i); if (window) { QMenu::addAction(window->getIcon(), (window->getTitle().isEmpty() ? tr("(Untitled)") : Utils::elideText(window->getTitle())))->setData(window->getIdentifier()); } } }
void TabSwitcherWidget::showEvent(QShowEvent *event) { grabKeyboard(); for (int i = 0; i < m_windowsManager->getWindowCount(); ++i) { Window *window = m_windowsManager->getWindowByIndex(i); if (window) { m_model->appendRow(createRow(window)); } } m_model->sort(1, Qt::DescendingOrder); m_tabsView->setCurrentIndex(m_model->index(0, 0)); const int contentsHeight = (m_model->rowCount() * 22); m_tabsView->setMinimumHeight(qMin(contentsHeight, int(height() * 0.9))); QWidget::showEvent(event); connect(m_windowsManager, SIGNAL(windowAdded(qint64)), this, SLOT(tabAdded(qint64))); connect(m_windowsManager, SIGNAL(windowRemoved(qint64)), this, SLOT(tabRemoved(qint64))); }
KPager::KPager(KPagerMainWindow *parent, const char *name) : QFrame (parent, name, WStyle_Customize | WStyle_NoBorder | WStyle_Tool) , m_layout(0) , m_mnu(0) , m_smnu(0) , m_dmnu(0) { m_windows.setAutoDelete(true); // delete windows info after removal setBackgroundColor( black ); m_winmodule=new KWinModule(this); m_currentDesktop=m_winmodule->currentDesktop(); m_grabWinTimer=new QTimer(this,"grabWinTimer"); connect(m_grabWinTimer, SIGNAL(timeout()), this, SLOT(slotGrabWindows())); KPagerConfigDialog::initConfiguration(); KConfig *cfg = kapp->config(); cfg->setGroup("KPager"); m_showStickyOption=cfg->readBoolEntry("ShowStickyOption",false); int numberOfDesktops=m_winmodule->numberOfDesktops(); for (int i=0;i<numberOfDesktops;i++) { Desktop *dsk=new Desktop(i+1,m_winmodule->desktopName(i),this); m_desktops.append(dsk); } m_layoutType=static_cast<enum KPager::LayoutTypes>( KPagerConfigDialog::m_layoutType ); connect( m_winmodule, SIGNAL( activeWindowChanged(WId)), SLOT(slotActiveWindowChanged(WId))); connect( m_winmodule, SIGNAL( windowAdded(WId) ), SLOT( slotWindowAdded(WId) ) ); connect( m_winmodule, SIGNAL( windowRemoved(WId) ), SLOT( slotWindowRemoved(WId) ) ); connect( m_winmodule, SIGNAL( windowChanged(WId,unsigned int) ), SLOT( slotWindowChanged(WId,unsigned int) ) ); connect( m_winmodule, SIGNAL( stackingOrderChanged() ), SLOT( slotStackingOrderChanged() ) ); connect( m_winmodule, SIGNAL( desktopNamesChanged() ), SLOT( slotDesktopNamesChanged() ) ); connect( m_winmodule, SIGNAL( numberOfDesktopsChanged(int) ), SLOT( slotNumberOfDesktopsChanged(int) ) ); connect( m_winmodule, SIGNAL( currentDesktopChanged(int)), SLOT( slotCurrentDesktopChanged(int) ) ); connect(kapp, SIGNAL(backgroundChanged(int)), SLOT(slotBackgroundChanged(int))); QFont defFont(KGlobalSettings::generalFont().family(), 10, QFont::Bold); defFont = cfg->readFontEntry("Font", &defFont); setFont(defFont); m_prefs_action = KStdAction::preferences(this, SLOT(configureDialog()), parent->actionCollection()); m_quit_action = KStdAction::quit(kapp, SLOT(quit()), parent->actionCollection()); updateLayout(); }
void TabSwitcherWidget::hideEvent(QHideEvent *event) { QWidget::hideEvent(event); disconnect(m_mainWindow, SIGNAL(windowAdded(quint64)), this, SLOT(handleWindowAdded(quint64))); disconnect(m_mainWindow, SIGNAL(windowRemoved(quint64)), this, SLOT(handleWindowRemoved(quint64))); m_model->clear(); }
void LipstickCompositor::surfaceUnmapped(LipstickCompositorProcWindow *item) { int id = item->windowId(); int gc = ghostWindowCount(); m_mappedSurfaces.remove(item->windowId()); emit windowCountChanged(); emit windowRemoved(item); item->m_windowClosed = true; item->tryRemove(); if (gc != ghostWindowCount()) emit ghostWindowCountChanged(); windowRemoved(id); emit availableWinIdsChanged(); }
void TabSwitcherWidget::hideEvent(QHideEvent *event) { releaseKeyboard(); QWidget::hideEvent(event); disconnect(m_windowsManager, SIGNAL(windowAdded(qint64)), this, SLOT(tabAdded(qint64))); disconnect(m_windowsManager, SIGNAL(windowRemoved(qint64)), this, SLOT(tabRemoved(qint64))); m_model->clear(); }
void DisplayGroupRenderer::setDisplayGroup( DisplayGroupPtr displayGroup ) { QDeclarativeEngine& engine = renderContext_->getQmlEngine(); // Update the scene with the new information engine.rootContext()->setContextProperty( "displaygroup", displayGroup.get( )); if( !displayGroupItem_ ) createDisplayGroupQmlItem(); if( hasBackgroundChanged( *displayGroup )) { setBackground( displayGroup->getBackgroundContent( )); adjustBackgroundTo( *displayGroup ); } ContentWindowPtrs contentWindows = displayGroup->getContentWindows(); // Update windows, creating new ones if needed QSet<QUuid> updatedWindows; int stackingOrder = BACKGROUND_STACKING_ORDER + 1; BOOST_FOREACH( ContentWindowPtr window, contentWindows ) { const QUuid& id = window->getID(); updatedWindows.insert( id ); if( windowItems_.contains( id )) windowItems_[id]->update( window ); else createWindowQmlItem( window ); windowItems_[id]->setStackingOrder( stackingOrder++ ); } // Remove old windows QmlWindows::iterator it = windowItems_.begin(); while( it != windowItems_.end( )) { if( updatedWindows.contains( it.key( ))) ++it; else { emit windowRemoved( *it ); it = windowItems_.erase( it ); } } // Retain the new DisplayGroup displayGroup_ = displayGroup; }
WindowsHandler::WindowsHandler( bool enable_signal_P, QObject* parent_P ) : QObject( parent_P ), signals_enabled( enable_signal_P ), _action_window( 0 ), m_isX11(QX11Info::isPlatformX11()) { if( signals_enabled ) { connect( KWindowSystem::self(), SIGNAL(windowAdded(WId)), SLOT(window_added_slot(WId))); connect( KWindowSystem::self(), SIGNAL(windowRemoved(WId)), SLOT(window_removed_slot(WId))); connect( KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), SLOT(active_window_changed_slot(WId))); } }
void WindowsManager::closeWindow(Window *window) { const int index = getWindowIndex(window); if (index < 0) { return; } if (window && !window->isPrivate()) { const WindowHistoryInformation history = window->getContentsWidget()->getHistory(); if (!window->isUrlEmpty() || history.entries.count() > 1) { const SessionWindow information = window->getSession(); if (window->getType() != QLatin1String("web")) { removeStoredUrl(information.getUrl()); } m_closedWindows.prepend(information); emit closedWindowsAvailableChanged(true); } } if (m_tabBar->count() == 1) { window = getWindow(0); if (window) { window->clear(); return; } } m_tabBar->removeTab(index); emit windowRemoved(index); if (m_tabBar->count() < 1) { open(); } }
LxQtTaskGroup::LxQtTaskGroup(const QString &groupName, QIcon icon, ILxQtPanelPlugin * plugin, LxQtTaskBar *parent) : LxQtTaskButton(0, parent, parent), mGroupName(groupName), mPopup(new LxQtGroupPopup(this)), mPlugin(plugin), mPreventPopup(false) { Q_ASSERT(parent); setObjectName(groupName); setText(groupName); setIcon(icon); connect(this, SIGNAL(clicked(bool)), this, SLOT(onClicked(bool))); connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(onDesktopChanged(int))); connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SLOT(onWindowRemoved(WId))); connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(onActiveWindowChanged(WId))); }
void Task::removeItem(AbstractGroupableItem *abstractItem) { if (m_group && m_group->members().count() == 1) { m_taskType = TaskType; m_abstractItem = m_group->members().first(); m_group = NULL; m_task = qobject_cast<TaskItem*>(m_abstractItem); } TaskItem *task = qobject_cast<TaskItem*>(abstractItem); if (task && task->task()) { emit windowRemoved(task->task()->window()); } emit changed(EveythingChanged); }
void Compositor::onSurfaceDestroyed() { CompositorWindow *window = static_cast<CompositorWindow*>(sender()); qDebug() << Q_FUNC_INFO << window; if (window == mFullscreenWindow) setFullscreenWindow(0); if (window) { if (WindowModel::isWindowAlreadyAdded(mWindowModels, window)) { WindowModel::removeWindowForEachModel(mWindowModels, window); emit windowRemoved(QVariant::fromValue(static_cast<QQuickItem*>(window))); } mWindows.remove(window->winId()); // window->deleteLater(); // not needed: the deletion of the surface will trigger the deletion of its extensions, among which is our CompositorWindow } }
void WindowsManager::detachWindow(int index) { Window *window = getWindow(index); if (!window) { return; } MainWindow *mainWindow = Application::getInstance()->createWindow(window->isPrivate(), true); if (mainWindow) { window->getContentsWidget()->setParent(NULL); mainWindow->getWindowsManager()->openWindow(window->getContentsWidget()); mainWindow->getWindowsManager()->closeOther(); m_tabBar->removeTab(index); emit windowRemoved(index); } }
void TaskManager::windowChanged(WId w, unsigned int dirty) { if( dirty & NET::WMState ) { NETWinInfo info ( qt_xdisplay(), w, qt_xrootwin(), NET::WMState ); if ( (info.state() & NET::SkipTaskbar) != 0 ) { windowRemoved( w ); _skiptaskbar_windows.push_front( w ); return; } else { _skiptaskbar_windows.remove( w ); if( !findTask( w )) windowAdded( w ); // skipTaskBar state was removed, so add this window } } // check if any state we are interested in is marked dirty if(!(dirty & (NET::WMVisibleName|NET::WMName|NET::WMState|NET::WMIcon|NET::XAWMState|NET::WMDesktop)) ) return; // find task Task* t = findTask( w ); if (!t) return; //kdDebug() << "TaskManager::windowChanged " << w << " " << dirty << endl; // refresh icon pixmap if necessary if (dirty & NET::WMIcon) t->refresh(true); else t->refresh(); if(dirty & (NET::WMDesktop|NET::WMState|NET::XAWMState)) emit windowChanged(w); // moved to different desktop or is on all or change in iconification/withdrawnnes }
WindowListModel::WindowListModel( WId kdevWinId, QObject* parent): QAbstractListModel(parent), m_kdevWinId(kdevWinId) { KWindowSystem *kws = KWindowSystem::self(); // QList<WId> winList = kws->windows(); // // QList<WId>::ConstIterator it; // QList<WId>::ConstIterator end = KWindowSystem::windows().end(); // for ( it = KWindowSystem::windows().begin(); it != end; ++it ) // { // KWindowInfo kwi = kws->windowInfo(*it, NET::WMName | NET::WMVisibleName | NET::WMVisibleIconName | NET::WMWindowType); // // if( kwi.windowType(NET::NormalMask) == NET::Normal ) { // m_winList.append( kwi ); // // qDebug() << "Adding window " << kwi.visibleName() << "(" << kwi.win() << ")"; // } // } connect( kws, SIGNAL(windowAdded(WId)), this, SLOT(onWindowAdded(WId))); connect( kws, SIGNAL(windowRemoved(WId)), this, SLOT(onWindowRemoved(WId))); connect( kws, SIGNAL(windowChanged(WId,uint)), this, SLOT(onWindowChanged(WId,uint)) ); }
bool KWD::Decorator::enableDecorations (Time timestamp) { QList <WId>::ConstIterator it; unsigned int nchildren; WId *children; WId root, parent; long int select; mDmSnTimestamp = timestamp; if (!pluginManager ()->loadPlugin ("")) return false; updateAllShadowOptions (); KWD::trapXError (); (void) QApplication::desktop (); // trigger creation of desktop widget KWD::popXError (); updateShadow (); /* FIXME: Implement proper decoration lists and remove this */ mDecorNormal = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow (), 0, Window::Default); mDecorActive = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow (), 0, Window::DefaultActive); mActiveId = KWindowSystem::activeWindow (); connect (KWindowSystem::self (), SIGNAL (windowAdded (WId)), SLOT (handleWindowAdded (WId))); connect (KWindowSystem::self (), SIGNAL (windowRemoved (WId)), SLOT (handleWindowRemoved (WId))); connect (KWindowSystem::self (), SIGNAL (activeWindowChanged (WId)), SLOT (handleActiveWindowChanged (WId))); connect (KWindowSystem::self (), SIGNAL (windowChanged (WId, const unsigned long *)), SLOT (handleWindowChanged (WId, const unsigned long *))); foreach (WId id, KWindowSystem::windows ()) handleWindowAdded (id); /* Find the switcher and add it too * FIXME: Doing XQueryTree and then * XGetWindowProperty on every window * like this is really expensive, surely * there is a better way to do this */ XQueryTree (QX11Info::display (), QX11Info::appRootWindow (), &root, &parent, &children, &nchildren); for (unsigned int i = 0; i < nchildren; i++) { if (KWD::readWindowProperty (children[i], Atoms::switchSelectWindow, &select)) { handleWindowAdded(children[i]); break; } } connect (Plasma::Theme::defaultTheme (), SIGNAL (themeChanged ()), SLOT (plasmaThemeChanged ())); // select for client messages XSelectInput (QX11Info::display (), QX11Info::appRootWindow (), SubstructureNotifyMask | StructureNotifyMask | PropertyChangeMask); return true; }
Amor::Amor() : mAmor( 0 ), mBubble( 0 ), mForceHideAmorWidget( false ) { new AmorAdaptor( this ); QDBusConnection::sessionBus().registerObject( QLatin1String( "/Amor" ), this ); if( !readConfig() ) { qApp->quit(); } mTargetWin = 0; mNextTarget = 0; mAmorDialog = 0; mMenu = 0; mCurrAnim = mBaseAnim; mPosition = mCurrAnim->hotspot().x(); mState = Normal; mWin = KWindowSystem::self(); connect( mWin, SIGNAL(activeWindowChanged(WId)), this, SLOT(slotWindowActivate(WId)) ); connect( mWin, SIGNAL(windowRemoved(WId)), this, SLOT(slotWindowRemove(WId)) ); connect( mWin, SIGNAL(stackingOrderChanged()), this, SLOT(slotStackingChanged()) ); connect( mWin, SIGNAL(windowChanged(WId,const ulong*)), this, SLOT(slotWindowChange(WId,const ulong*)) ); connect( mWin, SIGNAL(currentDesktopChanged(int)), this, SLOT(slotDesktopChange(int)) ); mAmor = new AmorWidget; connect( mAmor, SIGNAL(mouseClicked(QPoint)), SLOT(slotMouseClicked(QPoint)) ); connect( mAmor, SIGNAL(dragged(QPoint,bool)), SLOT(slotWidgetDragged(QPoint,bool)) ); mAmor->resize(mTheme.maximumSize()); mTimer = new QTimer( this ); connect( mTimer, SIGNAL(timeout()), SLOT(slotTimeout()) ); mStackTimer = new QTimer( this ); connect( mStackTimer, SIGNAL(timeout()), SLOT(restack()) ); mBubbleTimer = new QTimer( this ); connect( mBubbleTimer, SIGNAL(timeout()), SLOT(slotBubbleTimeout()) ); std::time( &mActiveTime ); mCursPos = QCursor::pos(); mCursorTimer = new QTimer( this ); connect( mCursorTimer, SIGNAL(timeout()), SLOT(slotCursorTimeout()) ); mCursorTimer->start( 500 ); if( mWin->activeWindow() ) { mNextTarget = mWin->activeWindow(); selectAnimation( Focus ); mTimer->setSingleShot( true ); mTimer->start( 0 ); } if( !QDBusConnection::sessionBus().connect( QString(), QString(), QLatin1String( "org.kde.amor" ), QLatin1String( "KDE_stop_screensaver" ), this, SLOT(screenSaverStopped()) ) ) { kDebug(10000) << "Could not attach DBus signal: KDE_stop_screensaver()"; } if( !QDBusConnection::sessionBus().connect( QString(), QString(), QLatin1String( "org.kde.amor" ), QLatin1String( "KDE_start_screensaver" ), this, SLOT(screenSaverStarted()) ) ) { kDebug(10000) << "Could not attach DBus signal: KDE_start_screensaver()"; } KStartupInfo::appStarted(); }
void WindowsManager::closeWindow(Window *window) { const int index = getWindowIndex(window); if (index < 0) { return; } if (window && !window->isPrivate()) { const WindowHistoryInformation history = window->getContentsWidget()->getHistory(); if (!window->isUrlEmpty() || history.entries.count() > 1) { const SessionWindow information = window->getSession(); if (window->getType() != QLatin1String("web")) { removeStoredUrl(information.getUrl()); } m_closedWindows.prepend(information); emit closedWindowsAvailableChanged(true); } } const QString lastTabClosingAction = SettingsManager::getValue(QLatin1String("TabBar/LastTabClosingAction")).toString(); if (m_tabBar->count() == 1) { if (lastTabClosingAction == QLatin1String("closeWindow")) { ActionsManager::triggerAction(QLatin1String("CloseWindow"), m_mdi); return; } if (lastTabClosingAction == QLatin1String("openTab")) { window = getWindow(0); if (window) { window->clear(); return; } } else { ActionsManager::getAction(QLatin1String("CloneTab"), m_mdi)->setEnabled(false); emit windowTitleChanged(QString()); } } m_tabBar->removeTab(index); emit windowRemoved(index); if (m_tabBar->count() < 1 && lastTabClosingAction != QLatin1String("doNothing")) { open(); } }
void WindowsManager::handleWindowClose(Window *window) { const int index = (window ? getWindowIndex(window->getIdentifier()) : -1); if (index < 0) { return; } if (window && !window->isPrivate()) { const WindowHistoryInformation history = window->getContentsWidget()->getHistory(); if (!Utils::isUrlEmpty(window->getUrl()) || history.entries.count() > 1) { Window *nextWindow = getWindowByIndex(index + 1); Window *previousWindow = ((index > 0) ? getWindowByIndex(index - 1) : NULL); ClosedWindow closedWindow; closedWindow.window = window->getSession(); closedWindow.nextWindow = (nextWindow ? nextWindow->getIdentifier() : 0); closedWindow.previousWindow = (previousWindow ? previousWindow->getIdentifier() : 0); if (window->getType() != QLatin1String("web")) { removeStoredUrl(closedWindow.window.getUrl()); } m_closedWindows.prepend(closedWindow); emit closedWindowsAvailableChanged(true); } } const QString lastTabClosingAction = SettingsManager::getValue(QLatin1String("Interface/LastTabClosingAction")).toString(); if (m_mainWindow->getTabBar()->count() == 1) { if (lastTabClosingAction == QLatin1String("closeWindow") || (lastTabClosingAction == QLatin1String("closeWindowIfNotLast") && SessionsManager::getWindows().count() > 1)) { m_mainWindow->triggerAction(ActionsManager::CloseWindowAction); return; } if (lastTabClosingAction == QLatin1String("openTab")) { window = getWindowByIndex(0); if (window) { window->clear(); return; } } else { m_mainWindow->getAction(ActionsManager::CloseTabAction)->setEnabled(false); m_mainWindow->setCurrentWindow(NULL); emit windowTitleChanged(QString()); } } m_mainWindow->getTabBar()->removeTab(index); Action *closePrivateTabsAction = m_mainWindow->getAction(ActionsManager::ClosePrivateTabsAction); if (closePrivateTabsAction->isEnabled() && getWindowCount(true) == 0) { closePrivateTabsAction->setEnabled(false); } emit windowRemoved(window->getIdentifier()); m_windows.remove(window->getIdentifier()); if (m_mainWindow->getTabBar()->count() < 1 && lastTabClosingAction == QLatin1String("openTab")) { open(); } }