plasma: remove unused KListConfirmationDialo and CheckBox classes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-09-12 00:40:42 +03:00
parent ffc97bf300
commit a7052ff980
6 changed files with 0 additions and 333 deletions

View file

@ -7,7 +7,6 @@ include_directories(
set(plasma_SRCS
scripting/desktopscriptengine.cpp
scripting/panel.cpp
checkbox.cpp
controllerwindow.cpp
desktopcorona.cpp
desktopview.cpp
@ -20,7 +19,6 @@ set(plasma_SRCS
panelappletoverlay.cpp
plasmaapp.cpp
positioningruler.cpp
klistconfirmationdialog.cpp
)
set(plasmaapp_dbusXML dbus/org.kde.plasma.App.xml)

View file

@ -1,52 +0,0 @@
/*
* Copyright 2009 Alain Boyer <alainboyer@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "checkbox.h"
// Qt
#include <QPainter>
// Plasma
#include <Plasma/Theme>
CheckBox::CheckBox(QWidget *parent)
: QCheckBox(parent),
m_styleOptionButton(),
m_initialized(false)
{
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateStyle()));
}
void CheckBox::updateStyle()
{
initStyleOption(&m_styleOptionButton);
m_styleOptionButton.palette.setColor(QPalette::WindowText, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
}
void CheckBox::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter painter(this);
if (!m_initialized) {
updateStyle();
}
style()->drawControl(QStyle::CE_CheckBox, &m_styleOptionButton, &painter, this);
}
#include "moc_checkbox.cpp"

View file

@ -1,45 +0,0 @@
/*
* Copyright 2009 Alain Boyer <alainboyer@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CHECKBOX_H
#define CHECKBOX_H
#include <QtGui/qcheckbox.h>
#include <QtGui/qstyleoption.h>
class CheckBox: public QCheckBox
{
Q_OBJECT
public:
CheckBox(QWidget *parent);
public slots:
void updateStyle();
protected:
void paintEvent(QPaintEvent *event);
private:
QStyleOptionButton m_styleOptionButton;
bool m_initialized;
};
#endif

View file

@ -1,165 +0,0 @@
/*
* Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* or (at your option) any later version, as published by the Free
* Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "klistconfirmationdialog.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QListWidget>
#include <QLabel>
#include <QStyledItemDelegate>
#include <KIconLoader>
class KListConfirmationDialogPrivate {
public:
QVBoxLayout * mainLayout;
QHBoxLayout * buttonsLayout;
QPushButton * buttonConfirm;
QPushButton * buttonCancel;
QListWidget * listItems;
QLabel * labelCaption;
int iconSize;
};
class KListConfirmationDialogListDelegate: public QStyledItemDelegate {
public:
KListConfirmationDialogListDelegate(int iconSize)
: m_iconSize(iconSize)
{
}
virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
QStyleOptionViewItem o = option;
o.decorationSize = QSize(m_iconSize, m_iconSize);
QStyledItemDelegate::paint(painter, o, index);
}
private:
int m_iconSize;
};
KListConfirmationDialog::KListConfirmationDialog(
const QString & title, const QString & message,
const QString & confirm, const QString & cancel,
QWidget * parent, Qt::WindowFlags f)
: d(new KListConfirmationDialogPrivate())
{
setWindowTitle(title);
d->mainLayout = new QVBoxLayout(this);
d->mainLayout->addWidget(d->labelCaption = new QLabel(message, this));
d->mainLayout->addWidget(d->listItems = new QListWidget(this));
d->mainLayout->addLayout(d->buttonsLayout = new QHBoxLayout());
d->buttonsLayout->addStretch(1);
d->buttonsLayout->setContentsMargins(0, 0, 0, 0);
d->mainLayout->setContentsMargins(0, 0, 0, 0);
d->labelCaption->setWordWrap(true);
d->labelCaption->setContentsMargins(8, 8, 8, 8);
d->buttonsLayout->addWidget(d->buttonConfirm = new QPushButton("blah"));
d->buttonsLayout->addWidget(d->buttonCancel = new QPushButton("blah"));
d->buttonConfirm->setText(confirm);
d->buttonCancel->setText(cancel);
d->iconSize = KIconLoader::global()->currentSize(KIconLoader::Dialog);
if (d->iconSize < 16) d->iconSize = KIconLoader::SizeMedium;
d->listItems->setItemDelegate(new KListConfirmationDialogListDelegate(d->iconSize));
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
connect(d->buttonConfirm, SIGNAL(clicked()),
this, SLOT(confirm()));
connect(d->buttonCancel, SIGNAL(clicked()),
this, SLOT(cancel()));
}
KListConfirmationDialog::~KListConfirmationDialog()
{
delete d;
}
void KListConfirmationDialog::addItem(const KIcon & icon, const QString & title,
const QString & description, const QVariant & data, bool preselect)
{
QListWidgetItem * item = new QListWidgetItem(icon, title + (description.isNull() ? QString() : "\n" + description), d->listItems);
item->setCheckState(preselect ? Qt::Checked : Qt::Unchecked);
item->setSizeHint(QSize(d->iconSize * 3/2, d->iconSize * 3/2));
item->setData(Qt::UserRole, description);
item->setData(Qt::UserRole + 1, data);
d->listItems->addItem(item);
}
void KListConfirmationDialog::showEvent(QShowEvent * event)
{
// we want to update the size
int count = d->listItems->count();
if (count > 5) count = 5;
resize(size().width(),
count * d->iconSize * 3 / 2 // height for the list
+ d->buttonsLayout->sizeHint().height() // height for the buttons
+ d->labelCaption->sizeHint().height() // height for the label
+ 32);
// if (count == d->listItems->count()) {
// d->listItems->setStyleSheet("QListWidget { border-left: none; }");
// }
}
void KListConfirmationDialog::show()
{
}
void KListConfirmationDialog::exec()
{
QDialog::show();
}
void KListConfirmationDialog::confirm()
{
QList < QVariant > result;
foreach (QListWidgetItem * item, d->listItems->selectedItems()) {
result << item->data(Qt::UserRole + 1);
}
selected(result);
deleteLater();
}
void KListConfirmationDialog::cancel()
{
QList < QVariant > result;
selected(result);
deleteLater();
}

View file

@ -1,67 +0,0 @@
/*
* Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* or (at your option) any later version, as published by the Free
* Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KLISTCONFIRMATIONDIALOG_H
#define KLISTCONFIRMATIONDIALOG_H
class KListConfirmationDialogPrivate;
#include <QtCore/qvariant.h>
#include <QtGui/qdialog.h>
#include <KIcon>
/**
*
*/
class KListConfirmationDialog: public QDialog {
Q_OBJECT
public:
KListConfirmationDialog(
const QString & title = QString(),
const QString & message = QString(),
const QString & confirm = QString(),
const QString & cancel = QString(),
QWidget * parent = 0, Qt::WindowFlags f = 0);
virtual ~KListConfirmationDialog();
void addItem(const KIcon & icon, const QString & title,
const QString & description, const QVariant & data, bool preselect = false);
void exec();
protected:
void showEvent(QShowEvent * event);
protected Q_SLOTS:
void confirm();
void cancel();
Q_SIGNALS:
void selected(QList < QVariant > items);
private:
void show();
class KListConfirmationDialogPrivate * const d;
};
#endif // KLISTCONFIRMATIONDIALOG_H

View file

@ -54,14 +54,12 @@
#include "appadaptor.h"
#include "controllerwindow.h"
#include "checkbox.h"
#include "desktopcorona.h"
#include "desktopview.h"
#include "interactiveconsole.h"
#include "panelshadows.h"
#include "panelview.h"
#include "toolbutton.h"
#include "klistconfirmationdialog.h"
#ifdef Q_WS_X11
#include <X11/Xlib.h>