Drop VirtualDesktopManager::name()
It's confusing to have two ways to query the same information.
This commit is contained in:
parent
ad6039c7c3
commit
78b5330824
6 changed files with 20 additions and 31 deletions
|
@ -556,7 +556,8 @@ void TestVirtualDesktops::name()
|
|||
vds->setCount(initCount);
|
||||
QFETCH(uint, desktop);
|
||||
|
||||
QTEST(vds->name(desktop), "desktopName");
|
||||
const VirtualDesktop *vd = vds->desktopForX11Id(desktop);
|
||||
QTEST(vd->name(), "desktopName");
|
||||
}
|
||||
|
||||
void TestVirtualDesktops::switchToShortcuts()
|
||||
|
|
|
@ -1015,7 +1015,8 @@ int EffectsHandlerImpl::desktopToLeft(int desktop, bool wrap) const
|
|||
|
||||
QString EffectsHandlerImpl::desktopName(int desktop) const
|
||||
{
|
||||
return VirtualDesktopManager::self()->name(desktop);
|
||||
const VirtualDesktop *vd = VirtualDesktopManager::self()->desktopForX11Id(desktop);
|
||||
return vd ? vd->name() : QString();
|
||||
}
|
||||
|
||||
bool EffectsHandlerImpl::optionRollOverDesktops() const
|
||||
|
|
|
@ -271,7 +271,8 @@ QRect WorkspaceWrapper::clientArea(ClientAreaOption option, int screen, int desk
|
|||
|
||||
QString WorkspaceWrapper::desktopName(int desktop) const
|
||||
{
|
||||
return VirtualDesktopManager::self()->name(desktop);
|
||||
const VirtualDesktop *vd = VirtualDesktopManager::self()->desktopForX11Id(desktop);
|
||||
return vd ? vd->name() : QString();
|
||||
}
|
||||
|
||||
void WorkspaceWrapper::createDesktop(int position, const QString &name) const
|
||||
|
|
|
@ -93,14 +93,15 @@ QString TabBoxHandlerImpl::desktopName(TabBoxClient* client) const
|
|||
{
|
||||
if (TabBoxClientImpl* c = static_cast< TabBoxClientImpl* >(client)) {
|
||||
if (!c->client()->isOnAllDesktops())
|
||||
return VirtualDesktopManager::self()->name(c->client()->desktop());
|
||||
return desktopName(c->client()->desktop());
|
||||
}
|
||||
return VirtualDesktopManager::self()->name(VirtualDesktopManager::self()->current());
|
||||
return desktopName(VirtualDesktopManager::self()->current());
|
||||
}
|
||||
|
||||
QString TabBoxHandlerImpl::desktopName(int desktop) const
|
||||
{
|
||||
return VirtualDesktopManager::self()->name(desktop);
|
||||
const VirtualDesktop *vd = VirtualDesktopManager::self()->desktopForX11Id(desktop);
|
||||
return vd ? vd->name() : QString();
|
||||
}
|
||||
|
||||
QWeakPointer<TabBoxClient> TabBoxHandlerImpl::nextClientFocusChain(TabBoxClient* client) const
|
||||
|
|
|
@ -249,18 +249,6 @@ void VirtualDesktopManager::setRootInfo(NETRootInfo *info)
|
|||
}
|
||||
}
|
||||
|
||||
QString VirtualDesktopManager::name(uint desktop) const
|
||||
{
|
||||
if (uint(m_desktops.length()) > desktop - 1) {
|
||||
return m_desktops[desktop - 1]->name();
|
||||
}
|
||||
|
||||
if (!m_rootInfo) {
|
||||
return defaultName(desktop);
|
||||
}
|
||||
return QString::fromUtf8(m_rootInfo->desktopName(desktop));
|
||||
}
|
||||
|
||||
uint VirtualDesktopManager::above(uint id, bool wrap) const
|
||||
{
|
||||
auto vd = above(desktopForX11Id(id), wrap);
|
||||
|
@ -736,25 +724,27 @@ void VirtualDesktopManager::save()
|
|||
}
|
||||
|
||||
group.writeEntry("Number", count());
|
||||
for (uint i = 1; i <= count(); ++i) {
|
||||
QString s = name(i);
|
||||
const QString defaultvalue = defaultName(i);
|
||||
for (VirtualDesktop *desktop : qAsConst(m_desktops)) {
|
||||
const uint position = desktop->x11DesktopNumber();
|
||||
|
||||
QString s = desktop->name();
|
||||
const QString defaultvalue = defaultName(position);
|
||||
if (s.isEmpty()) {
|
||||
s = defaultvalue;
|
||||
if (m_rootInfo) {
|
||||
m_rootInfo->setDesktopName(i, s.toUtf8().data());
|
||||
m_rootInfo->setDesktopName(position, s.toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
if (s != defaultvalue) {
|
||||
group.writeEntry(QStringLiteral("Name_%1").arg(i), s);
|
||||
group.writeEntry(QStringLiteral("Name_%1").arg(position), s);
|
||||
} else {
|
||||
QString currentvalue = group.readEntry(QStringLiteral("Name_%1").arg(i), QString());
|
||||
QString currentvalue = group.readEntry(QStringLiteral("Name_%1").arg(position), QString());
|
||||
if (currentvalue != defaultvalue) {
|
||||
group.deleteEntry(QStringLiteral("Name_%1").arg(i));
|
||||
group.deleteEntry(QStringLiteral("Name_%1").arg(position));
|
||||
}
|
||||
}
|
||||
group.writeEntry(QStringLiteral("Id_%1").arg(i), m_desktops[i-1]->id());
|
||||
group.writeEntry(QStringLiteral("Id_%1").arg(position), desktop->id());
|
||||
}
|
||||
|
||||
group.writeEntry("Rows", m_rows);
|
||||
|
|
|
@ -187,11 +187,6 @@ public:
|
|||
template <typename Direction>
|
||||
void moveTo(bool wrap = false);
|
||||
|
||||
/**
|
||||
* @returns The name of the @p desktop
|
||||
*/
|
||||
QString name(uint desktop) const;
|
||||
|
||||
/**
|
||||
* @returns @c true if navigation at borders of layout wraps around, @c false otherwise
|
||||
* @see setNavigationWrappingAround
|
||||
|
|
Loading…
Reference in a new issue