[tabbox] Drop DBus interface and embedded functionality

Both were only added for the use case of Plasma Active. In the next
iteration we won't need the embedded any more as Plasma is able to draw
thumbnails by itself. So there is neither need for the embedded
functionality nor for the D-Bus interface.

REVIEW: 118464
This commit is contained in:
Martin Gräßlin 2014-06-02 09:12:14 +02:00
parent 4c241f0920
commit ec6a1810d4
4 changed files with 3 additions and 158 deletions

View file

@ -47,7 +47,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QAction>
#include <QDebug>
#include <QtDBus/QDBusConnection>
// KDE
#include <KConfig>
#include <KConfigGroup>
@ -464,19 +463,16 @@ TabBox::TabBox(QObject *parent)
m_desktopListConfig.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching);
m_tabBox = new TabBoxHandlerImpl(this);
QTimer::singleShot(0, this, SLOT(handlerReady()));
connect(m_tabBox, SIGNAL(selectedIndexChanged()), SIGNAL(itemSelected()));
m_tabBoxMode = TabBoxDesktopMode; // init variables
connect(&m_delayedShowTimer, SIGNAL(timeout()), this, SLOT(show()));
connect(Workspace::self(), SIGNAL(configChanged()), this, SLOT(reconfigure()));
QDBusConnection::sessionBus().registerObject(QStringLiteral("/TabBox"), this, QDBusConnection::ExportScriptableContents);
connect(input(), &InputRedirection::keyboardModifiersChanged, this, &TabBox::modifiersChanged);
}
TabBox::~TabBox()
{
QDBusConnection::sessionBus().unregisterObject(QStringLiteral("/TabBox"));
s_self = nullptr;
}
@ -1111,61 +1107,12 @@ bool TabBox::toggle(ElectricBorder eb)
return true;
}
void TabBox::open(bool modal, const QString &layout)
{
if (isDisplayed()) {
return;
}
if (modal) {
if (!establishTabBoxGrab()) {
return;
}
m_tabGrab = true;
} else {
m_tabGrab = false;
}
m_noModifierGrab = !modal;
setMode(TabBoxWindowsMode);
if (!layout.isNull()) {
TabBoxConfig tempConfig;
tempConfig = tabBox->config();
tempConfig.setLayoutName(layout);
tempConfig.setShowTabBox(true);
tabBox->setConfig(tempConfig);
}
reset();
show();
}
void TabBox::openEmbedded(qulonglong wid, QPoint offset, QSize size, int horizontalAlignment, int verticalAlignment, const QString &layout)
{
if (isDisplayed()) {
return;
}
m_tabGrab = false;
m_noModifierGrab = true;
tabBox->setEmbedded(static_cast<WId>(wid));
tabBox->setEmbeddedOffset(offset);
tabBox->setEmbeddedSize(size);
tabBox->setEmbeddedAlignment(static_cast<Qt::AlignmentFlag>(horizontalAlignment) | static_cast<Qt::AlignmentFlag>(verticalAlignment));
setMode(TabBoxWindowsMode);
if (!layout.isNull()) {
TabBoxConfig tempConfig;
tempConfig = tabBox->config();
tempConfig.setLayoutName(layout);
tabBox->setConfig(tempConfig);
}
reset();
show();
}
bool TabBox::startKDEWalkThroughWindows(TabBoxMode mode)
{
if (!establishTabBoxGrab())
return false;
m_tabGrab = true;
m_noModifierGrab = false;
tabBox->resetEmbedded();
setMode(mode);
reset();
return true;
@ -1466,11 +1413,6 @@ void TabBox::accept()
}
}
void TabBox::reject()
{
close(true);
}
/*!
Handles alt-tab / control-tab releasing
*/

View file

@ -111,7 +111,6 @@ private:
class TabBox : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin")
public:
~TabBox();
@ -185,33 +184,8 @@ public:
public Q_SLOTS:
void show();
/**
* Only for DBus Interface to start primary KDE Walk through windows.
* @param modal Whether the TabBox should grab keyboard and mouse, that is go into modal
* mode or whether the TabBox is controlled externally (e.g. through an effect).
* @param layout The name of the layout to use, if null string (default) the configured layout is used
**/
Q_SCRIPTABLE void open(bool modal = true, const QString &layout = QString());
/**
* Opens the TabBox view embedded on a different window. This implies non-modal mode.
* The geometry of the TabBox is determined by offset, size and the alignment flags.
* If the alignment flags are set to center the view scales with the container. That is if
* the window where the TabBox is embedded onto resizes, the TabBox resizes, too.
* The alignment in combination with the offset determines to what border the TabBox is snapped.
* E.g. if horizontal alignment is right the offset is interpreted as the offset between right
* corner of TabBox view and the container view. When the container changes its geometry this
* offset is kept. So the offset on the left side would increase.
* @param wid The window Id the TabBox should be embedded onto
* @param offset The offset to one of the size borders
* @param size The size of the TabBox. To use the same size as the container, set alignment to center
* @param horizontalAlignment Either Qt::AlignLeft, Qt::AlignHCenter or Qt::AlignRight
* @param verticalAlignment Either Qt::AlignTop, Qt::AlignVCenter or Qt::AlignBottom
* @param layout The name of the layout to use, if null string (default) the configured layout is used
**/
Q_SCRIPTABLE void openEmbedded(qulonglong wid, QPoint offset, QSize size, int horizontalAlignment, int verticalAlignment, const QString &layout = QString());
Q_SCRIPTABLE void close(bool abort = false);
Q_SCRIPTABLE void accept();
Q_SCRIPTABLE void reject();
void close(bool abort = false);
void accept();
void slotWalkThroughDesktops();
void slotWalkBackThroughDesktops();
void slotWalkThroughDesktopList();
@ -231,8 +205,7 @@ public Q_SLOTS:
Q_SIGNALS:
void tabBoxAdded(int);
Q_SCRIPTABLE void tabBoxClosed();
Q_SCRIPTABLE void itemSelected();
void tabBoxClosed();
void tabBoxUpdated();
void tabBoxKeyEvent(QKeyEvent*);

View file

@ -94,10 +94,6 @@ public:
*/
bool isShown;
TabBoxClient *lastRaisedClient, *lastRaisedClientSucc;
WId m_embedded;
QPoint m_embeddedOffset;
QSize m_embeddedSize;
Qt::Alignment m_embeddedAlignment;
Xcb::Atom m_highlightWindowsAtom;
private:
@ -108,9 +104,6 @@ TabBoxHandlerPrivate::TabBoxHandlerPrivate(TabBoxHandler *q)
: m_qmlContext()
, m_qmlComponent()
, m_mainItem(nullptr)
, m_embedded(0)
, m_embeddedOffset(QPoint(0, 0))
, m_embeddedSize(QSize(0, 0))
, m_highlightWindowsAtom(QByteArrayLiteral("_KDE_WINDOW_HIGHLIGHT"))
{
this->q = q;
@ -584,58 +577,6 @@ QModelIndex TabBoxHandler::first() const
return model->index(0, 0);
}
WId TabBoxHandler::embedded() const
{
return d->m_embedded;
}
void TabBoxHandler::setEmbedded(WId wid)
{
d->m_embedded = wid;
emit embeddedChanged(wid != 0);
}
void TabBoxHandler::setEmbeddedOffset(const QPoint &offset)
{
d->m_embeddedOffset = offset;
}
void TabBoxHandler::setEmbeddedSize(const QSize &size)
{
d->m_embeddedSize = size;
}
const QPoint &TabBoxHandler::embeddedOffset() const
{
return d->m_embeddedOffset;
}
const QSize &TabBoxHandler::embeddedSize() const
{
return d->m_embeddedSize;
}
Qt::Alignment TabBoxHandler::embeddedAlignment() const
{
return d->m_embeddedAlignment;
}
void TabBoxHandler::setEmbeddedAlignment(Qt::Alignment alignment)
{
d->m_embeddedAlignment = alignment;
}
void TabBoxHandler::resetEmbedded()
{
if (d->m_embedded == 0) {
return;
}
d->m_embedded = 0;
d->m_embeddedOffset = QPoint(0, 0);
d->m_embeddedSize = QSize(0, 0);
emit embeddedChanged(false);
}
TabBoxHandler* tabBox = nullptr;
TabBoxClient::TabBoxClient()

View file

@ -325,23 +325,12 @@ public:
*/
QModelIndex first() const;
void setEmbedded(WId wid);
WId embedded() const;
void setEmbeddedOffset(const QPoint &offset);
const QPoint &embeddedOffset() const;
void setEmbeddedSize(const QSize &size);
const QSize &embeddedSize() const;
void setEmbeddedAlignment(Qt::Alignment alignment);
Qt::Alignment embeddedAlignment() const;
void resetEmbedded();
Q_SIGNALS:
/**
* This signal is fired when the TabBoxConfig changes
* @see setConfig
*/
void configChanged();
void embeddedChanged(bool enabled);
void selectedIndexChanged();
private Q_SLOTS: